From: Konstantin Ananyev <konstantin.ananyev@huawei.com>
To: Andre Muezerie <andremue@linux.microsoft.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, Fengchengwen <fengchengwen@huawei.com>
Subject: RE: [PATCH v4 08/10] test-pmd: declare lcore_count atomic
Date: Fri, 21 Feb 2025 08:40:17 +0000 [thread overview]
Message-ID: <b6eaefbdba2c46228c1330d2afb81d3f@huawei.com> (raw)
In-Reply-To: <1740087064-18680-9-git-send-email-andremue@linux.microsoft.com>
> Compiling with MSVC results in the error below:
>
> app/test/test_ring_perf.c(197): error C7712: address argument to atomic
> operation must be a pointer to an atomic integer,
> 'volatile unsigned int *' is not valid
>
> The fix is to mark lcore_count as atomic.
>
> Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
> ---
> app/test/test_ring_perf.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/app/test/test_ring_perf.c b/app/test/test_ring_perf.c
> index 57cd04a124..366e256323 100644
> --- a/app/test/test_ring_perf.c
> +++ b/app/test/test_ring_perf.c
> @@ -34,7 +34,7 @@ struct lcore_pair {
> unsigned c1, c2;
> };
>
> -static volatile unsigned lcore_count = 0;
> +static RTE_ATOMIC(unsigned int) lcore_count;
But for not-MSVC builds RTE_ATOMIC() by default means nothing.
If you are removing volatile, then I think, you need to fix the code to ensure
that all reads/writes to this var are done with atomic ops.
Or have both - volatile and RTE_ATOMIC()
> static void
> test_ring_print_test_string(unsigned int api_type, int esize,
> @@ -193,11 +193,7 @@ enqueue_dequeue_bulk_helper(const unsigned int flag, struct thread_params *p)
> unsigned int n_remaining;
> const unsigned int bulk_n = bulk_sizes[p->ring_params->bulk_sizes_i];
>
> -#ifdef RTE_USE_C11_MEM_MODEL
> if (rte_atomic_fetch_add_explicit(&lcore_count, 1, rte_memory_order_relaxed) + 1 != 2)
> -#else
> - if (__sync_add_and_fetch(&lcore_count, 1) != 2)
> -#endif
> while(lcore_count != 2)
> rte_pause();
>
> --
> 2.48.1.vfs.0.0
>
next prev parent reply other threads:[~2025-02-21 8:40 UTC|newest]
Thread overview: 95+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-11 22:01 [PATCH 00/10] enable "app" to be compiled with MSVC Andre Muezerie
2025-02-11 22:01 ` [PATCH 01/10] eal: add workaround for __builtin_constant_p Andre Muezerie
2025-02-11 22:09 ` Stephen Hemminger
2025-02-12 0:59 ` fengchengwen
2025-02-11 22:01 ` [PATCH 02/10] test_alarm: avoid warning about different qualifiers Andre Muezerie
2025-02-12 0:59 ` fengchengwen
2025-02-11 22:01 ` [PATCH 03/10] test-pmd: fix printf format string mismatch Andre Muezerie
2025-02-11 22:10 ` Stephen Hemminger
2025-02-12 1:01 ` fengchengwen
2025-02-11 22:02 ` [PATCH 04/10] test-pmd: do explicit 64-bit shift to avoid implicit conversion Andre Muezerie
2025-02-12 1:03 ` fengchengwen
2025-02-11 22:02 ` [PATCH 05/10] test-pmd: avoid undefined behavior Andre Muezerie
2025-02-12 1:04 ` fengchengwen
2025-02-11 22:02 ` [PATCH 06/10] test-pmd: avoid non-constant initializer Andre Muezerie
2025-02-12 1:04 ` fengchengwen
2025-02-11 22:02 ` [PATCH 07/10] test-pmd: don't return value from void function Andre Muezerie
2025-02-12 1:10 ` fengchengwen
2025-02-11 22:02 ` [PATCH 08/10] test-pmd: declare lcore_count atomic when using C11 memory model Andre Muezerie
2025-02-11 22:12 ` Stephen Hemminger
2025-02-12 1:16 ` Andre Muezerie
2025-02-12 1:16 ` fengchengwen
2025-02-11 22:02 ` [PATCH 09/10] test: add workaround for __builtin_constant_p in test_memcpy_perf Andre Muezerie
2025-02-11 22:13 ` Stephen Hemminger
2025-02-12 2:07 ` Andre Muezerie
2025-02-18 15:35 ` [PATCH 00/10] enable "app" to be compiled with MSVC David Marchand
2025-02-18 16:31 ` [PATCH v2 " Andre Muezerie
2025-02-18 16:32 ` [PATCH v2 01/10] eal: add workaround for __builtin_constant_p Andre Muezerie
2025-02-18 17:12 ` Morten Brørup
2025-02-19 16:50 ` Andre Muezerie
2025-02-19 17:10 ` Stephen Hemminger
2025-02-20 1:59 ` Andre Muezerie
2025-02-18 16:32 ` [PATCH v2 02/10] test_alarm: avoid warning about different qualifiers Andre Muezerie
2025-02-18 16:32 ` [PATCH v2 03/10] test-pmd: fix printf format string mismatch Andre Muezerie
2025-02-18 16:46 ` Bruce Richardson
2025-02-18 17:03 ` Andre Muezerie
2025-02-18 17:07 ` Bruce Richardson
2025-02-19 17:08 ` Andre Muezerie
2025-02-18 16:32 ` [PATCH v2 04/10] test-pmd: do explicit 64-bit shift to avoid implicit conversion Andre Muezerie
2025-02-18 16:47 ` Bruce Richardson
2025-02-18 16:32 ` [PATCH v2 05/10] test-pmd: avoid undefined behavior Andre Muezerie
2025-02-18 16:41 ` Bruce Richardson
2025-02-19 17:09 ` Andre Muezerie
2025-02-18 16:32 ` [PATCH v2 06/10] test-pmd: avoid non-constant initializer Andre Muezerie
2025-02-18 16:32 ` [PATCH v2 07/10] test-pmd: don't return value from void function Andre Muezerie
2025-02-18 16:42 ` Bruce Richardson
2025-02-18 16:32 ` [PATCH v2 08/10] test-pmd: declare lcore_count atomic Andre Muezerie
2025-02-18 16:32 ` [PATCH v2 09/10] test: add workaround for __builtin_constant_p in test_memcpy_perf Andre Muezerie
2025-02-18 16:32 ` [PATCH v2 10/10] app: enable app directory to be compiled with MSVC Andre Muezerie
2025-02-18 16:49 ` Bruce Richardson
2025-02-19 9:15 ` David Marchand
2025-02-19 14:51 ` Andre Muezerie
2025-02-20 2:01 ` [PATCH v3 00/10] enable "app" " Andre Muezerie
2025-02-20 2:01 ` [PATCH v3 01/10] eal: add workaround for __builtin_constant_p Andre Muezerie
2025-02-20 2:27 ` Stephen Hemminger
2025-02-20 2:01 ` [PATCH v3 02/10] test_alarm: avoid warning about different qualifiers Andre Muezerie
2025-02-20 2:01 ` [PATCH v3 03/10] test-pmd: fix printf format string mismatch Andre Muezerie
2025-02-20 2:01 ` [PATCH v3 04/10] test-pmd: do explicit 64-bit shift to avoid implicit conversion Andre Muezerie
2025-02-20 2:01 ` [PATCH v3 05/10] test-pmd: avoid undefined behavior Andre Muezerie
2025-02-20 2:01 ` [PATCH v3 06/10] test-pmd: avoid non-constant initializer Andre Muezerie
2025-02-20 2:01 ` [PATCH v3 07/10] test-pmd: don't return value from void function Andre Muezerie
2025-02-20 2:01 ` [PATCH v3 08/10] test-pmd: declare lcore_count atomic Andre Muezerie
2025-02-20 2:01 ` [PATCH v3 09/10] test: add workaround for __builtin_constant_p in test_memcpy_perf Andre Muezerie
2025-02-20 2:01 ` [PATCH v3 10/10] app: enable app directory to be compiled with MSVC Andre Muezerie
2025-02-20 7:57 ` [PATCH v3 00/10] enable "app" " Morten Brørup
2025-02-20 21:30 ` [PATCH v4 " Andre Muezerie
2025-02-20 21:30 ` [PATCH v4 01/10] eal: add workaround for __builtin_constant_p Andre Muezerie
2025-02-21 15:31 ` Morten Brørup
2025-02-21 16:47 ` Andre Muezerie
2025-02-20 21:30 ` [PATCH v4 02/10] test_alarm: avoid warning about different qualifiers Andre Muezerie
2025-02-20 21:30 ` [PATCH v4 03/10] test-pmd: fix printf format string mismatch Andre Muezerie
2025-02-21 9:10 ` Bruce Richardson
2025-02-20 21:30 ` [PATCH v4 04/10] test-pmd: do explicit 64-bit shift to avoid implicit conversion Andre Muezerie
2025-02-20 21:30 ` [PATCH v4 05/10] test-pmd: avoid undefined behavior Andre Muezerie
2025-02-20 21:31 ` [PATCH v4 06/10] test-pmd: avoid non-constant initializer Andre Muezerie
2025-02-20 21:31 ` [PATCH v4 07/10] test-pmd: don't return value from void function Andre Muezerie
2025-02-20 21:31 ` [PATCH v4 08/10] test-pmd: declare lcore_count atomic Andre Muezerie
2025-02-21 8:40 ` Konstantin Ananyev [this message]
2025-02-21 19:47 ` Andre Muezerie
2025-02-20 21:31 ` [PATCH v4 09/10] test: add workaround for __builtin_constant_p in test_memcpy_perf Andre Muezerie
2025-02-20 21:31 ` [PATCH v4 10/10] app: enable app directory to be compiled with MSVC Andre Muezerie
2025-02-20 21:44 ` [PATCH v4 00/10] enable "app" " Stephen Hemminger
2025-02-21 19:52 ` [PATCH v5 " Andre Muezerie
2025-02-21 19:52 ` [PATCH v5 01/10] eal: add workaround for __builtin_constant_p Andre Muezerie
2025-02-21 19:52 ` [PATCH v5 02/10] test_alarm: avoid warning about different qualifiers Andre Muezerie
2025-02-21 19:52 ` [PATCH v5 03/10] test-pmd: fix printf format string mismatch Andre Muezerie
2025-02-21 19:52 ` [PATCH v5 04/10] test-pmd: do explicit 64-bit shift to avoid implicit conversion Andre Muezerie
2025-02-21 19:52 ` [PATCH v5 05/10] test-pmd: avoid undefined behavior Andre Muezerie
2025-02-21 19:52 ` [PATCH v5 06/10] test-pmd: avoid non-constant initializer Andre Muezerie
2025-02-21 19:52 ` [PATCH v5 07/10] test-pmd: don't return value from void function Andre Muezerie
2025-02-21 19:52 ` [PATCH v5 08/10] test-pmd: declare lcore_count atomic Andre Muezerie
2025-02-21 20:58 ` Morten Brørup
2025-02-21 19:52 ` [PATCH v5 09/10] test: add workaround for __builtin_constant_p in test_memcpy_perf Andre Muezerie
2025-02-22 2:13 ` fengchengwen
2025-02-21 19:52 ` [PATCH v5 10/10] app: enable app directory to be compiled with MSVC Andre Muezerie
2025-02-22 2:13 ` fengchengwen
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=b6eaefbdba2c46228c1330d2afb81d3f@huawei.com \
--to=konstantin.ananyev@huawei.com \
--cc=andremue@linux.microsoft.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.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).