From: Yasin CANER <yasinncaner@gmail.com>
To: "Morten Brørup" <mb@smartsharesystems.com>
Cc: 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: Wed, 17 May 2023 14:37:46 +0300 [thread overview]
Message-ID: <CAP5epcM6dOvGDR6dR3g+pwztYmxOi_qoOvoZ5c8UtFR94yLTFw@mail.gmail.com> (raw)
In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35D87927@smartserver.smartshare.dk>
[-- Attachment #1: Type: text/plain, Size: 3795 bytes --]
Hello,
mempool drivers is listed here.
https://doc.dpdk.org/guides/mempool/index.html
my app loads *rte_mempool_ring* and also *rte_mempool_stack* . In doc,
rte_mempool_ring is default mempool driver.
"-d librte_mbuf.so -d librte_mempool.so -d librte_mempool_ring.so -d
librte_mempool_stack.so -d librte_mempool_bucket.so -d librte_kni.so"
EAL: open shared lib librte_mbuf.so
EAL: open shared lib librte_mempool.so
EAL: open shared lib librte_mempool_ring.so
EAL: open shared lib librte_mempool_stack.so
EAL: lib.stack log level changed from disabled to notice
EAL: open shared lib librte_mempool_bucket.so
EAL: open shared lib librte_kni.so
EAL: open shared lib
DPDK_LIBS/lib/x86_64-linux-gnu/dpdk/pmds-23.0/librte_mempool_octeontx.so
EAL: pmd.octeontx.mbox log level changed from disabled to notice
EAL: pmd.mempool.octeontx log level changed from disabled to notice
Morten Brørup <mb@smartsharesystems.com>, 17 May 2023 Çar, 12:04 tarihinde
şunu yazdı:
> *From:* Morten Brørup [mailto:mb@smartsharesystems.com]
> *Sent:* Wednesday, 17 May 2023 10.38
>
> *From:* Yasin CANER [mailto:yasinncaner@gmail.com]
> *Sent:* Wednesday, 17 May 2023 10.01
>
> Hello,
>
>
>
> I don't have full knowledge of how to work rte_mempool_ops_get_count() but
> there is another comment about it. Maybe it relates.
>
> /*
> * due to race condition (access to len is not locked), the
> * total can be greater than size... so fix the result
> */
>
>
>
> MB: This comment relates to the race when accessing the per-lcore cache
> counters.
>
>
>
> MB (continued): I have added more information, regarding mempool drivers,
> in Bugzilla: https://bugs.dpdk.org/show_bug.cgi?id=1229
>
>
>
>
>
> Best regards.
>
>
>
> Morten Brørup <mb@smartsharesystems.com>, 16 May 2023 Sal, 19:04
> tarihinde şunu yazdı:
>
> > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> > Sent: Tuesday, 16 May 2023 17.24
> >
> > 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.
> > >
> > > 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.
>
>
>
> >
> > for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++)
> > count += mp->local_cache[lcore_id].len;
> > @@ -1019,6 +1019,7 @@ rte_mempool_avail_count(const struct rte_mempool
> > *mp)
> > * due to race condition (access to len is not locked), the
> > * total can be greater than size... so fix the result
> > */
> > +exit:
> > if (count > mp->size)
> > return mp->size;
> > return count;
>
>
[-- Attachment #2: Type: text/html, Size: 8566 bytes --]
next prev parent reply other threads:[~2023-05-17 11:39 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 [this message]
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
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=CAP5epcM6dOvGDR6dR3g+pwztYmxOi_qoOvoZ5c8UtFR94yLTFw@mail.gmail.com \
--to=yasinncaner@gmail.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=mb@smartsharesystems.com \
--cc=olivier.matz@6wind.com \
--cc=stephen@networkplumber.org \
--cc=yasin.caner@ulakhaberlesme.com.tr \
/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).