From: Andre Muezerie <andremue@linux.microsoft.com>
To: David Marchand <david.marchand@redhat.com>
Cc: Bruce Richardson <bruce.richardson@intel.com>,
Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>,
dev@dpdk.org, Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: Re: [PATCH 1/3] lib/eal: add rte_atomic128_cmp_exchange compatible with MSVC
Date: Tue, 28 Jan 2025 13:25:40 -0800 [thread overview]
Message-ID: <20250128212540.GA16825@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> (raw)
In-Reply-To: <CAJFAV8wTsJaThDwdCeZf+jUbBiH32Ug-ZgbPE89fX00W5x-r4Q@mail.gmail.com>
On Fri, Jan 24, 2025 at 03:27:06PM +0100, David Marchand wrote:
> On Tue, Dec 10, 2024 at 5:33 PM Andre Muezerie
> <andremue@linux.microsoft.com> 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 <andremue@linux.microsoft.com>
> > ---
> > 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
next prev parent reply other threads:[~2025-01-28 21:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-10 16:32 [PATCH 0/3] enable build of lib/stack when using MSVC Andre Muezerie
2024-12-10 16:32 ` [PATCH 1/3] lib/eal: add rte_atomic128_cmp_exchange compatible with MSVC Andre Muezerie
2025-01-24 14:27 ` David Marchand
2025-01-28 21:25 ` Andre Muezerie [this message]
2024-12-10 16:32 ` [PATCH 2/3] app/test: add basic test for rte_atomic128_cmp_exchange Andre Muezerie
2024-12-10 16:32 ` [PATCH 3/3] lib/stack: enable build with MSVC Andre Muezerie
2025-01-28 21:16 ` [PATCH v2 0/2] enable build of lib/stack when using MSVC Andre Muezerie
2025-01-28 21:16 ` [PATCH v2 1/2] test: disable non-C11 atomic tests for MSVC Andre Muezerie
2025-01-28 21:16 ` [PATCH v2 2/2] stack: enable build with MSVC Andre Muezerie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250128212540.GA16825@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net \
--to=andremue@linux.microsoft.com \
--cc=bruce.richardson@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=konstantin.v.ananyev@yandex.ru \
--cc=roretzla@linux.microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).