[TEST] dpdk/app/test/test_mbuf.c test_refcnt_mbuf instability + fix proposal

Message ID MR1P264MB172997D1815F2F49AA6AB6A7D00CA@MR1P264MB1729.FRAP264.PROD.OUTLOOK.COM (mailing list archive)
State Changes Requested, archived
Delegated to: David Marchand
Headers
Series [TEST] dpdk/app/test/test_mbuf.c test_refcnt_mbuf instability + fix proposal |

Checks

Context Check Description
ci/Intel-compilation warning apply issues
ci/iol-testing warning apply patch failure
ci/loongarch-compilation warning apply patch failure

Commit Message

Julien Hascoet Aug. 7, 2023, 6:18 a.m. UTC
  Hello,

from my understanding after debugging, in test_refcnt_iter the return value of rte_ring_enqueue is not checked; leading to lack of expected mbufs at the end checks.

Here is some fix proposal that seems to work after running endurance tests for several days:


Can you confirm ?

Thank,

Julien Hascoet
  

Comments

David Marchand Aug. 7, 2023, 7:26 a.m. UTC | #1
Hello Julien,

On Mon, Aug 7, 2023 at 8:19 AM Julien Hascoet <jhascoet@kalrayinc.com> wrote:
> from my understanding after debugging, in test_refcnt_iter the return value of rte_ring_enqueue is not checked; leading to lack of expected mbufs at the end checks.
>
> Here is some fix proposal that seems to work after running endurance tests for several days:
>
> diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
> index b4f436b5e2..8a5d26e4f6 100644
> --- a/app/test/test_mbuf.c
> +++ b/app/test/test_mbuf.c
> @@ -1033,12 +1033,17 @@ test_refcnt_iter(unsigned int lcore, unsigned int iter,
>                 tref += ref;
>                 if ((ref & 1) != 0) {
>                         rte_pktmbuf_refcnt_update(m, ref);
> -                       while (ref-- != 0)
> -                               rte_ring_enqueue(refcnt_mbuf_ring, m);
> +                       while (ref-- != 0) {
> +                               /* retry in case of failure */
> +                               while (rte_ring_enqueue(refcnt_mbuf_ring, m) != 0)
> +                                       ;
> +                       }
>                 } else {
>                         while (ref-- != 0) {
>                                 rte_pktmbuf_refcnt_update(m, 1);
> -                               rte_ring_enqueue(refcnt_mbuf_ring, m);
> +                               /* retry in case of failure */
> +                               while (rte_ring_enqueue(refcnt_mbuf_ring, m) != 0)
> +                                       ;
>                         }
>                 }
>                 rte_pktmbuf_free(m);
>
> Can you confirm ?

This analysis looks correct (though failing to enqueue in this unit
test seems strange to me).
Could you send a fix with a Fixes: line in the commitlog, and copying
the maintainer?

Thanks.
  
Julien Hascoet Aug. 7, 2023, 8:02 a.m. UTC | #2
Here is a patch, I let you amend it if needed as I'm a beginner in the dpdk project

Thanks
  
David Marchand Aug. 8, 2023, 7:03 a.m. UTC | #3
Hello Julien,

On Mon, Aug 7, 2023 at 10:02 AM Julien Hascoet <jhascoet@kalrayinc.com> wrote:
>
> Here is a patch, I let you amend it if needed as I'm a beginner in the dpdk project

There are a few issues with the way you sent it.

This patch was sent as an attachment while the patch content should be
sent inline.
It is also missing a Signed-off-by (see Developer's Certificate of Origin).

The better is for you to read the contributing guide
https://doc.dpdk.org/guides/contributing/patches.html with a focus on
8.5, 8.8 and 8.12 sections.

Thanks.
  

Patch

diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
index b4f436b5e2..8a5d26e4f6 100644
--- a/app/test/test_mbuf.c
+++ b/app/test/test_mbuf.c
@@ -1033,12 +1033,17 @@  test_refcnt_iter(unsigned int lcore, unsigned int iter,
                tref += ref;
                if ((ref & 1) != 0) {
                        rte_pktmbuf_refcnt_update(m, ref);
-                       while (ref-- != 0)
-                               rte_ring_enqueue(refcnt_mbuf_ring, m);
+                       while (ref-- != 0) {
+                               /* retry in case of failure */
+                               while (rte_ring_enqueue(refcnt_mbuf_ring, m) != 0)
+                                       ;
+                       }
                } else {
                        while (ref-- != 0) {
                                rte_pktmbuf_refcnt_update(m, 1);
-                               rte_ring_enqueue(refcnt_mbuf_ring, m);
+                               /* retry in case of failure */
+                               while (rte_ring_enqueue(refcnt_mbuf_ring, m) != 0)
+                                       ;
                        }
                }
                rte_pktmbuf_free(m);