Skip to contentSkip to conversation

app: fix mbuf_autotest in case of defined RTE_LIBRTE_MBUF_DEBUG

PATCH In review Pavel Ivashchenko 3 participants 6 messages Mar 13, 2023 – Mar 17, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app: fix mbuf_autotest in case of defined RTE_LIBRTE_MBUF_DEBUG

How to reproduce:

1. Define RTE_LIBRTE_MBUF_DEBUG
2. MALLOC_PERTURB_=178 DPDK_TEST=mbuf_autotest gdb --args obj-x86_64-linux-gnu/app/test/dpdk-test --file-prefix=mbuf_autotest

PANIC in rte_mbuf_sanity_check():
bad pkt_len

...

   #6  0x00007ffff7d3d4cc in rte_mbuf_sanity_check (m=m@entry=0x17f8c3400, is_header=is_header@entry=1) at ../lib/mbuf/rte_mbuf.c:384
   #7  0x0000555555653d57 in rte_pktmbuf_free (m=0x17f8c3400) at ../lib/mbuf/rte_mbuf.h:1385
   #8  0x000055555565c7a6 in test_nb_segs_and_next_reset () at ../app/test/test_mbuf.c:2752
   #9  test_mbuf () at ../app/test/test_mbuf.c:2967

...

   (gdb) frame 6
   #6  0x00007ffff7d3d4cc in rte_mbuf_sanity_check (m=m@entry=0x17f8c3400, is_header=is_header@entry=1) at ../lib/mbuf/rte_mbuf.c:384
   384			rte_panic("%s\n", reason);
   (gdb) p/d m->pkt_len
   $4 = 1500
Fixes efc6f9104c80 ("mbuf: fix reset on mbuf free")
---
 app/test/test_mbuf.c | 1 +
 1 file changed, 1 insertion(+)
app/test/test_mbuf.c +1 -0
index 6cbb03b0af..d471a23805 100644
@@ -2744,6 +2744,7 @@ test_nb_segs_and_next_reset(void)
 
 	/* split m0 chain in two, between m1 and m2 */
 	m0->nb_segs = 2;
+	m0->pkt_len -= 500;
 	m1->next = NULL;
 	m2->nb_segs = 1;
 
Signature · 1 line
2.39.0
#1 lore raw

Hello,

Quoted 22 lines · Pavel Ivashchenko

How to reproduce:

1. Define RTE_LIBRTE_MBUF_DEBUG
2. MALLOC_PERTURB_=178 DPDK_TEST=mbuf_autotest gdb --args obj-x86_64-linux-gnu/app/test/dpdk-test --file-prefix=mbuf_autotest

   PANIC in rte_mbuf_sanity_check():
   bad pkt_len

   ...
   #6  0x00007ffff7d3d4cc in rte_mbuf_sanity_check (m=m@entry=0x17f8c3400, is_header=is_header@entry=1) at ../lib/mbuf/rte_mbuf.c:384
   #7  0x0000555555653d57 in rte_pktmbuf_free (m=0x17f8c3400) at ../lib/mbuf/rte_mbuf.h:1385
   #8  0x000055555565c7a6 in test_nb_segs_and_next_reset () at ../app/test/test_mbuf.c:2752
   #9  test_mbuf () at ../app/test/test_mbuf.c:2967
   ...

   (gdb) frame 6
   #6  0x00007ffff7d3d4cc in rte_mbuf_sanity_check (m=m@entry=0x17f8c3400, is_header=is_header@entry=1) at ../lib/mbuf/rte_mbuf.c:384
   384                  rte_panic("%s\n", reason);
   (gdb) p/d m->pkt_len
   $4 = 1500
Quoted 4 lines
Fixes efc6f9104c80 ("mbuf: fix reset on mbuf free")

LGTM, thanks.
Just a small comment.

app/test/test_mbuf.c test_nb_segs_and_next_reset(void) · line 2747

Quoted 13 lines
---
 app/test/test_mbuf.c | 1 +
 1 file changed, 1 insertion(+)
app/test/test_mbuf.c +1 -0
index 6cbb03b0af..d471a23805 100644
@@ -2744,6 +2744,7 @@ test_nb_segs_and_next_reset(void)
 
        /* split m0 chain in two, between m1 and m2 */
        m0->nb_segs = 2;
+       m0->pkt_len -= 500;

m0->pkt_len -= m2->data_len seems more readable and robust to me.

Opinions?

Quoted 3 lines
app/test/test_mbuf.c +0 -0
        m1->next = NULL;
        m2->nb_segs = 1;
 
Signature · 1 line
David Marchand
#2 lore raw

Hello,

Quoted 6 lines · David Marchand

Hello,

On Mon, Mar 13, 2023 at 5:57 PM Pavel Ivashchenko
<[email protected]> wrote:

app: fix mbuf_autotest in case of defined RTE_LIBRTE_MBUF_DEBUG

I suggest this title instead:

test/mbuf: fix mbuf autotest when mbuf debug is enabled

Quoted 41 lines
Quoted 22 lines

How to reproduce:

1. Define RTE_LIBRTE_MBUF_DEBUG
2. MALLOC_PERTURB_=178 DPDK_TEST=mbuf_autotest gdb --args obj-x86_64-linux-gnu/app/test/dpdk-test --file-prefix=mbuf_autotest

   PANIC in rte_mbuf_sanity_check():
   bad pkt_len

   ...
   #6  0x00007ffff7d3d4cc in rte_mbuf_sanity_check (m=m@entry=0x17f8c3400, is_header=is_header@entry=1) at ../lib/mbuf/rte_mbuf.c:384
   #7  0x0000555555653d57 in rte_pktmbuf_free (m=0x17f8c3400) at ../lib/mbuf/rte_mbuf.h:1385
   #8  0x000055555565c7a6 in test_nb_segs_and_next_reset () at ../app/test/test_mbuf.c:2752
   #9  test_mbuf () at ../app/test/test_mbuf.c:2967
   ...

   (gdb) frame 6
   #6  0x00007ffff7d3d4cc in rte_mbuf_sanity_check (m=m@entry=0x17f8c3400, is_header=is_header@entry=1) at ../lib/mbuf/rte_mbuf.c:384
   384                  rte_panic("%s\n", reason);
   (gdb) p/d m->pkt_len
   $4 = 1500
Quoted 4 lines
Fixes efc6f9104c80 ("mbuf: fix reset on mbuf free")

LGTM, thanks.
Just a small comment.

Quoted 10 lines
---
 app/test/test_mbuf.c | 1 +
 1 file changed, 1 insertion(+)
app/test/test_mbuf.c +0 -0
index 6cbb03b0af..d471a23805 100644
@@ -2744,6 +2744,7 @@ test_nb_segs_and_next_reset(void)
 
Quoted 7 lines

app/test/test_mbuf.c test_nb_segs_and_next_reset(void) · line 2747

Quoted 3 lines
app/test/test_mbuf.c +1 -0
        /* split m0 chain in two, between m1 and m2 */
        m0->nb_segs = 2;
+       m0->pkt_len -= 500;

m0->pkt_len -= m2->data_len seems more readable and robust to me.

Opinions?

Even if the 500 is hardcoded right above, this looks indeed better.

Or this seems fine too:
m0->pkt_len = m0->data_len + m1->data_len;

Thanks,
Olivier

Quoted 10 lines
Quoted 5 lines
app/test/test_mbuf.c +0 -0
        m1->next = NULL;
        m2->nb_segs = 1;
 
Signature · 1 line
David Marchand
#3 lore raw

PATCH v2 1/1 test/mbuf: fix mbuf autotest when mbuf debug is enabled

In reply to Pavel Ivashchenko

How to reproduce:

1. Define RTE_LIBRTE_MBUF_DEBUG
2. MALLOC_PERTURB_=178 DPDK_TEST=mbuf_autotest gdb --args obj-x86_64-linux-gnu/app/test/dpdk-test --file-prefix=mbuf_autotest

PANIC in rte_mbuf_sanity_check():
bad pkt_len

...

   #6  0x00007ffff7d3d4cc in rte_mbuf_sanity_check (m=m@entry=0x17f8c3400, is_header=is_header@entry=1) at ../lib/mbuf/rte_mbuf.c:384
   #7  0x0000555555653d57 in rte_pktmbuf_free (m=0x17f8c3400) at ../lib/mbuf/rte_mbuf.h:1385
   #8  0x000055555565c7a6 in test_nb_segs_and_next_reset () at ../app/test/test_mbuf.c:2752
   #9  test_mbuf () at ../app/test/test_mbuf.c:2967

...

   (gdb) frame 6
   #6  0x00007ffff7d3d4cc in rte_mbuf_sanity_check (m=m@entry=0x17f8c3400, is_header=is_header@entry=1) at ../lib/mbuf/rte_mbuf.c:384
   384			rte_panic("%s\n", reason);
   (gdb) p/d m->pkt_len
   $4 = 1500
Fixes efc6f9104c80 ("mbuf: fix reset on mbuf free")

---
v2:
* Fixed commit title
* Changed m0->pkt_len -= 500 to m0->pkt_len -= m2->data_len

 app/test/test_mbuf.c | 1 +
 1 file changed, 1 insertion(+)
app/test/test_mbuf.c +1 -0
index 6cbb03b0af..1f4dd62466 100644
@@ -2744,6 +2744,7 @@ test_nb_segs_and_next_reset(void)
 
 	/* split m0 chain in two, between m1 and m2 */
 	m0->nb_segs = 2;
+	m0->pkt_len -= m2->data_len;
 	m1->next = NULL;
 	m2->nb_segs = 1;
 
Signature · 1 line
2.39.0
Acked-by on v2 1/1
#4 lore raw

Re: [PATCH v2 1/1] test/mbuf: fix mbuf autotest when mbuf debug is enabled

Quoted 21 lines · Pavel Ivashchenko

How to reproduce:

1. Define RTE_LIBRTE_MBUF_DEBUG
2. MALLOC_PERTURB_=178 DPDK_TEST=mbuf_autotest gdb --args obj-x86_64-linux-gnu/app/test/dpdk-test --file-prefix=mbuf_autotest

   PANIC in rte_mbuf_sanity_check():
   bad pkt_len

   ...
   #6  0x00007ffff7d3d4cc in rte_mbuf_sanity_check (m=m@entry=0x17f8c3400, is_header=is_header@entry=1) at ../lib/mbuf/rte_mbuf.c:384
   #7  0x0000555555653d57 in rte_pktmbuf_free (m=0x17f8c3400) at ../lib/mbuf/rte_mbuf.h:1385
   #8  0x000055555565c7a6 in test_nb_segs_and_next_reset () at ../app/test/test_mbuf.c:2752
   #9  test_mbuf () at ../app/test/test_mbuf.c:2967
   ...

   (gdb) frame 6
   #6  0x00007ffff7d3d4cc in rte_mbuf_sanity_check (m=m@entry=0x17f8c3400, is_header=is_header@entry=1) at ../lib/mbuf/rte_mbuf.c:384
   384			rte_panic("%s\n", reason);
   (gdb) p/d m->pkt_len
   $4 = 1500
Quoted 4 lines
Fixes efc6f9104c80 ("mbuf: fix reset on mbuf free")
#5 lore raw

Re: [PATCH v2 1/1] test/mbuf: fix mbuf autotest when mbuf debug is enabled

Quoted 22 lines · Olivier Matz
Quoted 21 lines · Pavel Ivashchenko

How to reproduce:

1. Define RTE_LIBRTE_MBUF_DEBUG
2. MALLOC_PERTURB_=178 DPDK_TEST=mbuf_autotest gdb --args obj-x86_64-linux-gnu/app/test/dpdk-test --file-prefix=mbuf_autotest

   PANIC in rte_mbuf_sanity_check():
   bad pkt_len

   ...
   #6  0x00007ffff7d3d4cc in rte_mbuf_sanity_check (m=m@entry=0x17f8c3400, is_header=is_header@entry=1) at ../lib/mbuf/rte_mbuf.c:384
   #7  0x0000555555653d57 in rte_pktmbuf_free (m=0x17f8c3400) at ../lib/mbuf/rte_mbuf.h:1385
   #8  0x000055555565c7a6 in test_nb_segs_and_next_reset () at ../app/test/test_mbuf.c:2752
   #9  test_mbuf () at ../app/test/test_mbuf.c:2967
   ...

   (gdb) frame 6
   #6  0x00007ffff7d3d4cc in rte_mbuf_sanity_check (m=m@entry=0x17f8c3400, is_header=is_header@entry=1) at ../lib/mbuf/rte_mbuf.c:384
   384                        rte_panic("%s\n", reason);
   (gdb) p/d m->pkt_len
   $4 = 1500
Quoted 5 lines
Quoted 4 lines
Fixes efc6f9104c80 ("mbuf: fix reset on mbuf free")

Applied, thanks.

Signature · 1 line
David Marchand