Skip to contentSkip to conversation

app/test: zcd needs to be initialised to fix gcc compile error

PATCH Superseded Conor Walsh 3 participants 13 messages Nov 4, 2020 – Nov 15, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/test: zcd needs to be initialised to fix gcc compile error

When DPDK is compiled with gcc < 9 with the optimization level set to 1 gcc sees zcd in test_ring.h as possibly being uninitialised. To correct this error zcd has been initialised to {0} in test_ring_mt_peek_stress_zc.c.

---
 app/test/test_ring_mt_peek_stress_zc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
app/test/test_ring_mt_peek_stress_zc.c +2 -2
index 7e0bd511a7..ba0acf237c 100644
@@ -11,7 +11,7 @@ _st_ring_dequeue_bulk(struct rte_ring *r, void **obj, uint32_t n,
 	uint32_t *avail)
 {
 	uint32_t m;
-	struct rte_ring_zc_data zcd;
+	struct rte_ring_zc_data zcd = {0};
 
 	m = rte_ring_dequeue_zc_bulk_start(r, n, &zcd, avail);
 	n = (m == n) ? n : 0;
@@ -29,7 +29,7 @@ _st_ring_enqueue_bulk(struct rte_ring *r, void * const *obj, uint32_t n,
 	uint32_t *free)
 {
 	uint32_t m;
-	struct rte_ring_zc_data zcd;
+	struct rte_ring_zc_data zcd = {0};
 
 	m = rte_ring_enqueue_zc_bulk_start(r, n, &zcd, free);
 	n = (m == n) ? n : 0;
Signature · 1 line
2.25.1
#1 lore raw

Hi Conor,
Thanks for the patch.

<snip>

Quoted 16 lines

When DPDK is compiled with gcc < 9 with the optimization level set to 1 gcc sees zcd in test_ring.h as possibly being uninitialised. To correct this error zcd has been initialised to {0} in test_ring_mt_peek_stress_zc.c.

---
 app/test/test_ring_mt_peek_stress_zc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
app/test/test_ring_mt_peek_stress_zc.c +0 -0
index 7e0bd511a7..ba0acf237c 100644

app/test/test_ring_mt_peek_stress_zc.c _st_ring_dequeue_bulk(struct rte_ring *r, void **obj, · line 15

Quoted 6 lines
app/test/test_ring_mt_peek_stress_zc.c +1 -1
@@ -11,7 +11,7 @@ _st_ring_dequeue_bulk(struct rte_ring *r, void **obj,
 uint32_t n,
 	uint32_t *avail)
 {
 	uint32_t m;
-	struct rte_ring_zc_data zcd;
+	struct rte_ring_zc_data zcd = {0};

I faced similar problems when I created this test case. I refrained from doing this initialization as it might mask the problems in the library. Is it possible to identify which path in the library is actually resulting in this error? I would prefer to fix that instead.

Quoted 15 lines
app/test/test_ring_mt_peek_stress_zc.c +1 -1
 	m = rte_ring_dequeue_zc_bulk_start(r, n, &zcd, avail);
 	n = (m == n) ? n : 0;
@@ -29,7 +29,7 @@ _st_ring_enqueue_bulk(struct rte_ring *r, void * const
 *obj, uint32_t n,
 	uint32_t *free)
 {
 	uint32_t m;
-	struct rte_ring_zc_data zcd;
+	struct rte_ring_zc_data zcd = {0};
 
 	m = rte_ring_enqueue_zc_bulk_start(r, n, &zcd, free);

n = (m == n) ? n : 0;
--
2.25.1

#2 lore raw

Hi Honnappa,

Sorry about the delayed reply.
The build error trace is below, the build command used was: CC=gcc meson --optimization=1 --werror build1; ninja -C build1 I am not sure how I could fix this issue without initialising zcd.

[2339/2407] Compiling C object app/test/dpdk-test.p/test_ring_mt_peek_stress_zc.c.o
FAILED: app/test/dpdk-test.p/test_ring_mt_peek_stress_zc.c.o
gcc -Iapp/test/dpdk-test.p -Iapp/test -I../app/test -Ilib/librte_acl -I../lib/librte_acl -I. -I.. -Iconfig -I../config -Ilib/librte_eal/include -I../lib/librte_eal/include -Ilib/librte_eal/linux/include -I../lib/librte_eal/linux/include -Ilib/librte_eal/x86/include -I../lib/librte_eal/x86/include -Ilib/librte_eal/common -I../lib/librte_eal/common -Ilib/librte_eal -I../lib/librte_eal -Ilib/librte_kvargs -I../lib/librte_kvargs -Ilib/librte_metrics -I../lib/librte_metrics -Ilib/librte_telemetry -I../lib/librte_telemetry -Idrivers/bus/pci -I../drivers/bus/pci -I../drivers/bus/pci/linux -Ilib/librte_pci -I../lib/librte_pci -Idrivers/bus/vdev -I../drivers/bus/vdev -Ilib/librte_bitratestats -I../lib/librte_bitratestats -Ilib/librte_ethdev -I../lib/librte_ethdev -Ilib/librte_net -I../lib/librte_net -Ilib/librte_mbuf -I../lib/librte_mbuf -Ilib/librte_mempool -I../lib/librte_mempool -Ilib/librte_ring -I../lib/librte_ring -Ilib/librte_meter -I../lib/librte_meter -Ilib/librte_bpf -I../lib/librte_bpf -Ilib/librte_cfgfile -I../lib/librte_cfgfile -Ilib/librte_cmdline -I../lib/librte_cmdline -Ilib/librte_cryptodev -I../lib/librte_cryptodev -Ilib/librte_distributor -I../lib/librte_distributor -Ilib/librte_efd -I../lib/librte_efd -Ilib/librte_hash -I../lib/librte_hash -Ilib/librte_rcu -I../lib/librte_rcu -Ilib/librte_eventdev -I../lib/librte_eventdev -Ilib/librte_timer -I../lib/librte_timer -Ilib/librte_fib -I../lib/librte_fib -Ilib/librte_rib -I../lib/librte_rib -Ilib/librte_flow_classify -I../lib/librte_flow_classify -Ilib/librte_table -I../lib/librte_table -Ilib/librte_port -I../lib/librte_port -Ilib/librte_sched -I../lib/librte_sched -Ilib/librte_ip_frag -I../lib/librte_ip_frag -Ilib/librte_kni -I../lib/librte_kni -Ilib/librte_lpm -I../lib/librte_lpm -Ilib/librte_graph -I../lib/librte_graph -Ilib/librte_ipsec -I../lib/librte_ipsec -Ilib/librte_security -I../lib/librte_security -Ilib/librte_latencystats -I../lib/librte_latencystats -Ilib/librte_member -I../lib/librte_member -Ilib/librte_node -I../lib/librte_node -Ilib/librte_pipeline -I../lib/librte_pipeline -Ilib/librte_rawdev -I../lib/librte_rawdev -Ilib/librte_reorder -I../lib/librte_reorder -Ilib/librte_stack -I../lib/librte_stack -Idrivers/mempool/ring -I../drivers/mempool/ring -Idrivers/mempool/stack -I../drivers/mempool/stack -Idrivers/event/skeleton -I../drivers/event/skeleton -Idrivers/net/bonding -I../drivers/net/bonding -Idrivers/net/ring -I../drivers/net/ring -Ilib/librte_power -I../lib/librte_power -Ilib/librte_pdump -I../lib/librte_pdump -Idrivers/crypto/scheduler -I../drivers/crypto/scheduler -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -O1 -include rte_config.h -Wextra -Wcast-qual -Wdeprecated -Wformat-nonliteral -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings -Wno-packed-not-aligned -Wno-missing-field-initializers -march=native -mno-avx512f -DALLOW_EXPERIMENTAL_API -Wno-format-truncation -D_GNU_SOURCE -fno-strict-aliasing -DALLOW_INTERNAL_API -MD -MQ app/test/dpdk-test.p/test_ring_mt_peek_stress_zc.c.o -MF app/test/dpdk-test.p/test_ring_mt_peek_stress_zc.c.o.d -o app/test/dpdk-test.p/test_ring_mt_peek_stress_zc.c.o -c ../app/test/test_ring_mt_peek_stress_zc.c In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring_stress_impl.h: In function 'test_worker':
../app/test/test_ring.h:82:3: error: 'zcd.n1' may be used uninitialized in this function [-Werror=maybe-uninitialized]
test_ring_mem_copy(zcd->ptr2, src,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      esize, num - zcd->n1);
      ~~~~~~~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:32:26: note: 'zcd.n1' was declared here
  struct rte_ring_zc_data zcd;
                          ^~~

In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring.h:67:2: error: '*((void *)&zcd+8)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
memcpy(dst, src, sz);
^~~~~~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:32:26: note: '*((void *)&zcd+8)' was declared here

  struct rte_ring_zc_data zcd;
                          ^~~

In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring.h:67:2: error: 'zcd' may be used uninitialized in this function [-Werror=maybe-uninitialized]
memcpy(dst, src, sz);
^~~~~~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:32:26: note: 'zcd' was declared here

  struct rte_ring_zc_data zcd;
                          ^~~
In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring.h:63:11: error: 'zcd.n1' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  sz = num * sizeof(void *);
       ~~~~^~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:14:26: note: 'zcd.n1' was declared here
  struct rte_ring_zc_data zcd;
                          ^~~

In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring.h:67:2: error: '*((void *)&zcd+8)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
memcpy(dst, src, sz);
^~~~~~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:14:26: note: '*((void *)&zcd+8)' was declared here

  struct rte_ring_zc_data zcd;
                          ^~~

In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring.h:67:2: error: 'zcd' may be used uninitialized in this function [-Werror=maybe-uninitialized]
memcpy(dst, src, sz);
^~~~~~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:14:26: note: 'zcd' was declared here

  struct rte_ring_zc_data zcd;
                          ^~~

cc1: all warnings being treated as errors
[2340/2407] Compiling C object drivers/libtmp_...ontx2.a.p/event_octeontx2_otx2_worker_dual.c.o
ninja: build stopped: subcommand failed.

Thanks,
Conor.

Quoted 59 lines

From: Honnappa Nagarahalli <[email protected]>
Sent: Wednesday 4 November 2020 18:48
To: Walsh, Conor <[email protected]>; Ananyev, Konstantin <[email protected]>
Cc: [email protected]; Chen, LingliX <[email protected]>; nd <[email protected]>; Honnappa Nagarahalli <[email protected]>; nd <[email protected]>
Subject: RE: [PATCH v1] app/test: zcd needs to be initialised to fix gcc compile error

Hi Conor,
Thanks for the patch.

<snip>

Quoted 3 lines

When DPDK is compiled with gcc < 9 with the optimization level set to 1 gcc sees zcd in test_ring.h as possibly being uninitialised. To correct this error

zcd

Quoted 13 lines

has been initialised to {0} in test_ring_mt_peek_stress_zc.c.

---
 app/test/test_ring_mt_peek_stress_zc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
app/test/test_ring_mt_peek_stress_zc.c +0 -0
index 7e0bd511a7..ba0acf237c 100644

app/test/test_ring_mt_peek_stress_zc.c _st_ring_dequeue_bulk(struct rte_ring *r, void **obj, · line 15

Quoted 6 lines
app/test/test_ring_mt_peek_stress_zc.c +1 -1
@@ -11,7 +11,7 @@ _st_ring_dequeue_bulk(struct rte_ring *r, void **obj,
 uint32_t n,
 	uint32_t *avail)
 {
 	uint32_t m;
-	struct rte_ring_zc_data zcd;
+	struct rte_ring_zc_data zcd = {0};

I faced similar problems when I created this test case. I refrained from doing this initialization as it might mask the problems in the library. Is it possible to identify which path in the library is actually resulting in this error? I would prefer to fix that instead.

app/test/test_ring_mt_peek_stress_zc.c _st_ring_enqueue_bulk(struct rte_ring *r, void *

Quoted 4 lines
app/test/test_ring_mt_peek_stress_zc.c +0 -0
 	m = rte_ring_dequeue_zc_bulk_start(r, n, &zcd, avail);
 	n = (m == n) ? n : 0;
@@ -29,7 +29,7 @@ _st_ring_enqueue_bulk(struct rte_ring *r, void *

const

Quoted 11 lines
app/test/test_ring_mt_peek_stress_zc.c +1 -1
 *obj, uint32_t n,
 	uint32_t *free)
 {
 	uint32_t m;
-	struct rte_ring_zc_data zcd;
+	struct rte_ring_zc_data zcd = {0};
 
 	m = rte_ring_enqueue_zc_bulk_start(r, n, &zcd, free);

n = (m == n) ? n : 0;
--
2.25.1

#3 lore raw

<snip>

Quoted 4 lines

Hi Honnappa,

Sorry about the delayed reply.

No problem, thank you.

Quoted 66 lines

The build error trace is below, the build command used was: CC=gcc meson -- optimization=1 --werror build1; ninja -C build1 I am not sure how I could fix this issue without initialising zcd.

[2339/2407] Compiling C object app/test/dpdk- test.p/test_ring_mt_peek_stress_zc.c.o
FAILED: app/test/dpdk-test.p/test_ring_mt_peek_stress_zc.c.o
gcc -Iapp/test/dpdk-test.p -Iapp/test -I../app/test -Ilib/librte_acl - I../lib/librte_acl -I. -I.. -Iconfig -I../config -Ilib/librte_eal/include - I../lib/librte_eal/include -Ilib/librte_eal/linux/include - I../lib/librte_eal/linux/include -Ilib/librte_eal/x86/include - I../lib/librte_eal/x86/include -Ilib/librte_eal/common - I../lib/librte_eal/common -Ilib/librte_eal -I../lib/librte_eal -Ilib/librte_kvargs - I../lib/librte_kvargs -Ilib/librte_metrics -I../lib/librte_metrics - Ilib/librte_telemetry -I../lib/librte_telemetry -Idrivers/bus/pci - I../drivers/bus/pci -I../drivers/bus/pci/linux -Ilib/librte_pci -I../lib/librte_pci - Idrivers/bus/vdev -I../drivers/bus/vdev -Ilib/librte_bitratestats - I../lib/librte_bitratestats -Ilib/librte_ethdev -I../lib/librte_ethdev - Ilib/librte_net -I../lib/librte_net -Ilib/librte_mbuf -I../lib/librte_mbuf - Ilib/librte_mempool -I../lib/librte_mempool -Ilib/librte_ring -I../lib/librte_ring -Ilib/librte_meter -I../lib/librte_meter -Ilib/librte_bpf -I../lib/librte_bpf - Ilib/librte_cfgfile -I../lib/librte_cfgfile -Ilib/librte_cmdline -I../lib/librte_cmdline -Ilib/librte_cryptodev -I../lib/librte_cryptodev -Ilib/librte_distributor - I../lib/librte_distributor -Ilib/librte_efd -I../lib/librte_efd -Ilib/librte_hash - I../lib/librte_hash -Ilib/librte_rcu -I../lib/librte_rcu -Ilib/librte_eventdev - I../lib/librte_eventdev -Ilib/librte_timer -I../lib/librte_timer -Ilib/librte_fib - I../lib/librte_fib -Ilib/librte_rib -I../lib/librte_rib -Ilib/librte_flow_classify - I../lib/librte_flow_classify -Ilib/librte_table -I../lib/librte_table -Ilib/librte_port -I../lib/librte_port -Ilib/librte_sched -I../lib/librte_sched -Ilib/librte_ip_frag - I../lib/librte_ip_frag -Ilib/librte_kni -I../lib/librte_kni -Ilib/librte_lpm - I../lib/librte_lpm -Ilib/librte_graph -I../lib/librte_graph -Ilib/librte_ipsec - I../lib/librte_ipsec -Ilib/librte_security -I../lib/librte_security - Ilib/librte_latencystats -I../lib/librte_latencystats -Ilib/librte_member - I../lib/librte_member -Ilib/librte_node -I../lib/librte_node -Ilib/librte_pipeline -I../lib/librte_pipeline -Ilib/librte_rawdev -I../lib/librte_rawdev - Ilib/librte_reorder -I../lib/librte_reorder -Ilib/librte_stack -I../lib/librte_stack - Idrivers/mempool/ring -I../drivers/mempool/ring -Idrivers/mempool/stack - I../drivers/mempool/stack -Idrivers/event/skeleton - I../drivers/event/skeleton -Idrivers/net/bonding -I../drivers/net/bonding - Idrivers/net/ring -I../drivers/net/ring -Ilib/librte_power -I../lib/librte_power - Ilib/librte_pdump -I../lib/librte_pdump -Idrivers/crypto/scheduler - I../drivers/crypto/scheduler -fdiagnostics-color=always -pipe - D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -O1 -include rte_config.h -Wextra -Wcast-qual -Wdeprecated -Wformat-nonliteral - Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wnested- externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict- prototypes -Wundef -Wwrite-strings -Wno-packed-not-aligned -Wno-missing- field-initializers -march=native -mno-avx512f -DALLOW_EXPERIMENTAL_API - Wno-format-truncation -D_GNU_SOURCE -fno-strict-aliasing - DALLOW_INTERNAL_API -MD -MQ app/test/dpdk- test.p/test_ring_mt_peek_stress_zc.c.o -MF app/test/dpdk- test.p/test_ring_mt_peek_stress_zc.c.o.d -o app/test/dpdk- test.p/test_ring_mt_peek_stress_zc.c.o -c ../app/test/test_ring_mt_peek_stress_zc.c
In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring_stress_impl.h: In function 'test_worker':
../app/test/test_ring.h:82:3: error: 'zcd.n1' may be used uninitialized in this function [-Werror=maybe-uninitialized]
test_ring_mem_copy(zcd->ptr2, src,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      esize, num - zcd->n1);
      ~~~~~~~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:32:26: note: 'zcd.n1' was declared
here
  struct rte_ring_zc_data zcd;
                          ^~~
Quoted 7 lines

In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring.h:67:2: error: '*((void *)&zcd+8)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
memcpy(dst, src, sz);
^~~~~~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:32:26: note: '*((void *)&zcd+8)' was declared here

I remember seeing a similar error in test_ring_st_peek_stress_zc.c.
In the file test_ring_mt_peek_stress_zc.c, after the call to enqueue/dequeue API calls, we have:
"n = (m == n) ? n : 0;"

This is present as the code was copied from existing code. I do not see why this line is required. Can you please try to remove this line and see if it works?

Quoted 106 lines
  struct rte_ring_zc_data zcd;
                          ^~~

In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring.h:67:2: error: 'zcd' may be used uninitialized in this function [-Werror=maybe-uninitialized]
memcpy(dst, src, sz);
^~~~~~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:32:26: note: 'zcd' was declared here

  struct rte_ring_zc_data zcd;
                          ^~~
In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring.h:63:11: error: 'zcd.n1' may be used uninitialized in this
function [-Werror=maybe-uninitialized]
  sz = num * sizeof(void *);
       ~~~~^~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:14:26: note: 'zcd.n1' was declared
here
  struct rte_ring_zc_data zcd;
                          ^~~

In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring.h:67:2: error: '*((void *)&zcd+8)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
memcpy(dst, src, sz);
^~~~~~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:14:26: note: '*((void *)&zcd+8)' was declared here

  struct rte_ring_zc_data zcd;
                          ^~~

In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring.h:67:2: error: 'zcd' may be used uninitialized in this function [-Werror=maybe-uninitialized]
memcpy(dst, src, sz);
^~~~~~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:14:26: note: 'zcd' was declared here

  struct rte_ring_zc_data zcd;
                          ^~~

cc1: all warnings being treated as errors [2340/2407] Compiling C object drivers/libtmp_...ontx2.a.p/event_octeontx2_otx2_worker_dual.c.o
ninja: build stopped: subcommand failed.

Thanks,
Conor.

Quoted 6 lines

From: Honnappa Nagarahalli <[email protected]>
Sent: Wednesday 4 November 2020 18:48
To: Walsh, Conor <[email protected]>; Ananyev, Konstantin <[email protected]>
Cc: [email protected]; Chen, LingliX <[email protected]>; nd <[email protected]>; Honnappa Nagarahalli <[email protected]>;

nd

Quoted 54 lines

<[email protected]>
Subject: RE: [PATCH v1] app/test: zcd needs to be initialised to fix gcc compile error

Hi Conor,
Thanks for the patch.

<snip>

Quoted 4 lines

When DPDK is compiled with gcc < 9 with the optimization level set to 1 gcc sees zcd in test_ring.h as possibly being uninitialised. To correct this error

zcd

Quoted 13 lines

has been initialised to {0} in test_ring_mt_peek_stress_zc.c.

---
 app/test/test_ring_mt_peek_stress_zc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
app/test/test_ring_mt_peek_stress_zc.c +0 -0
index 7e0bd511a7..ba0acf237c 100644

app/test/test_ring_mt_peek_stress_zc.c _st_ring_dequeue_bulk(struct rte_ring *r, void · line 15

Quoted 6 lines
app/test/test_ring_mt_peek_stress_zc.c +1 -1
@@ -11,7 +11,7 @@ _st_ring_dequeue_bulk(struct rte_ring *r, void
 **obj, uint32_t n,
 	uint32_t *avail)
 {
 	uint32_t m;
-	struct rte_ring_zc_data zcd;
+	struct rte_ring_zc_data zcd = {0};

I faced similar problems when I created this test case. I refrained from doing this initialization as it might mask the problems in the library. Is it possible to identify which path in the library is actually resulting in this error? I would prefer to fix that instead.

app/test/test_ring_mt_peek_stress_zc.c _st_ring_enqueue_bulk(struct rte_ring *r, void *

Quoted 4 lines
app/test/test_ring_mt_peek_stress_zc.c +0 -0
 	m = rte_ring_dequeue_zc_bulk_start(r, n, &zcd, avail);
 	n = (m == n) ? n : 0;
@@ -29,7 +29,7 @@ _st_ring_enqueue_bulk(struct rte_ring *r, void *

const

Quoted 11 lines
app/test/test_ring_mt_peek_stress_zc.c +1 -1
 *obj, uint32_t n,
 	uint32_t *free)
 {
 	uint32_t m;
-	struct rte_ring_zc_data zcd;
+	struct rte_ring_zc_data zcd = {0};
 
 	m = rte_ring_enqueue_zc_bulk_start(r, n, &zcd, free);

n = (m == n) ? n : 0;
--
2.25.1

#4 lore raw

Hi Honnappa,

Quoted 107 lines

From: Honnappa Nagarahalli <[email protected]>
Sent: Monday 9 November 2020 16:45
To: Walsh, Conor <[email protected]>; Ananyev, Konstantin <[email protected]>
Cc: [email protected]; Chen, LingliX <[email protected]>; nd <[email protected]>; Honnappa Nagarahalli <[email protected]>; nd <[email protected]>
Subject: RE: [PATCH v1] app/test: zcd needs to be initialised to fix gcc compile error

<snip>

Quoted 4 lines

Hi Honnappa,

Sorry about the delayed reply.

No problem, thank you.

Quoted 1 line

The build error trace is below, the build command used was: CC=gcc meson

--

Quoted 12 lines

optimization=1 --werror build1; ninja -C build1 I am not sure how I could fix this issue without initialising zcd.

[2339/2407] Compiling C object app/test/dpdk- test.p/test_ring_mt_peek_stress_zc.c.o
FAILED: app/test/dpdk-test.p/test_ring_mt_peek_stress_zc.c.o gcc -Iapp/test/dpdk-test.p -Iapp/test -I../app/test -Ilib/librte_acl - I../lib/librte_acl -I. -I.. -Iconfig -I../config -Ilib/librte_eal/include - I../lib/librte_eal/include -Ilib/librte_eal/linux/include - I../lib/librte_eal/linux/include -Ilib/librte_eal/x86/include - I../lib/librte_eal/x86/include -Ilib/librte_eal/common - I../lib/librte_eal/common -Ilib/librte_eal -I../lib/librte_eal -

Ilib/librte_kvargs -

Quoted 3 lines

I../lib/librte_kvargs -Ilib/librte_metrics -I../lib/librte_metrics - Ilib/librte_telemetry -I../lib/librte_telemetry -Idrivers/bus/pci - I../drivers/bus/pci -I../drivers/bus/pci/linux -Ilib/librte_pci -I../lib/librte_pci

-

Quoted 4 lines

Idrivers/bus/vdev -I../drivers/bus/vdev -Ilib/librte_bitratestats - I../lib/librte_bitratestats -Ilib/librte_ethdev -I../lib/librte_ethdev - Ilib/librte_net -I../lib/librte_net -Ilib/librte_mbuf -I../lib/librte_mbuf - Ilib/librte_mempool -I../lib/librte_mempool -Ilib/librte_ring -

I../lib/librte_ring

Quoted 2 lines

-Ilib/librte_meter -I../lib/librte_meter -Ilib/librte_bpf -I../lib/librte_bpf - Ilib/librte_cfgfile -I../lib/librte_cfgfile -Ilib/librte_cmdline -

I../lib/librte_cmdline

Quoted 6 lines

-Ilib/librte_cryptodev -I../lib/librte_cryptodev -Ilib/librte_distributor - I../lib/librte_distributor -Ilib/librte_efd -I../lib/librte_efd -Ilib/librte_hash - I../lib/librte_hash -Ilib/librte_rcu -I../lib/librte_rcu -Ilib/librte_eventdev - I../lib/librte_eventdev -Ilib/librte_timer -I../lib/librte_timer -Ilib/librte_fib - I../lib/librte_fib -Ilib/librte_rib -I../lib/librte_rib -Ilib/librte_flow_classify - I../lib/librte_flow_classify -Ilib/librte_table -I../lib/librte_table -

Ilib/librte_port

Quoted 1 line

-I../lib/librte_port -Ilib/librte_sched -I../lib/librte_sched -Ilib/librte_ip_frag

-

Quoted 5 lines

I../lib/librte_ip_frag -Ilib/librte_kni -I../lib/librte_kni -Ilib/librte_lpm - I../lib/librte_lpm -Ilib/librte_graph -I../lib/librte_graph -Ilib/librte_ipsec - I../lib/librte_ipsec -Ilib/librte_security -I../lib/librte_security - Ilib/librte_latencystats -I../lib/librte_latencystats -Ilib/librte_member - I../lib/librte_member -Ilib/librte_node -I../lib/librte_node -

Ilib/librte_pipeline

Quoted 2 lines

-I../lib/librte_pipeline -Ilib/librte_rawdev -I../lib/librte_rawdev - Ilib/librte_reorder -I../lib/librte_reorder -Ilib/librte_stack -

I../lib/librte_stack -

Quoted 1 line

Idrivers/mempool/ring -I../drivers/mempool/ring -Idrivers/mempool/stack

-

Quoted 3 lines

I../drivers/mempool/stack -Idrivers/event/skeleton - I../drivers/event/skeleton -Idrivers/net/bonding -I../drivers/net/bonding - Idrivers/net/ring -I../drivers/net/ring -Ilib/librte_power -

I../lib/librte_power -

Quoted 5 lines

Ilib/librte_pdump -I../lib/librte_pdump -Idrivers/crypto/scheduler - I../drivers/crypto/scheduler -fdiagnostics-color=always -pipe - D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -O1 -include rte_config.h -Wextra -Wcast-qual -Wdeprecated -Wformat-nonliteral - Wformat-security -Wmissing-declarations -Wmissing-prototypes -

Wnested-

Quoted 2 lines

externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict- prototypes -Wundef -Wwrite-strings -Wno-packed-not-aligned -Wno-

missing-

Quoted 1 line

field-initializers -march=native -mno-avx512f -

DALLOW_EXPERIMENTAL_API -

Quoted 12 lines

Wno-format-truncation -D_GNU_SOURCE -fno-strict-aliasing - DALLOW_INTERNAL_API -MD -MQ app/test/dpdk- test.p/test_ring_mt_peek_stress_zc.c.o -MF app/test/dpdk- test.p/test_ring_mt_peek_stress_zc.c.o.d -o app/test/dpdk- test.p/test_ring_mt_peek_stress_zc.c.o -c ../app/test/test_ring_mt_peek_stress_zc.c
In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring_stress_impl.h: In function 'test_worker':
../app/test/test_ring.h:82:3: error: 'zcd.n1' may be used uninitialized in this function [-Werror=maybe-uninitialized]
test_ring_mem_copy(zcd->ptr2, src, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Quoted 3 lines
      esize, num - zcd->n1);
      ~~~~~~~~~~~~~~~~~~~~~

../app/test/test_ring_mt_peek_stress_zc.c:32:26: note: 'zcd.n1' was

declared

Quoted 9 lines

here

  struct rte_ring_zc_data zcd;
                          ^~~

In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring.h:67:2: error: '*((void *)&zcd+8)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
memcpy(dst, src, sz);
^~~~~~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:32:26: note: '*((void

*)&zcd+8)'

Quoted 1 line

was declared here

Quoted 8 lines

I remember seeing a similar error in test_ring_st_peek_stress_zc.c. In the file test_ring_mt_peek_stress_zc.c, after the call to enqueue/dequeue API calls, we have:
"n = (m == n) ? n : 0;"

This is present as the code was copied from existing code. I do not see why this line is required. Can you please try to remove this line and see if it works?

I commented out all occurrences of that line in test_ring_mt_peek_stess_zc.c and the build is still failing. Trace at end of email.

Quoted 107 lines
Quoted 10 lines
  struct rte_ring_zc_data zcd;
                          ^~~

In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring.h:67:2: error: 'zcd' may be used uninitialized in this function [-Werror=maybe-uninitialized]
memcpy(dst, src, sz);
^~~~~~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:32:26: note: 'zcd' was declared here

Quoted 4 lines
  struct rte_ring_zc_data zcd;
                          ^~~

In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring.h:63:11: error: 'zcd.n1' may be used uninitialized in

this

Quoted 4 lines

function [-Werror=maybe-uninitialized]

  sz = num * sizeof(void *);
       ~~~~^~~~~~~~~~~~~~~~

../app/test/test_ring_mt_peek_stress_zc.c:14:26: note: 'zcd.n1' was

declared

Quoted 9 lines

here

  struct rte_ring_zc_data zcd;
                          ^~~

In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring.h:67:2: error: '*((void *)&zcd+8)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
memcpy(dst, src, sz);
^~~~~~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:14:26: note: '*((void

*)&zcd+8)'

Quoted 10 lines

was declared here

  struct rte_ring_zc_data zcd;
                          ^~~

In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring.h:67:2: error: 'zcd' may be used uninitialized in this function [-Werror=maybe-uninitialized]
memcpy(dst, src, sz);
^~~~~~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:14:26: note: 'zcd' was declared here

Quoted 15 lines
  struct rte_ring_zc_data zcd;
                          ^~~

cc1: all warnings being treated as errors [2340/2407] Compiling C object drivers/libtmp_...ontx2.a.p/event_octeontx2_otx2_worker_dual.c.o
ninja: build stopped: subcommand failed.

Thanks,
Conor.

Quoted 6 lines

From: Honnappa Nagarahalli <[email protected]>
Sent: Wednesday 4 November 2020 18:48
To: Walsh, Conor <[email protected]>; Ananyev, Konstantin <[email protected]>
Cc: [email protected]; Chen, LingliX <[email protected]>; nd <[email protected]>; Honnappa Nagarahalli

<[email protected]>;

Quoted 51 lines

nd

Quoted 50 lines

<[email protected]>
Subject: RE: [PATCH v1] app/test: zcd needs to be initialised to fix gcc compile error

Hi Conor,
Thanks for the patch.

<snip>

Quoted 4 lines

When DPDK is compiled with gcc < 9 with the optimization level set to 1 gcc sees zcd in test_ring.h as possibly being uninitialised. To correct this error

zcd

Quoted 13 lines

has been initialised to {0} in test_ring_mt_peek_stress_zc.c.

---
 app/test/test_ring_mt_peek_stress_zc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
app/test/test_ring_mt_peek_stress_zc.c +0 -0
index 7e0bd511a7..ba0acf237c 100644

app/test/test_ring_mt_peek_stress_zc.c _st_ring_dequeue_bulk(struct rte_ring *r, void · line 15

Quoted 6 lines
app/test/test_ring_mt_peek_stress_zc.c +1 -1
@@ -11,7 +11,7 @@ _st_ring_dequeue_bulk(struct rte_ring *r, void
 **obj, uint32_t n,
 	uint32_t *avail)
 {
 	uint32_t m;
-	struct rte_ring_zc_data zcd;
+	struct rte_ring_zc_data zcd = {0};

I faced similar problems when I created this test case. I refrained from doing this initialization as it might mask the problems in the library. Is it possible to identify which path in the library is actually resulting in this error? I would prefer to fix that instead.

app/test/test_ring_mt_peek_stress_zc.c _st_ring_enqueue_bulk(struct rte_ring *r, void *

Quoted 4 lines
app/test/test_ring_mt_peek_stress_zc.c +0 -0
 	m = rte_ring_dequeue_zc_bulk_start(r, n, &zcd, avail);
 	n = (m == n) ? n : 0;
@@ -29,7 +29,7 @@ _st_ring_enqueue_bulk(struct rte_ring *r, void *

const

Quoted 7 lines
app/test/test_ring_mt_peek_stress_zc.c +1 -1
 *obj, uint32_t n,
 	uint32_t *free)
 {
 	uint32_t m;
-	struct rte_ring_zc_data zcd;
+	struct rte_ring_zc_data zcd = {0};
 
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
app/test/test_ring_mt_peek_stress_zc.c +0 -0
 	m = rte_ring_enqueue_zc_bulk_start(r, n, &zcd, free);

n = (m == n) ? n : 0;
--
2.25.1

Thanks,
Conor.

[2339/2407] Compiling C object app/test/dpdk-test.p/test_ring_mt_peek_stress_zc.c.o
FAILED: app/test/dpdk-test.p/test_ring_mt_peek_stress_zc.c.o
gcc -Iapp/test/dpdk-test.p -Iapp/test -I../app/test -Ilib/librte_acl -I../lib/librte_acl -I. -I.. -Iconfig -I../config -Ilib/librte_eal/include -I../lib/librte_eal/include -Ilib/librte_eal/linux/include -I../lib/librte_eal/linux/include -Ilib/librte_eal/x86/include -I../lib/librte_eal/x86/include -Ilib/librte_eal/common -I../lib/librte_eal/common -Ilib/librte_eal -I../lib/librte_eal -Ilib/librte_kvargs -I../lib/librte_kvargs -Ilib/librte_metrics -I../lib/librte_metrics -Ilib/librte_telemetry -I../lib/librte_telemetry -Idrivers/bus/pci -I../drivers/bus/pci -I../drivers/bus/pci/linux -Ilib/librte_pci -I../lib/librte_pci -Idrivers/bus/vdev -I../drivers/bus/vdev -Ilib/librte_bitratestats -I../lib/librte_bitratestats -Ilib/librte_ethdev -I../lib/librte_ethdev -Ilib/librte_net -I../lib/librte_net -Ilib/librte_mbuf -I../lib/librte_mbuf -Ilib/librte_mempool -I../lib/librte_mempool -Ilib/librte_ring -I../lib/librte_ring -Ilib/librte_meter -I../lib/librte_meter -Ilib/librte_bpf -I../lib/librte_bpf -Ilib/librte_cfgfile -I../lib/librte_cfgfile -Ilib/librte_cmdline -I../lib/librte_cmdline -Ilib/librte_cryptodev -I../lib/librte_cryptodev -Ilib/librte_distributor -I../lib/librte_distributor -Ilib/librte_efd -I../lib/librte_efd -Ilib/librte_hash -I../lib/librte_hash -Ilib/librte_rcu -I../lib/librte_rcu -Ilib/librte_eventdev -I../lib/librte_eventdev -Ilib/librte_timer -I../lib/librte_timer -Ilib/librte_fib -I../lib/librte_fib -Ilib/librte_rib -I../lib/librte_rib -Ilib/librte_flow_classify -I../lib/librte_flow_classify -Ilib/librte_table -I../lib/librte_table -Ilib/librte_port -I../lib/librte_port -Ilib/librte_sched -I../lib/librte_sched -Ilib/librte_ip_frag -I../lib/librte_ip_frag -Ilib/librte_kni -I../lib/librte_kni -Ilib/librte_lpm -I../lib/librte_lpm -Ilib/librte_graph -I../lib/librte_graph -Ilib/librte_ipsec -I../lib/librte_ipsec -Ilib/librte_security -I../lib/librte_security -Ilib/librte_latencystats -I../lib/librte_latencystats -Ilib/librte_member -I../lib/librte_member -Ilib/librte_node -I../lib/librte_node -Ilib/librte_pipeline -I../lib/librte_pipeline -Ilib/librte_rawdev -I../lib/librte_rawdev -Ilib/librte_reorder -I../lib/librte_reorder -Ilib/librte_stack -I../lib/librte_stack -Idrivers/mempool/ring -I../drivers/mempool/ring -Idrivers/mempool/stack -I../drivers/mempool/stack -Idrivers/event/skeleton -I../drivers/event/skeleton -Idrivers/net/bonding -I../drivers/net/bonding -Idrivers/net/ring -I../drivers/net/ring -Ilib/librte_power -I../lib/librte_power -Ilib/librte_pdump -I../lib/librte_pdump -Idrivers/crypto/scheduler -I../drivers/crypto/scheduler -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -O1 -include rte_config.h -Wextra -Wcast-qual -Wdeprecated -Wformat-nonliteral -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings -Wno-packed-not-aligned -Wno-missing-field-initializers -march=native -mno-avx512f -DALLOW_EXPERIMENTAL_API -Wno-format-truncation -D_GNU_SOURCE -fno-strict-aliasing -DALLOW_INTERNAL_API -MD -MQ app/test/dpdk-test.p/test_ring_mt_peek_stress_zc.c.o -MF app/test/dpdk-test.p/test_ring_mt_peek_stress_zc.c.o.d -o app/test/dpdk-test.p/test_ring_mt_peek_stress_zc.c.o -c ../app/test/test_ring_mt_peek_stress_zc.c ../app/test/test_ring_mt_peek_stress_zc.c: In function '_st_ring_dequeue_bulk':
../app/test/test_ring_mt_peek_stress_zc.c:13:11: error: variable 'm' set but not used [-Werror=unused-but-set-variable]

  uint32_t m;
           ^
../app/test/test_ring_mt_peek_stress_zc.c: In function '_st_ring_enqueue_bulk':
../app/test/test_ring_mt_peek_stress_zc.c:31:11: error: variable 'm' set but not used [-Werror=unused-but-set-variable]
  uint32_t m;
           ^

In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring_stress_impl.h: In function 'test_mt1':
../app/test/test_ring.h:82:3: error: 'zcd.n1' may be used uninitialized in this function [-Werror=maybe-uninitialized]
test_ring_mem_copy(zcd->ptr2, src,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      esize, num - zcd->n1);
      ~~~~~~~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:32:26: note: 'zcd.n1' was declared here
  struct rte_ring_zc_data zcd;
                          ^~~

In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring.h:67:2: error: '*((void *)&zcd+8)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
memcpy(dst, src, sz);
^~~~~~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:32:26: note: '*((void *)&zcd+8)' was declared here

  struct rte_ring_zc_data zcd;
                          ^~~

In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring.h:67:2: error: 'zcd' may be used uninitialized in this function [-Werror=maybe-uninitialized]
memcpy(dst, src, sz);
^~~~~~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:32:26: note: 'zcd' was declared here

  struct rte_ring_zc_data zcd;
                          ^~~
In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring_stress_impl.h: In function 'test_worker':
../app/test/test_ring.h:63:11: error: 'zcd.n1' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  sz = num * sizeof(void *);
       ~~~~^~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:32:26: note: 'zcd.n1' was declared here
  struct rte_ring_zc_data zcd;
                          ^~~

In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring.h:67:2: error: '*((void *)&zcd+8)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
memcpy(dst, src, sz);
^~~~~~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:32:26: note: '*((void *)&zcd+8)' was declared here

  struct rte_ring_zc_data zcd;
                          ^~~

In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring.h:67:2: error: 'zcd' may be used uninitialized in this function [-Werror=maybe-uninitialized]
memcpy(dst, src, sz);
^~~~~~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:32:26: note: 'zcd' was declared here

  struct rte_ring_zc_data zcd;
                          ^~~
In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring.h:63:11: error: 'zcd.n1' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  sz = num * sizeof(void *);
       ~~~~^~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:14:26: note: 'zcd.n1' was declared here
  struct rte_ring_zc_data zcd;
                          ^~~

In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring.h:67:2: error: '*((void *)&zcd+8)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
memcpy(dst, src, sz);
^~~~~~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:14:26: note: '*((void *)&zcd+8)' was declared here

  struct rte_ring_zc_data zcd;
                          ^~~

In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring.h:67:2: error: 'zcd' may be used uninitialized in this function [-Werror=maybe-uninitialized]
memcpy(dst, src, sz);
^~~~~~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:14:26: note: 'zcd' was declared here

  struct rte_ring_zc_data zcd;
                          ^~~

cc1: all warnings being treated as errors
[2340/2407] Compiling C object drivers/libtmp_rte_event_octeontx2.a.p/event_octeontx2_otx2_worker_dual.c.o
ninja: build stopped: subcommand failed.

#5 lore raw

<snip>

Quoted 12 lines
Quoted 12 lines
Quoted 4 lines

Hi Honnappa,

Sorry about the delayed reply.

No problem, thank you.

Quoted 2 lines

The build error trace is below, the build command used was: CC=gcc meson

--

Quoted 3 lines

optimization=1 --werror build1; ninja -C build1 I am not sure how I could fix this issue without initialising zcd.

<snip>

Quoted 26 lines
Quoted 26 lines
Quoted 9 lines

In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring_stress_impl.h: In function 'test_worker':
../app/test/test_ring.h:82:3: error: 'zcd.n1' may be used uninitialized in this function [-Werror=maybe-uninitialized]
test_ring_mem_copy(zcd->ptr2, src, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      esize, num - zcd->n1);
      ~~~~~~~~~~~~~~~~~~~~~

../app/test/test_ring_mt_peek_stress_zc.c:32:26: note: 'zcd.n1' was

declared

Quoted 9 lines

here

  struct rte_ring_zc_data zcd;
                          ^~~

In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring.h:67:2: error: '*((void *)&zcd+8)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
memcpy(dst, src, sz);
^~~~~~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:32:26: note: '*((void

*)&zcd+8)'

Quoted 1 line

was declared here

I remember seeing a similar error in test_ring_st_peek_stress_zc.c. In the file test_ring_mt_peek_stress_zc.c, after the call to enqueue/dequeue API calls, we have:
"n = (m == n) ? n : 0;"

Quoted 7 lines
Quoted 3 lines

This is present as the code was copied from existing code. I do not see why this line is required. Can you please try to remove this line and see if it works?

I commented out all occurrences of that line in test_ring_mt_peek_stess_zc.c and the build is still failing.
Trace at end of email.

Thanks for checking the suggestion. Can you provide your setup details? OS and gcc version would be good. I would like to try it.

<snip>

Quoted 55 lines

[2339/2407] Compiling C object app/test/dpdk- test.p/test_ring_mt_peek_stress_zc.c.o
FAILED: app/test/dpdk-test.p/test_ring_mt_peek_stress_zc.c.o
gcc -Iapp/test/dpdk-test.p -Iapp/test -I../app/test -Ilib/librte_acl - I../lib/librte_acl -I. -I.. -Iconfig -I../config -Ilib/librte_eal/include - I../lib/librte_eal/include -Ilib/librte_eal/linux/include - I../lib/librte_eal/linux/include -Ilib/librte_eal/x86/include - I../lib/librte_eal/x86/include -Ilib/librte_eal/common - I../lib/librte_eal/common -Ilib/librte_eal -I../lib/librte_eal -Ilib/librte_kvargs - I../lib/librte_kvargs -Ilib/librte_metrics -I../lib/librte_metrics - Ilib/librte_telemetry -I../lib/librte_telemetry -Idrivers/bus/pci - I../drivers/bus/pci -I../drivers/bus/pci/linux -Ilib/librte_pci -I../lib/librte_pci - Idrivers/bus/vdev -I../drivers/bus/vdev -Ilib/librte_bitratestats - I../lib/librte_bitratestats -Ilib/librte_ethdev -I../lib/librte_ethdev - Ilib/librte_net -I../lib/librte_net -Ilib/librte_mbuf -I../lib/librte_mbuf - Ilib/librte_mempool -I../lib/librte_mempool -Ilib/librte_ring -I../lib/librte_ring -Ilib/librte_meter -I../lib/librte_meter -Ilib/librte_bpf -I../lib/librte_bpf - Ilib/librte_cfgfile -I../lib/librte_cfgfile -Ilib/librte_cmdline -I../lib/librte_cmdline -Ilib/librte_cryptodev -I../lib/librte_cryptodev -Ilib/librte_distributor - I../lib/librte_distributor -Ilib/librte_efd -I../lib/librte_efd -Ilib/librte_hash - I../lib/librte_hash -Ilib/librte_rcu -I../lib/librte_rcu -Ilib/librte_eventdev - I../lib/librte_eventdev -Ilib/librte_timer -I../lib/librte_timer -Ilib/librte_fib - I../lib/librte_fib -Ilib/librte_rib -I../lib/librte_rib -Ilib/librte_flow_classify - I../lib/librte_flow_classify -Ilib/librte_table -I../lib/librte_table -Ilib/librte_port -I../lib/librte_port -Ilib/librte_sched -I../lib/librte_sched -Ilib/librte_ip_frag - I../lib/librte_ip_frag -Ilib/librte_kni -I../lib/librte_kni -Ilib/librte_lpm - I../lib/librte_lpm -Ilib/librte_graph -I../lib/librte_graph -Ilib/librte_ipsec - I../lib/librte_ipsec -Ilib/librte_security -I../lib/librte_security - Ilib/librte_latencystats -I../lib/librte_latencystats -Ilib/librte_member - I../lib/librte_member -Ilib/librte_node -I../lib/librte_node -Ilib/librte_pipeline -I../lib/librte_pipeline -Ilib/librte_rawdev -I../lib/librte_rawdev - Ilib/librte_reorder -I../lib/librte_reorder -Ilib/librte_stack -I../lib/librte_stack - Idrivers/mempool/ring -I../drivers/mempool/ring -Idrivers/mempool/stack - I../drivers/mempool/stack -Idrivers/event/skeleton - I../drivers/event/skeleton -Idrivers/net/bonding -I../drivers/net/bonding - Idrivers/net/ring -I../drivers/net/ring -Ilib/librte_power -I../lib/librte_power - Ilib/librte_pdump -I../lib/librte_pdump -Idrivers/crypto/scheduler - I../drivers/crypto/scheduler -fdiagnostics-color=always -pipe - D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -O1 -include rte_config.h -Wextra -Wcast-qual -Wdeprecated -Wformat-nonliteral - Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wnested- externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict- prototypes -Wundef -Wwrite-strings -Wno-packed-not-aligned -Wno-missing- field-initializers -march=native -mno-avx512f -DALLOW_EXPERIMENTAL_API - Wno-format-truncation -D_GNU_SOURCE -fno-strict-aliasing - DALLOW_INTERNAL_API -MD -MQ app/test/dpdk- test.p/test_ring_mt_peek_stress_zc.c.o -MF app/test/dpdk- test.p/test_ring_mt_peek_stress_zc.c.o.d -o app/test/dpdk- test.p/test_ring_mt_peek_stress_zc.c.o -c ../app/test/test_ring_mt_peek_stress_zc.c ../app/test/test_ring_mt_peek_stress_zc.c: In function '_st_ring_dequeue_bulk':
../app/test/test_ring_mt_peek_stress_zc.c:13:11: error: variable 'm' set but not used [-Werror=unused-but-set-variable]

Quoted 8 lines
  uint32_t m;
           ^

../app/test/test_ring_mt_peek_stress_zc.c: In function '_st_ring_enqueue_bulk':
../app/test/test_ring_mt_peek_stress_zc.c:31:11: error: variable 'm' set but not used [-Werror=unused-but-set-variable]

  uint32_t m;
           ^

I am not sure why you are seeing the above error.

<snip>

#6 lore raw
Quoted 57 lines

From: Honnappa Nagarahalli <[email protected]>
Sent: Monday 9 November 2020 17:24
To: Walsh, Conor <[email protected]>; Ananyev, Konstantin <[email protected]>
Cc: [email protected]; Chen, LingliX <[email protected]>; nd <[email protected]>; Honnappa Nagarahalli <[email protected]>; nd <[email protected]>
Subject: RE: [PATCH v1] app/test: zcd needs to be initialised to fix gcc compile error

<snip>

Quoted 12 lines
Quoted 12 lines
Quoted 4 lines

Hi Honnappa,

Sorry about the delayed reply.

No problem, thank you.

Quoted 2 lines

The build error trace is below, the build command used was: CC=gcc meson

--

Quoted 3 lines

optimization=1 --werror build1; ninja -C build1 I am not sure how I could fix this issue without initialising zcd.

<snip>

Quoted 30 lines
Quoted 29 lines
Quoted 9 lines

In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring_stress_impl.h: In function 'test_worker':
../app/test/test_ring.h:82:3: error: 'zcd.n1' may be used uninitialized in this function [-Werror=maybe-uninitialized]
test_ring_mem_copy(zcd->ptr2, src, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      esize, num - zcd->n1);
      ~~~~~~~~~~~~~~~~~~~~~

../app/test/test_ring_mt_peek_stress_zc.c:32:26: note: 'zcd.n1' was

declared

Quoted 9 lines

here

  struct rte_ring_zc_data zcd;
                          ^~~

In file included from ../app/test/test_ring_mt_peek_stress_zc.c:5:
../app/test/test_ring.h:67:2: error: '*((void *)&zcd+8)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
memcpy(dst, src, sz);
^~~~~~~~~~~~~~~~~~~~
../app/test/test_ring_mt_peek_stress_zc.c:32:26: note: '*((void

*)&zcd+8)'

Quoted 1 line

was declared here

I remember seeing a similar error in test_ring_st_peek_stress_zc.c. In the file test_ring_mt_peek_stress_zc.c, after the call to enqueue/dequeue API calls, we have:
"n = (m == n) ? n : 0;"

This is present as the code was copied from existing code. I do not see why this line is required. Can you please try to remove this line and see if it works?

Quoted 6 lines
Quoted 1 line

I commented out all occurrences of that line in

test_ring_mt_peek_stess_zc.c

Quoted 2 lines

and the build is still failing.
Trace at end of email.

Thanks for checking the suggestion. Can you provide your setup details? OS and gcc version would be good. I would like to try it.

Sure no problem, the error doesn't seem to affect gcc versions > 8. My setup is CentOS8.2 with kernel 4.18.0-193.28.1.el8_2.x86_64 and gcc 8.3.1.

Quoted 77 lines

<snip>

Quoted 10 lines

[2339/2407] Compiling C object app/test/dpdk- test.p/test_ring_mt_peek_stress_zc.c.o
FAILED: app/test/dpdk-test.p/test_ring_mt_peek_stress_zc.c.o gcc -Iapp/test/dpdk-test.p -Iapp/test -I../app/test -Ilib/librte_acl - I../lib/librte_acl -I. -I.. -Iconfig -I../config -Ilib/librte_eal/include - I../lib/librte_eal/include -Ilib/librte_eal/linux/include - I../lib/librte_eal/linux/include -Ilib/librte_eal/x86/include - I../lib/librte_eal/x86/include -Ilib/librte_eal/common - I../lib/librte_eal/common -Ilib/librte_eal -I../lib/librte_eal -

Ilib/librte_kvargs -

Quoted 3 lines

I../lib/librte_kvargs -Ilib/librte_metrics -I../lib/librte_metrics - Ilib/librte_telemetry -I../lib/librte_telemetry -Idrivers/bus/pci - I../drivers/bus/pci -I../drivers/bus/pci/linux -Ilib/librte_pci -I../lib/librte_pci

-

Quoted 4 lines

Idrivers/bus/vdev -I../drivers/bus/vdev -Ilib/librte_bitratestats - I../lib/librte_bitratestats -Ilib/librte_ethdev -I../lib/librte_ethdev - Ilib/librte_net -I../lib/librte_net -Ilib/librte_mbuf -I../lib/librte_mbuf - Ilib/librte_mempool -I../lib/librte_mempool -Ilib/librte_ring -

I../lib/librte_ring

Quoted 2 lines

-Ilib/librte_meter -I../lib/librte_meter -Ilib/librte_bpf -I../lib/librte_bpf - Ilib/librte_cfgfile -I../lib/librte_cfgfile -Ilib/librte_cmdline -

I../lib/librte_cmdline

Quoted 6 lines

-Ilib/librte_cryptodev -I../lib/librte_cryptodev -Ilib/librte_distributor - I../lib/librte_distributor -Ilib/librte_efd -I../lib/librte_efd -Ilib/librte_hash - I../lib/librte_hash -Ilib/librte_rcu -I../lib/librte_rcu -Ilib/librte_eventdev - I../lib/librte_eventdev -Ilib/librte_timer -I../lib/librte_timer -Ilib/librte_fib - I../lib/librte_fib -Ilib/librte_rib -I../lib/librte_rib -Ilib/librte_flow_classify - I../lib/librte_flow_classify -Ilib/librte_table -I../lib/librte_table -

Ilib/librte_port

Quoted 1 line

-I../lib/librte_port -Ilib/librte_sched -I../lib/librte_sched -Ilib/librte_ip_frag

-

Quoted 5 lines

I../lib/librte_ip_frag -Ilib/librte_kni -I../lib/librte_kni -Ilib/librte_lpm - I../lib/librte_lpm -Ilib/librte_graph -I../lib/librte_graph -Ilib/librte_ipsec - I../lib/librte_ipsec -Ilib/librte_security -I../lib/librte_security - Ilib/librte_latencystats -I../lib/librte_latencystats -Ilib/librte_member - I../lib/librte_member -Ilib/librte_node -I../lib/librte_node -

Ilib/librte_pipeline

Quoted 2 lines

-I../lib/librte_pipeline -Ilib/librte_rawdev -I../lib/librte_rawdev - Ilib/librte_reorder -I../lib/librte_reorder -Ilib/librte_stack -

I../lib/librte_stack -

Quoted 1 line

Idrivers/mempool/ring -I../drivers/mempool/ring -Idrivers/mempool/stack

-

Quoted 3 lines

I../drivers/mempool/stack -Idrivers/event/skeleton - I../drivers/event/skeleton -Idrivers/net/bonding -I../drivers/net/bonding - Idrivers/net/ring -I../drivers/net/ring -Ilib/librte_power -

I../lib/librte_power -

Quoted 5 lines

Ilib/librte_pdump -I../lib/librte_pdump -Idrivers/crypto/scheduler - I../drivers/crypto/scheduler -fdiagnostics-color=always -pipe - D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -O1 -include rte_config.h -Wextra -Wcast-qual -Wdeprecated -Wformat-nonliteral - Wformat-security -Wmissing-declarations -Wmissing-prototypes -

Wnested-

Quoted 2 lines

externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict- prototypes -Wundef -Wwrite-strings -Wno-packed-not-aligned -Wno-

missing-

Quoted 1 line

field-initializers -march=native -mno-avx512f -

DALLOW_EXPERIMENTAL_API -

Quoted 9 lines

Wno-format-truncation -D_GNU_SOURCE -fno-strict-aliasing - DALLOW_INTERNAL_API -MD -MQ app/test/dpdk- test.p/test_ring_mt_peek_stress_zc.c.o -MF app/test/dpdk- test.p/test_ring_mt_peek_stress_zc.c.o.d -o app/test/dpdk- test.p/test_ring_mt_peek_stress_zc.c.o -c ../app/test/test_ring_mt_peek_stress_zc.c ../app/test/test_ring_mt_peek_stress_zc.c: In function '_st_ring_dequeue_bulk':
../app/test/test_ring_mt_peek_stress_zc.c:13:11: error: variable 'm' set

but

Quoted 6 lines

not used [-Werror=unused-but-set-variable]

  uint32_t m;
           ^

../app/test/test_ring_mt_peek_stress_zc.c: In function '_st_ring_enqueue_bulk':
../app/test/test_ring_mt_peek_stress_zc.c:31:11: error: variable 'm' set

Quoted 5 lines

but

Quoted 3 lines

not used [-Werror=unused-but-set-variable]

  uint32_t m;
           ^

I am not sure why you are seeing the above error.

m is being set but is only being used in the line that I commented out, if that line needs to be removed then m doesn't need to be set or declared. E.g. below.

test_ring_mt_peek_stress_zc.c:9
static inline uint32_t
_st_ring_dequeue_bulk(struct rte_ring *r, void **obj, uint32_t n,

        uint32_t *avail)
{
        uint32_t m;
        struct rte_ring_zc_data zcd;

        m = rte_ring_dequeue_zc_bulk_start(r, n, &zcd, avail);
        //n = (m == n) ? n : 0;
        if (n != 0) {
                /* Copy the data from the ring */
                test_ring_copy_from(&zcd, obj, -1, n);
                rte_ring_dequeue_zc_finish(r, n);
        }

        return n;
}

Thanks for looking into this.

Quoted 2 lines

<snip>

#7 lore raw

<snip>

Quoted 103 lines
Quoted 90 lines

Review

Quoted 12 lines

[2339/2407] Compiling C object app/test/dpdk- test.p/test_ring_mt_peek_stress_zc.c.o
FAILED: app/test/dpdk-test.p/test_ring_mt_peek_stress_zc.c.o gcc -Iapp/test/dpdk-test.p -Iapp/test -I../app/test -Ilib/librte_acl
- I../lib/librte_acl -I. -I.. -Iconfig -I../config

(quoted diff) +0 -5
-Ilib/librte_eal/include - I../lib/librte_eal/include
-Ilib/librte_eal/linux/include - I../lib/librte_eal/linux/include
-Ilib/librte_eal/x86/include - I../lib/librte_eal/x86/include
-Ilib/librte_eal/common - I../lib/librte_eal/common -Ilib/librte_eal
-I../lib/librte_eal -

Ilib/librte_kvargs -

Quoted 4 lines

I../lib/librte_kvargs -Ilib/librte_metrics -I../lib/librte_metrics - Ilib/librte_telemetry -I../lib/librte_telemetry -Idrivers/bus/pci - I../drivers/bus/pci -I../drivers/bus/pci/linux -Ilib/librte_pci -I../lib/librte_pci

-

Review

Quoted 5 lines

Idrivers/bus/vdev -I../drivers/bus/vdev -Ilib/librte_bitratestats - I../lib/librte_bitratestats -Ilib/librte_ethdev

(quoted diff) +0 -3
-I../lib/librte_ethdev - Ilib/librte_net -I../lib/librte_net
-Ilib/librte_mbuf -I../lib/librte_mbuf - Ilib/librte_mempool
-I../lib/librte_mempool -Ilib/librte_ring -

I../lib/librte_ring

Review

Quoted 3 lines
(quoted diff) +0 -3
-Ilib/librte_meter -I../lib/librte_meter -Ilib/librte_bpf
-I../lib/librte_bpf - Ilib/librte_cfgfile -I../lib/librte_cfgfile
-Ilib/librte_cmdline -

I../lib/librte_cmdline

Quoted 9 lines
(quoted diff) +0 -3
-Ilib/librte_cryptodev -I../lib/librte_cryptodev
-Ilib/librte_distributor - I../lib/librte_distributor
-Ilib/librte_efd -I../lib/librte_efd -Ilib/librte_hash -

I../lib/librte_hash -Ilib/librte_rcu -I../lib/librte_rcu

(quoted diff) +0 -3
-Ilib/librte_eventdev - I../lib/librte_eventdev -Ilib/librte_timer
-I../lib/librte_timer -Ilib/librte_fib - I../lib/librte_fib
-Ilib/librte_rib -I../lib/librte_rib -Ilib/librte_flow_classify -

I../lib/librte_flow_classify -Ilib/librte_table
-I../lib/librte_table -

Ilib/librte_port

Review

Quoted 2 lines
(quoted diff) +0 -2
-I../lib/librte_port -Ilib/librte_sched -I../lib/librte_sched
-Ilib/librte_ip_frag

-

Review

Quoted 7 lines

I../lib/librte_ip_frag -Ilib/librte_kni -I../lib/librte_kni

(quoted diff) +0 -3
-Ilib/librte_lpm - I../lib/librte_lpm -Ilib/librte_graph
-I../lib/librte_graph -Ilib/librte_ipsec - I../lib/librte_ipsec
-Ilib/librte_security -I../lib/librte_security -

Ilib/librte_latencystats -I../lib/librte_latencystats

(quoted diff) +0 -2
-Ilib/librte_member - I../lib/librte_member -Ilib/librte_node
-I../lib/librte_node -

Ilib/librte_pipeline

Quoted 2 lines

-I../lib/librte_pipeline -Ilib/librte_rawdev -I../lib/librte_rawdev
- Ilib/librte_reorder -I../lib/librte_reorder -Ilib/librte_stack -

I../lib/librte_stack -

Quoted 2 lines

Idrivers/mempool/ring -I../drivers/mempool/ring
-Idrivers/mempool/stack

-

Review

Quoted 4 lines

I../drivers/mempool/stack -Idrivers/event/skeleton - I../drivers/event/skeleton -Idrivers/net/bonding

(quoted diff) +0 -2
-I../drivers/net/bonding - Idrivers/net/ring -I../drivers/net/ring
-Ilib/librte_power -

I../lib/librte_power -

Quoted 5 lines

Ilib/librte_pdump -I../lib/librte_pdump -Idrivers/crypto/scheduler - I../drivers/crypto/scheduler -fdiagnostics-color=always -pipe - D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -O1 -include rte_config.h -Wextra -Wcast-qual -Wdeprecated -Wformat-nonliteral - Wformat-security -Wmissing-declarations -Wmissing-prototypes -

Wnested-

Review

Quoted 3 lines

externs -Wold-style-definition -Wpointer-arith -Wsign-compare

(quoted diff) +0 -2
-Wstrict- prototypes -Wundef -Wwrite-strings -Wno-packed-not-aligned
-Wno-

missing-

Quoted 1 line

field-initializers -march=native -mno-avx512f -

DALLOW_EXPERIMENTAL_API -

Quoted 10 lines

Wno-format-truncation -D_GNU_SOURCE -fno-strict-aliasing - DALLOW_INTERNAL_API -MD -MQ app/test/dpdk- test.p/test_ring_mt_peek_stress_zc.c.o -MF app/test/dpdk- test.p/test_ring_mt_peek_stress_zc.c.o.d -o app/test/dpdk- test.p/test_ring_mt_peek_stress_zc.c.o -c ../app/test/test_ring_mt_peek_stress_zc.c ../app/test/test_ring_mt_peek_stress_zc.c: In function '_st_ring_dequeue_bulk':
../app/test/test_ring_mt_peek_stress_zc.c:13:11: error: variable 'm' set

but

Quoted 7 lines

not used [-Werror=unused-but-set-variable]

  uint32_t m;
           ^

../app/test/test_ring_mt_peek_stress_zc.c: In function '_st_ring_enqueue_bulk':
../app/test/test_ring_mt_peek_stress_zc.c:31:11: error: variable 'm' set

Quoted 5 lines

but

Quoted 3 lines

not used [-Werror=unused-but-set-variable]

  uint32_t m;
           ^

I am not sure why you are seeing the above error.

m is being set but is only being used in the line that I commented out, if that line needs to be removed then m doesn't need to be set or declared. E.g. below.

test_ring_mt_peek_stress_zc.c:9
static inline uint32_t
_st_ring_dequeue_bulk(struct rte_ring *r, void **obj, uint32_t n,

Quoted 8 lines
        uint32_t *avail)
{
        uint32_t m;
        struct rte_ring_zc_data zcd;

        m = rte_ring_dequeue_zc_bulk_start(r, n, &zcd, avail);
        //n = (m == n) ? n : 0;
        if (n != 0) {

Sorry, the above 'if' statement should be as follows:
if (m != 0) {

Quoted 12 lines
                /* Copy the data from the ring */
                test_ring_copy_from(&zcd, obj, -1, n);
                rte_ring_dequeue_zc_finish(r, n);
        }

        return n;
}

Thanks for looking into this.

Quoted 2 lines

<snip>

#8 lore raw
Quoted 122 lines

From: Honnappa Nagarahalli <[email protected]>
Sent: Monday 9 November 2020 22:44
To: Walsh, Conor <[email protected]>; Ananyev, Konstantin <[email protected]>
Cc: [email protected]; Chen, LingliX <[email protected]>; nd <[email protected]>; Honnappa Nagarahalli <[email protected]>; nd <[email protected]>
Subject: RE: [PATCH v1] app/test: zcd needs to be initialised to fix gcc compile error

<snip>

Quoted 60 lines
Quoted 60 lines

Review

Quoted 12 lines

[2339/2407] Compiling C object app/test/dpdk- test.p/test_ring_mt_peek_stress_zc.c.o
FAILED: app/test/dpdk-test.p/test_ring_mt_peek_stress_zc.c.o gcc -Iapp/test/dpdk-test.p -Iapp/test -I../app/test -Ilib/librte_acl
- I../lib/librte_acl -I. -I.. -Iconfig -I../config

(quoted diff) +0 -5
-Ilib/librte_eal/include - I../lib/librte_eal/include
-Ilib/librte_eal/linux/include - I../lib/librte_eal/linux/include
-Ilib/librte_eal/x86/include - I../lib/librte_eal/x86/include
-Ilib/librte_eal/common - I../lib/librte_eal/common -Ilib/librte_eal
-I../lib/librte_eal -

Ilib/librte_kvargs -

Quoted 4 lines

I../lib/librte_kvargs -Ilib/librte_metrics -I../lib/librte_metrics - Ilib/librte_telemetry -I../lib/librte_telemetry -Idrivers/bus/pci - I../drivers/bus/pci -I../drivers/bus/pci/linux -Ilib/librte_pci -I../lib/librte_pci

-

Review

Quoted 5 lines

Idrivers/bus/vdev -I../drivers/bus/vdev -Ilib/librte_bitratestats - I../lib/librte_bitratestats -Ilib/librte_ethdev

(quoted diff) +0 -3
-I../lib/librte_ethdev - Ilib/librte_net -I../lib/librte_net
-Ilib/librte_mbuf -I../lib/librte_mbuf - Ilib/librte_mempool
-I../lib/librte_mempool -Ilib/librte_ring -

I../lib/librte_ring

Review

Quoted 3 lines
(quoted diff) +0 -3
-Ilib/librte_meter -I../lib/librte_meter -Ilib/librte_bpf
-I../lib/librte_bpf - Ilib/librte_cfgfile -I../lib/librte_cfgfile
-Ilib/librte_cmdline -

I../lib/librte_cmdline

Quoted 9 lines
(quoted diff) +0 -3
-Ilib/librte_cryptodev -I../lib/librte_cryptodev
-Ilib/librte_distributor - I../lib/librte_distributor
-Ilib/librte_efd -I../lib/librte_efd -Ilib/librte_hash -

I../lib/librte_hash -Ilib/librte_rcu -I../lib/librte_rcu

(quoted diff) +0 -3
-Ilib/librte_eventdev - I../lib/librte_eventdev -Ilib/librte_timer
-I../lib/librte_timer -Ilib/librte_fib - I../lib/librte_fib
-Ilib/librte_rib -I../lib/librte_rib -Ilib/librte_flow_classify -

I../lib/librte_flow_classify -Ilib/librte_table
-I../lib/librte_table -

Ilib/librte_port

Review

Quoted 2 lines
(quoted diff) +0 -2
-I../lib/librte_port -Ilib/librte_sched -I../lib/librte_sched
-Ilib/librte_ip_frag

-

Review

Quoted 7 lines

I../lib/librte_ip_frag -Ilib/librte_kni -I../lib/librte_kni

(quoted diff) +0 -3
-Ilib/librte_lpm - I../lib/librte_lpm -Ilib/librte_graph
-I../lib/librte_graph -Ilib/librte_ipsec - I../lib/librte_ipsec
-Ilib/librte_security -I../lib/librte_security -

Ilib/librte_latencystats -I../lib/librte_latencystats

(quoted diff) +0 -2
-Ilib/librte_member - I../lib/librte_member -Ilib/librte_node
-I../lib/librte_node -

Ilib/librte_pipeline

Quoted 2 lines

-I../lib/librte_pipeline -Ilib/librte_rawdev -I../lib/librte_rawdev
- Ilib/librte_reorder -I../lib/librte_reorder -Ilib/librte_stack -

I../lib/librte_stack -

Quoted 2 lines

Idrivers/mempool/ring -I../drivers/mempool/ring
-Idrivers/mempool/stack

-

Review

Quoted 4 lines

I../drivers/mempool/stack -Idrivers/event/skeleton - I../drivers/event/skeleton -Idrivers/net/bonding

(quoted diff) +0 -2
-I../drivers/net/bonding - Idrivers/net/ring -I../drivers/net/ring
-Ilib/librte_power -

I../lib/librte_power -

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

Ilib/librte_pdump -I../lib/librte_pdump -Idrivers/crypto/scheduler - I../drivers/crypto/scheduler -fdiagnostics-color=always -pipe - D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -O1 -include rte_config.h -Wextra -Wcast-qual -Wdeprecated -Wformat-nonliteral - Wformat-security -Wmissing-declarations -Wmissing-prototypes -

Wnested-

Quoted 2 lines

externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict- prototypes -Wundef -Wwrite-strings -Wno-packed-not-

aligned

Quoted 22 lines
Quoted 22 lines
Quoted 1 line

-Wno-

missing-

Quoted 1 line

field-initializers -march=native -mno-avx512f -

DALLOW_EXPERIMENTAL_API -

Quoted 10 lines

Wno-format-truncation -D_GNU_SOURCE -fno-strict-aliasing - DALLOW_INTERNAL_API -MD -MQ app/test/dpdk- test.p/test_ring_mt_peek_stress_zc.c.o -MF app/test/dpdk- test.p/test_ring_mt_peek_stress_zc.c.o.d -o app/test/dpdk- test.p/test_ring_mt_peek_stress_zc.c.o -c ../app/test/test_ring_mt_peek_stress_zc.c ../app/test/test_ring_mt_peek_stress_zc.c: In function '_st_ring_dequeue_bulk':
../app/test/test_ring_mt_peek_stress_zc.c:13:11: error: variable 'm' set

but

Quoted 7 lines

not used [-Werror=unused-but-set-variable]

  uint32_t m;
           ^

../app/test/test_ring_mt_peek_stress_zc.c: In function '_st_ring_enqueue_bulk':
../app/test/test_ring_mt_peek_stress_zc.c:31:11: error: variable 'm' set

Quoted 7 lines
Quoted 5 lines

but

Quoted 3 lines

not used [-Werror=unused-but-set-variable]

  uint32_t m;
           ^

I am not sure why you are seeing the above error.

m is being set but is only being used in the line that I commented out, if

that

Quoted 11 lines

line needs to be removed then m doesn't need to be set or declared. E.g. below.

test_ring_mt_peek_stress_zc.c:9
static inline uint32_t
_st_ring_dequeue_bulk(struct rte_ring *r, void **obj, uint32_t n,

        uint32_t *avail)
{
        uint32_t m;
        struct rte_ring_zc_data zcd;
Quoted 5 lines
Quoted 3 lines
        m = rte_ring_dequeue_zc_bulk_start(r, n, &zcd, avail);
        //n = (m == n) ? n : 0;
        if (n != 0) {

Sorry, the above 'if' statement should be as follows:
if (m != 0) {

Thanks Honnappa, those two changes fix the issue for me. I will send a V2 of the patch with these changes.

Thanks,
Conor.

Quoted 13 lines
Quoted 13 lines
                /* Copy the data from the ring */
                test_ring_copy_from(&zcd, obj, -1, n);
                rte_ring_dequeue_zc_finish(r, n);
        }

        return n;
}

Thanks for looking into this.

Quoted 2 lines

<snip>

#9 lore raw

PATCH v2 1/1 app/test: fix to prevent zcd gcc compile error

In reply to Conor Walsh

When DPDK is compiled with gcc < 9 with the optimization level set to 1 gcc sees zcd in test_ring.h as possibly being uninitialised. To correct this error if statements from _st_ring_dequeue_bulk and _st_ring_enqueue_bulk were corrected within test_ring_mt_peek_stress_zc.c

---

v2: Moved from initialising zcd to changing if statements within
test_ring_mt_peek_stress_zc.c following list feedback as the original method used may have masked errors within the library.

---
 app/test/test_ring_mt_peek_stress_zc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
app/test/test_ring_mt_peek_stress_zc.c +2 -4
index 7e0bd511a7..85f0262ba0 100644
@@ -14,8 +14,7 @@ _st_ring_dequeue_bulk(struct rte_ring *r, void **obj, uint32_t n,
 	struct rte_ring_zc_data zcd;
 
 	m = rte_ring_dequeue_zc_bulk_start(r, n, &zcd, avail);
-	n = (m == n) ? n : 0;
-	if (n != 0) {
+	if (m != 0) {
 		/* Copy the data from the ring */
 		test_ring_copy_from(&zcd, obj, -1, n);
 		rte_ring_dequeue_zc_finish(r, n);
@@ -32,8 +31,7 @@ _st_ring_enqueue_bulk(struct rte_ring *r, void * const *obj, uint32_t n,
 	struct rte_ring_zc_data zcd;
 
 	m = rte_ring_enqueue_zc_bulk_start(r, n, &zcd, free);
-	n = (m == n) ? n : 0;
-	if (n != 0) {
+	if (m != 0) {
 		/* Copy the data from the ring */
 		test_ring_copy_to(&zcd, obj, -1, n);
 		rte_ring_enqueue_zc_finish(r, n);
Signature · 1 line
2.25.1
#10 lore raw

Re: [dpdk-dev] [PATCH v2] app/test: fix to prevent zcd gcc compile error

<snip>

Quoted 7 lines

When DPDK is compiled with gcc < 9 with the optimization level set to 1 gcc sees zcd in test_ring.h as possibly being uninitialised. To correct this error if statements from _st_ring_dequeue_bulk and _st_ring_enqueue_bulk were corrected within test_ring_mt_peek_stress_zc.c

Thank you Conor, looks good.

Quoted 39 lines

---

v2: Moved from initialising zcd to changing if statements within
test_ring_mt_peek_stress_zc.c following list feedback as the original method used may have masked errors within the library.

---
 app/test/test_ring_mt_peek_stress_zc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
app/test/test_ring_mt_peek_stress_zc.c +1 -2
index 7e0bd511a7..85f0262ba0 100644
@@ -14,8 +14,7 @@ _st_ring_dequeue_bulk(struct rte_ring *r, void **obj,
 uint32_t n,
 	struct rte_ring_zc_data zcd;
 
 	m = rte_ring_dequeue_zc_bulk_start(r, n, &zcd, avail);
-	n = (m == n) ? n : 0;
-	if (n != 0) {
+	if (m != 0) {
 		/* Copy the data from the ring */
 		test_ring_copy_from(&zcd, obj, -1, n);
app/test/test_ring_mt_peek_stress_zc.c +1 -2
 		rte_ring_dequeue_zc_finish(r, n);
@@ -32,8 +31,7 @@ _st_ring_enqueue_bulk(struct rte_ring *r, void * const
 *obj, uint32_t n,
 	struct rte_ring_zc_data zcd;
 
 	m = rte_ring_enqueue_zc_bulk_start(r, n, &zcd, free);
-	n = (m == n) ? n : 0;
-	if (n != 0) {
+	if (m != 0) {
 		/* Copy the data from the ring */
 		test_ring_copy_to(&zcd, obj, -1, n);

rte_ring_enqueue_zc_finish(r, n);
--
2.25.1

Reviewed-by on v2 1/1
#11 lore raw

Re: [dpdk-dev] [PATCH v2] app/test: fix to prevent zcd gcc compile error

In reply to Conor Walsh
Quoted 11 lines

-----Original Message-----
From: Conor Walsh <[email protected]>
Sent: Tuesday, November 10, 2020 5:03 AM
To: Honnappa Nagarahalli <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Conor Walsh <[email protected]>
Subject: [PATCH v2] app/test: fix to prevent zcd gcc compile error

Quoted 6 lines

When DPDK is compiled with gcc < 9 with the optimization level set to 1 gcc sees zcd in test_ring.h as possibly being uninitialised. To correct this error if statements from _st_ring_dequeue_bulk and _st_ring_enqueue_bulk were corrected within test_ring_mt_peek_stress_zc.c

Quoted 39 lines

---

v2: Moved from initialising zcd to changing if statements within
test_ring_mt_peek_stress_zc.c following list feedback as the original method used may have masked errors within the library.

---
 app/test/test_ring_mt_peek_stress_zc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
app/test/test_ring_mt_peek_stress_zc.c +1 -2
index 7e0bd511a7..85f0262ba0 100644
@@ -14,8 +14,7 @@ _st_ring_dequeue_bulk(struct rte_ring *r, void **obj,
 uint32_t n,
 	struct rte_ring_zc_data zcd;
 
 	m = rte_ring_dequeue_zc_bulk_start(r, n, &zcd, avail);
-	n = (m == n) ? n : 0;
-	if (n != 0) {
+	if (m != 0) {
 		/* Copy the data from the ring */
 		test_ring_copy_from(&zcd, obj, -1, n);
app/test/test_ring_mt_peek_stress_zc.c +1 -2
 		rte_ring_dequeue_zc_finish(r, n);
@@ -32,8 +31,7 @@ _st_ring_enqueue_bulk(struct rte_ring *r, void * const
 *obj, uint32_t n,
 	struct rte_ring_zc_data zcd;
 
 	m = rte_ring_enqueue_zc_bulk_start(r, n, &zcd, free);
-	n = (m == n) ? n : 0;
-	if (n != 0) {
+	if (m != 0) {
 		/* Copy the data from the ring */
 		test_ring_copy_to(&zcd, obj, -1, n);

rte_ring_enqueue_zc_finish(r, n);
--
2.25.1

#12 lore raw

Re: [dpdk-dev] [PATCH v2] app/test: fix to prevent zcd gcc compile error

Quoted 9 lines · Honnappa Nagarahalli
Quoted 9 lines

-----Original Message-----
From: Conor Walsh <[email protected]>
Sent: Tuesday, November 10, 2020 5:03 AM
To: Honnappa Nagarahalli <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Conor Walsh <[email protected]>
Subject: [PATCH v2] app/test: fix to prevent zcd gcc compile error

Quoted 4 lines
Quoted 4 lines

When DPDK is compiled with gcc < 9 with the optimization level set to 1 gcc sees zcd in test_ring.h as possibly being uninitialised. To correct this error if statements from _st_ring_dequeue_bulk and _st_ring_enqueue_bulk were corrected within test_ring_mt_peek_stress_zc.c

Fixes f72299fd157d ("test/ring: add stress tests for zero copy API")
Quoted 3 lines
Quoted 2 lines

Updated title, and applied, thanks.

Signature · 1 line
David Marchand