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 D19EC42AE1; Wed, 17 May 2023 13:53:41 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A51DC41156; Wed, 17 May 2023 13:53:41 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 09CE74067B for ; Wed, 17 May 2023 13:53:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684324419; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hX+GVvaMReZSGnXRjgniyX4puhKTJ7jv6q21YD8s/JQ=; b=Nu9zOpKVVjrONTFke4IJeQcZTmkG0/FGTa94uBGtz7jfvjhQ1V2THZO7pXYftjmTFWr/nJ VwDlOdmafqi24TCf31nub0ncMDvfmNMubZdbdeL9x+BT3HVAUkyg/0ajRk6Xf2VkOG9+h4 vIFsdMjS8/E7hwKYXo7jaoKVh3SAHmw= Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-352-4AAO3l0APcy1FDlYd3UC-A-1; Wed, 17 May 2023 07:53:38 -0400 X-MC-Unique: 4AAO3l0APcy1FDlYd3UC-A-1 Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-2533e0cd8f2so491400a91.2 for ; Wed, 17 May 2023 04:53:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684324417; x=1686916417; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hX+GVvaMReZSGnXRjgniyX4puhKTJ7jv6q21YD8s/JQ=; b=DmFEEA8inj1FmJKovp706prjtf2mBavYNEj+oiug7r0+R4uij8ynOfgPVM424AmNNh uxWi6qRiQAJIQy1vlskV3ComxZ1nSTgH8FvdGVyV0ux4msiQVvoALEJEmjC5f8LBGZ3N UH1pUPkj9jcINnj1tiHw2REWS+qeLWetxctiCqnVaZOMMM96jO7KfMs105jECSgQLWAT FN0ClYCp8uYCvkz7DOgYwxxuOjOdOHe8oZc4XYERiPIACFmdm9wwDTveq66CYlLvdp5/ nt6peH1cwCjXAmExhXT54Cwd2I62T2wmblP+RITFXTdKLp1oTIbfvbK4LyFLRbMSkvKN Lo9g== X-Gm-Message-State: AC+VfDzY7NJj/QyqFajYFFknyAYSvl0E/sGoHfJNh2PM8dj8ur5OHTFU wJ4gfKamliukPxcEoUCI4giMVIAcJLAa1iKWJqevC8UH27FSm+fmhihUdO1aTIgF1ueNCKJARHC AkPw2xjzQN4bhCiKfvYE= X-Received: by 2002:a17:90a:d498:b0:24e:10b3:c9cc with SMTP id s24-20020a17090ad49800b0024e10b3c9ccmr38112383pju.14.1684324417212; Wed, 17 May 2023 04:53:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6ViGWOk1S6JF93QfMxtlF8LR/cqU23BH66c3Wm8q9X7mUq7FyN/M8IOSAH3TgHaF9A/DXDQFWAZ95obmBN11s= X-Received: by 2002:a17:90a:d498:b0:24e:10b3:c9cc with SMTP id s24-20020a17090ad49800b0024e10b3c9ccmr38112365pju.14.1684324416886; Wed, 17 May 2023 04:53:36 -0700 (PDT) MIME-Version: 1.0 References: <20230516134146.480047-1-yasinncaner@gmail.com> <20230516082349.041c0e68@hermes.local> <98CBD80474FA8B44BF855DF32C47DC35D87923@smartserver.smartshare.dk> <98CBD80474FA8B44BF855DF32C47DC35D87926@smartserver.smartshare.dk> <98CBD80474FA8B44BF855DF32C47DC35D87927@smartserver.smartshare.dk> In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35D87927@smartserver.smartshare.dk> From: David Marchand Date: Wed, 17 May 2023 13:53:25 +0200 Message-ID: Subject: Re: [PATCH] lib/mempool : rte_mempool_avail_count, fixing return bigger than mempool size To: =?UTF-8?Q?Morten_Br=C3=B8rup?= , Yasin CANER Cc: Stephen Hemminger , dev@dpdk.org, Yasin CANER , Olivier Matz , Andrew Rybchenko X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 On Wed, May 17, 2023 at 11:05=E2=80=AFAM Morten Br=C3=B8rup wrote: > > On Tue, 16 May 2023 13:41:46 +0000 > > Yasin CANER wrote: > > > > > From: Yasin CANER > > > > > > after a while working rte_mempool_avail_count function returns bigger > > > than mempool size that cause miscalculation rte_mempool_in_use_count. > > > > > > it helps to avoid miscalculation rte_mempool_in_use_count. Is this issue reproduced with an application of the reporter, or a DPDK in-tree application? > > > > > > Bugzilla ID: 1229 > > > > > > Signed-off-by: Yasin CANER > > > > An alternative that avoids some code duplication. > > > > diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c > > index cf5dea2304a7..2406b112e7b0 100644 > > --- a/lib/mempool/rte_mempool.c > > +++ b/lib/mempool/rte_mempool.c > > @@ -1010,7 +1010,7 @@ rte_mempool_avail_count(const struct rte_mempool > > *mp) > > count =3D rte_mempool_ops_get_count(mp); > > > > if (mp->cache_size =3D=3D 0) > > - return count; > > + goto exit; > > This bug can only occur here (i.e. with cache_size=3D=3D0) if rte_mempool= _ops_get_count() returns an incorrect value. The bug should be fixed there = instead. > > > > MB (continued): The bug must be in the underlying mempool driver. I took = a look at the ring and stack drivers, and they seem fine. Or it could indicate a double free (or equivalent) issue from the application (either through direct call to mempool API, or indirectly like sending/freeing an already sent/freed packet for example). --=20 David Marchand