[08/10] test-pmd: declare lcore_count atomic when using C11 memory model
Checks
Commit Message
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 when using C11 memory model.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
app/test/test_ring_perf.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Comments
On Tue, 11 Feb 2025 14:02:04 -0800
Andre Muezerie <andremue@linux.microsoft.com> wrote:
> 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 when using C11 memory model.
>
> Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
Prefer using RTE_ATOMIC() all teh time now.
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
On 2025/2/12 6:02, Andre Muezerie wrote:
> 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 when using C11 memory model.
>
> Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
On Tue, Feb 11, 2025 at 02:12:12PM -0800, Stephen Hemminger wrote:
> On Tue, 11 Feb 2025 14:02:04 -0800
> Andre Muezerie <andremue@linux.microsoft.com> wrote:
>
> > 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 when using C11 memory model.
> >
> > Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
>
> Prefer using RTE_ATOMIC() all teh time now.
You mean even when not explicitly using the C11 model, right?
@@ -34,7 +34,11 @@ struct lcore_pair {
unsigned c1, c2;
};
-static volatile unsigned lcore_count = 0;
+#ifdef RTE_USE_C11_MEM_MODEL
+static RTE_ATOMIC(unsigned int) lcore_count;
+#else
+static volatile unsigned int lcore_count;
+#endif
static void
test_ring_print_test_string(unsigned int api_type, int esize,