From: Stephen Hemminger <stephen@networkplumber.org>
To: Robert Sanford <rsanford2@gmail.com>
Cc: dev@dpdk.org, andrew.rybchenko@oktetlabs.ru,
mb@smartsharesystems.com, olivier.matz@6wind.com,
thomas@monjalon.net, Robert Sanford <rsanford@akamai.com>,
stable@dpdk.org
Subject: Re: [PATCH v5 2/3] mempool: fix dump of unpopulated pool
Date: Mon, 30 Nov 2026 16:06:14 -0800 [thread overview]
Message-ID: <20261130160614.7885e568@phoenix.local> (raw)
In-Reply-To: <20261130205152.7107-3-rsanford2@gmail.com>
On Mon, 30 Nov 2026 15:51:51 -0500
Robert Sanford <rsanford2@gmail.com> wrote:
> From: Robert Sanford <rsanford@akamai.com>
>
> rte_mempool_create_empty() adds a mempool to the mempool list before
> the mempool has a store. The store is allocated, and
> RTE_MEMPOOL_F_POOL_CREATED is set, by the first populate call. In
> between, rte_mempool_dump() queries the mempool driver for the number
> of objects in the store. With the ring driver this dereferences a NULL
> ring, and the process crashes. rte_mempool_list_dump() calls
> rte_mempool_dump() for every mempool on the list, so it crashes when
> another thread has created a mempool but not populated it yet. The
> telemetry /mempool/info handler has the same problem: its
> rte_mempool_walk() callback queries the driver for the same count.
>
> Add rte_mempool_is_created(), which tests RTE_MEMPOOL_F_POOL_CREATED.
> In rte_mempool_dump() and in the telemetry callback, query the mempool
> driver only when it returns true, and report a common pool count of 0
> otherwise, since the mempool has no objects yet. The rest of the
> mempool information is still reported. In statistics builds,
> rte_mempool_dump() also skips rte_mempool_ops_get_info() for such a
> mempool. The info is now zeroed first; it was left uninitialized for
> drivers without a get_info operation.
>
> The populating thread sets the flag without holding a lock, so set it
> with an atomic fetch-or with release ordering, and test it with an
> atomic load with acquire ordering. A reader that sees the flag then
> also sees the store.
>
> rte_mempool_walk() still passes mempools that are not populated yet to
> its callback. Document that the callback must check
> rte_mempool_is_created() before querying the mempool driver.
>
> rte_mempool_is_created() is public API because applications need it
> too: a callback passed to rte_mempool_walk() must not query the
> mempool driver of a mempool that is not created yet, and it has no
> other way to check that. The function is trivial and the library
> itself uses it, in rte_mempool_dump() and in the telemetry callback,
> so it is added directly as stable API, without an experimental stage.
> It is not inline, since it is not used in the fast path.
>
> Fixes: 449c49b93a6b ("mempool: support handler operations")
> Fixes: ab8a1cc4e3d8 ("mempool: add object usage counts in telemetry")
> Cc: stable@dpdk.org
Looks like you are using AI to write code and commits, thats ok.
But you need to ask it to be more concise.
See: SLOP-MSG here https://github.com/masoncl/review-prompts/blob/main/kernel/slop-indicators.md
next prev parent reply other threads:[~2026-12-01 0:06 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 1:11 [PATCH v1 0/3] mempool: fix races between list walk and create/free Robert Sanford
2026-11-03 1:11 ` [PATCH v1 1/3] mempool: fix race between list walk and free Robert Sanford
2026-11-03 13:54 ` Morten Brørup
2026-11-03 1:11 ` [PATCH v1 2/3] mempool: skip unpopulated pools in walk and dump Robert Sanford
2026-11-03 14:12 ` Morten Brørup
2026-11-03 1:11 ` [PATCH v1 3/3] test/mempool: add list walk race test Robert Sanford
2026-11-03 14:15 ` Morten Brørup
2026-11-03 17:35 ` [PATCH v2 0/3] mempool: fix races between list walk and create/free Robert Sanford
2026-11-03 17:35 ` [PATCH v2 1/3] mempool: fix race between list walk and free Robert Sanford
2026-11-03 17:35 ` [PATCH v2 2/3] mempool: fix dump of unpopulated pool Robert Sanford
2026-11-06 8:43 ` Morten Brørup
2026-11-06 18:43 ` Robert Sanford
2026-11-06 19:24 ` Morten Brørup
2026-11-03 17:35 ` [PATCH v2 3/3] test/mempool: add list walk race test Robert Sanford
2026-11-09 14:40 ` [PATCH v3 0/3] mempool: fix races between list walk and create/free Robert Sanford
2026-11-09 14:40 ` [PATCH v3 1/3] mempool: fix race between list walk and free Robert Sanford
2026-11-09 14:40 ` [PATCH v3 2/3] mempool: fix dump of unpopulated pool Robert Sanford
2026-11-09 14:40 ` [PATCH v3 3/3] test/mempool: add list walk race test Robert Sanford
2026-11-11 13:00 ` Morten Brørup
2026-11-12 15:43 ` [PATCH v4 0/3] mempool: fix races between list walk and create/free Robert Sanford
2026-11-12 15:43 ` [PATCH v4 1/3] mempool: fix race between list walk and free Robert Sanford
2026-11-12 15:43 ` [PATCH v4 2/3] mempool: fix dump of unpopulated pool Robert Sanford
2026-11-19 14:08 ` Thomas Monjalon
2026-11-19 14:18 ` Morten Brørup
2026-11-19 14:47 ` Thomas Monjalon
2026-11-19 19:27 ` Morten Brørup
2026-11-19 14:20 ` Morten Brørup
2026-11-12 15:43 ` [PATCH v4 3/3] test/mempool: add list walk race test Robert Sanford
2026-11-30 20:51 ` [PATCH v5 0/3] mempool: fix races between list walk and create/free Robert Sanford
2026-11-30 20:51 ` [PATCH v5 1/3] mempool: fix race between list walk and free Robert Sanford
2026-11-30 20:51 ` [PATCH v5 2/3] mempool: fix dump of unpopulated pool Robert Sanford
2026-12-01 0:06 ` Stephen Hemminger [this message]
2026-11-30 20:51 ` [PATCH v5 3/3] test/mempool: add list walk race test Robert Sanford
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=20261130160614.7885e568@phoenix.local \
--to=stephen@networkplumber.org \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=mb@smartsharesystems.com \
--cc=olivier.matz@6wind.com \
--cc=rsanford2@gmail.com \
--cc=rsanford@akamai.com \
--cc=stable@dpdk.org \
--cc=thomas@monjalon.net \
/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