From: Olivier Matz <olivier.matz@6wind.com>
To: jhascoet <ju.hascoet@gmail.com>
Cc: dev@dpdk.org, David Marchand <david.marchand@redhat.com>
Subject: Re: [PATCH] app: fix silent enqueue fail in test_mbuf test_refcnt_iter
Date: Tue, 22 Aug 2023 10:34:24 +0200 [thread overview]
Message-ID: <ZORzEDFxEgYsF3R5@platinum> (raw)
In-Reply-To: <20230822063453.97904-1-jhascoet@kalray.eu>
Hello Julien,
On Tue, Aug 22, 2023 at 08:34:53AM +0200, jhascoet wrote:
> From: Julien Hascoet <ju.hascoet@gmail.com>
>
> In case of ring full state, we retry the enqueue
> operation in order to avoid mbuf loss.
>
> Fixes: af75078fece ("first public release")
>
> Signed-off-by: Julien Hascoet <ju.hascoet@gmail.com>
> ---
> app/test/test_mbuf.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
> index efac01806b..ad18bf6378 100644
> --- a/app/test/test_mbuf.c
> +++ b/app/test/test_mbuf.c
> @@ -1033,12 +1033,21 @@ 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) {
> + /* let others consume */
> + rte_pause();
> + }
> + }
> } 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) {
> + /* let others consume */
> + rte_pause();
> + }
> }
> }
> rte_pktmbuf_free(m);
> --
> 2.34.1
>
Can you give some more details about how to reproduce the issue?
From what I see, the code does the following:
main core:
create a ring with at least (REFCNT_MBUF_NUM * REFCNT_MAX_REF) entries
create an mbuf pool with REFCNT_MBUF_NUM entries
start worker cores
do REFCNT_MAX_ITER times:
for each mbuf of the pool (REFCNT_MBUF_NUM entries):
let r be a random number between 1 and REFCNT_MAX_REF
increase mbuf references by r, and enqueue r times in the ring
wait that the ring is empty (since worker cores are dequeuing mbufs)
stop worker cores
worker cores:
dequeue packets from the ring and free them until asked to stop
I may be mistaking but I don't see how the number of mbufs in ring could
exceed REFCNT_MBUF_NUM * REFCNT_MAX_REF.
Regards,
Olivier
Note: removing CC maintainers@dpdk.org
next prev parent reply other threads:[~2023-08-22 8:34 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-09 5:38 [PATCH] app: fix silent enqueue fail in test_mbuf test_refcnt_iter jhascoet
2023-08-09 9:18 ` David Marchand
2023-08-10 6:00 ` jhascoet
2023-08-10 15:33 ` Stephen Hemminger
2023-08-10 15:40 ` [PUB] " Julien Hascoet
2023-08-10 16:09 ` jhascoet
2023-08-18 5:16 ` Hascoet Julien
2023-08-18 6:25 ` David Marchand
2023-08-22 6:34 ` jhascoet
2023-08-22 8:34 ` Olivier Matz [this message]
2023-08-24 6:51 ` Hascoet Julien
2023-08-30 16:16 ` Thomas Monjalon
2023-08-24 7:37 ` [PATCH] app: enhance error check if " jhascoet
2024-10-04 21:18 ` Stephen Hemminger
-- strict thread matches above, loose matches on Subject: below --
2023-08-09 14:14 [PATCH] app: fix silent " jhascoet
2023-08-10 15:39 jhascoet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZORzEDFxEgYsF3R5@platinum \
--to=olivier.matz@6wind.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=ju.hascoet@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.