From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2A46D430CE; Tue, 22 Aug 2023 10:34:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 98E914021D; Tue, 22 Aug 2023 10:34:26 +0200 (CEST) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by mails.dpdk.org (Postfix) with ESMTP id D38F140041 for ; Tue, 22 Aug 2023 10:34:25 +0200 (CEST) Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-31963263938so3728965f8f.2 for ; Tue, 22 Aug 2023 01:34:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; t=1692693265; x=1693298065; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=dsg2tWa0bT/AqLkWWxewjww3aR1vUqK+twnJEnEssv8=; b=gf8dTsXNUlEFg7XuSAgKfy4Jh8Nlrd6MJ91859x4X5VVbbc2jJ9WdIQpnwqNtZRhpf T5CGnVBBy+ISG1JC3frtfEUo5rv/bo3Dx9PdHEWwRzfI+mQpKmTjX5bQ53MNx57jcKYu J/IMawEItyTExpmkJo++qLGHUEwlMvGrDvdiN+ux9w/NOqM83qugMZZYUDNFok+k08a8 4MW/0BTZd8lsqbq4E8RtHtHTM5YOpC1W2DyUT7dEh4v+jvCvkBvpFn1xrryplfC6Fb6b ToKlOlrsr4DnZZsaZMSWUrd17U3u5blW7WPe5DbMonBInwL4mA0n6A5WcXc48A3eHXDm q1nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692693265; x=1693298065; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=dsg2tWa0bT/AqLkWWxewjww3aR1vUqK+twnJEnEssv8=; b=efsqT8bS364ePi/yl/iTd9wFEQDefg5GPMFn4kVXkQ5NNsR1GozaWzGdeitRs1L4rU oIPoUE/T9AO92EAeQdXuNqsk/LAPQK/EsEo+PsufnOCKtqCpUvIJ0jMF+CUzkpoaMEE9 7t5pjYvJitcQRbvsepfLUjddHtBty6ZOZfIXN4cjN9CMvnlTzhUqzhJGUSG+JKBy5e/o yGxUS/4+e/TMXNLChQsab3a4KDp+809IhBe/thVLFZe7NtpaQgSnzcWrTvwGuteGzrrD +TWGS+8DXCVSzhW4i56JYsT8IxbUKsvIsKtr2fL8l9TXT0HdpHjWIDiladudsyGaLpbe +Tyw== X-Gm-Message-State: AOJu0Yz6W5mVhmWOHYZyZQ8+wvLUS4hv3YsC88HBT5ItAx+CAFVxDdjR vHV8juZU19ypMNqzEzEUFj/WXg== X-Google-Smtp-Source: AGHT+IEALd+0b9FpVlXUgDpt53+K90hp+Eo2fBCUkh6rScOa0i86oIRxl+PmOZ80eXNNUzUXumxr7A== X-Received: by 2002:adf:ff8d:0:b0:319:7134:a3cf with SMTP id j13-20020adfff8d000000b003197134a3cfmr7820640wrr.31.1692693265395; Tue, 22 Aug 2023 01:34:25 -0700 (PDT) Received: from 6wind.com ([2a01:e0a:5ac:6460:c065:401d:87eb:9b25]) by smtp.gmail.com with ESMTPSA id b4-20020adff904000000b003197c7d08ddsm15116026wrr.71.2023.08.22.01.34.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Aug 2023 01:34:24 -0700 (PDT) Date: Tue, 22 Aug 2023 10:34:24 +0200 From: Olivier Matz To: jhascoet Cc: dev@dpdk.org, David Marchand Subject: Re: [PATCH] app: fix silent enqueue fail in test_mbuf test_refcnt_iter Message-ID: References: <20230810160941.3895855-1-jhascoet@kalray.eu> <20230822063453.97904-1-jhascoet@kalray.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230822063453.97904-1-jhascoet@kalray.eu> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hello Julien, On Tue, Aug 22, 2023 at 08:34:53AM +0200, jhascoet wrote: > From: Julien Hascoet > > 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 > --- > 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