Skip to contentSkip to conversation

event/sw: fix missing flow ID init in selftest

PATCH In review Olivier Matz 4 participants 5 messages Oct 14, 2022 – Oct 19, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 event/sw: fix missing flow ID init in selftest

The issue is seen by unit tests:

Quoted 10 lines
root@dpdk-VF-dut247:~/dpdk# MALLOC_PERTURB_=204 \
  DPDK_TEST=eventdev_selftest_sw \
  /root/dpdk/x86_64-native-linuxapp-gcc/app/test/dpdk-test -c 0xff
(...)
*** Running XStats ID Reset test...
12: 1761: qid_0_port_2_pinned_flows value , expected 1 got 7
1778: qid_0_port_2_pinned_flows value incorrect, expected 1 got 7
ERROR - XStats ID Reset test FAILED.
SW Eventdev Selftest Failed.
Test Failed

The flow id is not set in the event, which results in an undefined flow, whose value depends on what was previously in stack. Having different flows for the packets makes the test to fail, since only one flow is expected.

This only happens in -O3, where the same stack area is shared by the event object and the address of the mbuf allocated in rte_gen_arp().

Fix this by properly initializing the flow id.

Bugzilla ID: 1101

Fixes e21df4b062b5 ("test/eventdev: add SW xstats tests")
---
 drivers/event/sw/sw_evdev_selftest.c | 1 +
 1 file changed, 1 insertion(+)
drivers/event/sw/sw_evdev_selftest.c +1 -0
index ed7ae6a685..4f18d66f36 100644
@@ -1489,6 +1489,7 @@ xstats_id_reset_tests(struct test *t)
 			goto fail;
 		}
 		ev.queue_id = t->qid[i];
+		ev.flow_id = 0;
 		ev.op = RTE_EVENT_OP_NEW;
 		ev.mbuf = arp;
 		*rte_event_pmd_selftest_seqn(arp) = i;
Signature · 1 line
2.30.2
#1 lore raw

PATCH 2/2 event/sw: fix invalid log in selftest

The log should display the value, not the id.

Fixes e21df4b062b5 ("test/eventdev: add SW xstats tests")
---
 drivers/event/sw/sw_evdev_selftest.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/event/sw/sw_evdev_selftest.c +2 -2
index 4f18d66f36..834681dbec 100644
@@ -1644,8 +1644,8 @@ xstats_id_reset_tests(struct test *t)
 		}
 		if (val != port_expected[i]) {
 			printf("%d: %s value incorrect, expected %"PRIu64
-				" got %d\n", __LINE__, port_names[i],
-				port_expected[i], id);
+				" got %"PRIu64"\n", __LINE__, port_names[i],
+				port_expected[i], val);
 			failed = 1;
 		}
 		/* reset to zero */
Signature · 1 line
2.30.2
#2 lore raw

Re: [PATCH 2/2] event/sw: fix invalid log in selftest

Quoted 16 lines · Olivier Matz

The log should display the value, not the id.

Fixes e21df4b062b5 ("test/eventdev: add SW xstats tests")
---
 drivers/event/sw/sw_evdev_selftest.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/event/sw/sw_evdev_selftest.c +0 -0
index 4f18d66f36..834681dbec 100644

drivers/event/sw/sw_evdev_selftest.c xstats_id_reset_tests(struct test *t) · line 1647

Quoted 6 lines
drivers/event/sw/sw_evdev_selftest.c +1 -2
@@ -1644,8 +1644,8 @@ xstats_id_reset_tests(struct test *t)
                }
                if (val != port_expected[i]) {
                        printf("%d: %s value incorrect, expected %"PRIu64
-                               " got %d\n", __LINE__, port_names[i],
-                               port_expected[i], id);
+                               " got %"PRIu64"\n", __LINE__, port_names[i],

There was merge conflict due to "eventdev: increase xstats ID width to 64 bits". I have fixed and Series applied to dpdk-next-net-eventdev/for-main. Thanks

Quoted 7 lines
drivers/event/sw/sw_evdev_selftest.c +1 -1
+                               port_expected[i], val);
                        failed = 1;
                }
                /* reset to zero */
--

2.30.2

#3 lore raw
In reply to Olivier Matz
Quoted 24 lines

From: Olivier Matz [mailto:[email protected]]
Sent: Friday, 14 October 2022 22.37

The issue is seen by unit tests:

Quoted 10 lines
root@dpdk-VF-dut247:~/dpdk# MALLOC_PERTURB_=204 \
  DPDK_TEST=eventdev_selftest_sw \
  /root/dpdk/x86_64-native-linuxapp-gcc/app/test/dpdk-test -c 0xff
(...)
*** Running XStats ID Reset test...
12: 1761: qid_0_port_2_pinned_flows value , expected 1 got 7
1778: qid_0_port_2_pinned_flows value incorrect, expected 1 got 7
ERROR - XStats ID Reset test FAILED.
SW Eventdev Selftest Failed.
Test Failed

The flow id is not set in the event, which results in an undefined flow, whose value depends on what was previously in stack. Having different flows for the packets makes the test to fail, since only one flow is expected.

This only happens in -O3, where the same stack area is shared by the event object and the address of the mbuf allocated in rte_gen_arp().

Quoted 8 lines

Fix this by properly initializing the flow id.

Bugzilla ID: 1101

Fixes e21df4b062b5 ("test/eventdev: add SW xstats tests")

---

Reviewed-by on v1 1/2
#4 lore raw
In reply to Olivier Matz
Quoted 14 lines · Olivier Matz

The issue is seen by unit tests:

Quoted 10 lines
root@dpdk-VF-dut247:~/dpdk# MALLOC_PERTURB_=204 \
  DPDK_TEST=eventdev_selftest_sw \
  /root/dpdk/x86_64-native-linuxapp-gcc/app/test/dpdk-test -c 0xff
(...)
*** Running XStats ID Reset test...
12: 1761: qid_0_port_2_pinned_flows value , expected 1 got 7
1778: qid_0_port_2_pinned_flows value incorrect, expected 1 got 7
ERROR - XStats ID Reset test FAILED.
SW Eventdev Selftest Failed.
Test Failed
Quoted 7 lines

The flow id is not set in the event, which results in an undefined flow, whose value depends on what was previously in stack. Having different flows for the packets makes the test to fail, since only one flow is expected.

This only happens in -O3, where the same stack area is shared by the event object and the address of the mbuf allocated in rte_gen_arp().

Good catch.
That's scary...

Quoted 8 lines

Fix this by properly initializing the flow id.

Bugzilla ID: 1101

Fixes e21df4b062b5 ("test/eventdev: add SW xstats tests")
Signature · 1 line
David Marchand