From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2F0E0460B1; Tue, 28 Jan 2025 22:25:42 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BE9A740261; Tue, 28 Jan 2025 22:25:41 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 14CD64021F for ; Tue, 28 Jan 2025 22:25:41 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 17F39203718A; Tue, 28 Jan 2025 13:25:40 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 17F39203718A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738099540; bh=9Ni8KyUSSvpNE4gfC4TASD9z0wSbEZG/XWLLitY7MQM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iivZYsAKahUHi/YPnfrWUwKds5jJv6q1G/Wxc38niBRaxo7eQvSgNGl66HFqUg7Al GjXvKRlFxCYTw2aBn8X/2VtMCc7PZG+voPd7ibJCEmBncB5QYl3ELdCqA1Dm3OLRKe HyKmUOYH99ZC3VFm+v+4ZC0rpbbPGB8P6kODj/b8= Date: Tue, 28 Jan 2025 13:25:40 -0800 From: Andre Muezerie To: David Marchand Cc: Bruce Richardson , Konstantin Ananyev , dev@dpdk.org, Tyler Retzlaff Subject: Re: [PATCH 1/3] lib/eal: add rte_atomic128_cmp_exchange compatible with MSVC Message-ID: <20250128212540.GA16825@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1733848355-19048-1-git-send-email-andremue@linux.microsoft.com> <1733848355-19048-2-git-send-email-andremue@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Fri, Jan 24, 2025 at 03:27:06PM +0100, David Marchand wrote: > On Tue, Dec 10, 2024 at 5:33 PM Andre Muezerie > wrote: > > > > MSVC does not support inline assembly, which is used by the > > implementation of rte_atomic128_cmp_exchange and is needed > > by lib/stack. > > > > Error printed by MSVC: > > > > stack_rte_stack_lf.c.obj : error LNK2019: > > unresolved external symbol rte_atomic128_cmp_exchange referenced > > in function __rte_stack_lf_push_elems > > > > Fix is to provide an implementation for rte_atomic128_cmp_exchange > > which uses an intrinsic function, which is used when compiling with > > MSVC. For other compilers the existing implementation continues to > > be used. > > > > Signed-off-by: Andre Muezerie > > --- > > lib/eal/x86/include/rte_atomic.h | 4 ++-- > > lib/eal/x86/include/rte_atomic_64.h | 18 ++++++++++++++++++ > > 2 files changed, 20 insertions(+), 2 deletions(-) > > > > diff --git a/lib/eal/x86/include/rte_atomic.h b/lib/eal/x86/include/rte_atomic.h > > index c72c47c83e..e8e0e4c33c 100644 > > --- a/lib/eal/x86/include/rte_atomic.h > > +++ b/lib/eal/x86/include/rte_atomic.h > > @@ -288,12 +288,12 @@ static inline int rte_atomic32_dec_and_test(rte_atomic32_t *v) > > > > #endif > > > > +#endif /* RTE_TOOLCHAIN_MSVC */ > > + > > #ifdef RTE_ARCH_I686 > > #include "rte_atomic_32.h" > > #else > > #include "rte_atomic_64.h" > > #endif > > > > -#endif > > - > > This partially reverts 27da6a123414 ("eal: hide legacy atomics API for MSVC"). > It would be better to implement an equivalent to > rte_atomic128_cmp_exchange in the DPDK "new" stdatomic API > (rte_stdatomic.h). > > > -- > David Marchand Thanks for calling that out. After looking at the past commits I got a better understanding of the reasons the atomic-related code is laid out the way it is, and I agree that we should attempt to follow the same guidelines. For that reason I changed the approach taken in the v2 I sent out today. Let me know your thoughts. -- Andre Muezerie