From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Yasin CANER" <yasinncaner@gmail.com>
Cc: "David Marchand" <david.marchand@redhat.com>,
"Stephen Hemminger" <stephen@networkplumber.org>, <dev@dpdk.org>,
"Yasin CANER" <yasin.caner@ulakhaberlesme.com.tr>,
"Olivier Matz" <olivier.matz@6wind.com>,
"Andrew Rybchenko" <andrew.rybchenko@oktetlabs.ru>
Subject: RE: [PATCH] lib/mempool : rte_mempool_avail_count, fixing return bigger than mempool size
Date: Thu, 18 May 2023 10:53:24 +0200 [thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35D87931@smartserver.smartshare.dk> (raw)
In-Reply-To: <CAP5epcNjpmLJy9GhhnLALjTvhLFJqaG-GHPJVKc4cTYz=dH4Fw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3364 bytes --]
From: Yasin CANER [mailto:yasinncaner@gmail.com]
Sent: Thursday, 18 May 2023 10.37
Hello,
I found a second free command in my code and removed it. David pointed to the right .
MB: Good to hear.
On the other hand, do you think we need to avoid miscalculations? Is it better to patch it or not?
MB: There is no bug in the library, so no need to patch it. The returned value was a consequence of using the library incorrectly (freeing twice).
or it needs to be aware of the second free command.
Sharing more information about env.
# ethtool -i mgmt
driver: virtio_net
version: 1.0.0
firmware-version:
expansion-rom-version:
bus-info: 0000:00:03.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no
NAME="Ubuntu"
VERSION="20.04.4 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.4 LTS"
VERSION_ID="20.04"
Linux spgw-dpdk 5.4.0-146-generic #163-Ubuntu SMP Fri Mar 17 18:26:02 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Best regards.
Morten Brørup <mb@smartsharesystems.com>, 17 May 2023 Çar, 15:23 tarihinde şunu yazdı:
> From: David Marchand [mailto:david.marchand@redhat.com]
> Sent: Wednesday, 17 May 2023 13.53
>
> On Wed, May 17, 2023 at 11:05 AM Morten Brørup <mb@smartsharesystems.com>
> wrote:
> > > On Tue, 16 May 2023 13:41:46 +0000
> > > Yasin CANER <yasinncaner@gmail.com> wrote:
> > >
> > > > From: Yasin CANER <yasin.caner@ulakhaberlesme.com.tr>
> > > >
> > > > 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 <yasin.caner@ulakhaberlesme.com.tr>
> > >
> > > 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 = rte_mempool_ops_get_count(mp);
> > >
> > > if (mp->cache_size == 0)
> > > - return count;
> > > + goto exit;
> >
> > This bug can only occur here (i.e. with cache_size==0) 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).
Good point, David.
@Yasin, if you build DPDK and your application with RTE_LIBRTE_MEMPOOL_DEBUG set in config/rte_config.h, the mempool cookies should catch any double frees.
[-- Attachment #2: Type: text/html, Size: 7948 bytes --]
next prev parent reply other threads:[~2023-05-18 8:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-16 13:41 Yasin CANER
2023-05-16 15:23 ` Stephen Hemminger
2023-05-16 16:03 ` Morten Brørup
2023-05-17 8:01 ` Yasin CANER
2023-05-17 8:38 ` Morten Brørup
2023-05-17 9:04 ` Morten Brørup
2023-05-17 11:37 ` Yasin CANER
2023-05-17 11:53 ` David Marchand
2023-05-17 12:23 ` Morten Brørup
2023-05-18 8:37 ` Yasin CANER
2023-05-18 8:53 ` Morten Brørup [this message]
2023-05-18 15:40 ` Mattias Rönnblom
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=98CBD80474FA8B44BF855DF32C47DC35D87931@smartserver.smartshare.dk \
--to=mb@smartsharesystems.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=olivier.matz@6wind.com \
--cc=stephen@networkplumber.org \
--cc=yasin.caner@ulakhaberlesme.com.tr \
--cc=yasinncaner@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).