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

Message ID 20221014203710.6172-1-olivier.matz@6wind.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [1/2] event/sw: fix missing flow ID init in selftest |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Olivier Matz Oct. 14, 2022, 8:37 p.m. UTC
  The issue is seen by unit tests:

> 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")
Cc: stable@dpdk.org

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 drivers/event/sw/sw_evdev_selftest.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Morten Brørup Oct. 15, 2022, 8:25 a.m. UTC | #1
> From: Olivier Matz [mailto:olivier.matz@6wind.com]
> Sent: Friday, 14 October 2022 22.37
> 
> The issue is seen by unit tests:
> 
> > 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")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> ---

Series-Acked-by: Morten Brørup <mb@smartsharesystems.com>
  
David Marchand Oct. 17, 2022, 7:30 a.m. UTC | #2
On Fri, Oct 14, 2022 at 10:38 PM Olivier Matz <olivier.matz@6wind.com> wrote:
>
> The issue is seen by unit tests:
>
> > 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().

Good catch.
That's scary...


>
> Fix this by properly initializing the flow id.
>
> Bugzilla ID: 1101
> Fixes: e21df4b062b5 ("test/eventdev: add SW xstats tests")
> Cc: stable@dpdk.org
>
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>

Reviewed-by: David Marchand <david.marchand@redhat.com>
  

Patch

diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c
index ed7ae6a685..4f18d66f36 100644
--- a/drivers/event/sw/sw_evdev_selftest.c
+++ b/drivers/event/sw/sw_evdev_selftest.c
@@ -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;