From: Breno Leitao <leitao@debian.org>
To: Paolo Abeni <pabeni@redhat.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Simon Horman <horms@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
netdev@vger.kernel.org, asantostc@gmail.com,
gustavold@gmail.com, linux-kernel@vger.kernel.org,
kernel-team@meta.com
Subject: Re: [PATCH net-next v2 0/8] netconsole: stop charging netpoll users for netconsole-only data
Date: Fri, 10 Jul 2026 02:46:17 -0700 [thread overview]
Message-ID: <alC5pjeFfFnBuipL@gmail.com> (raw)
In-Reply-To: <1bfad1f6-6947-47a4-9dc0-72b4c16fc395@redhat.com>
On Thu, Jul 09, 2026 at 12:20:24PM +0200, Paolo Abeni wrote:
> > @@ -335,17 +340,15 @@ static void refill_skbs_work_handler(struct work_struct *work)
> > static void netconsole_skb_pool_init(struct netconsole_target *nt)
> > {
> > - skb_queue_head_init(&nt->np.skb_pool);
> > - INIT_WORK(&nt->np.refill_wq, refill_skbs_work_handler);
> > - refill_skbs(&nt->np);
> > + skb_queue_head_init(&nt->skb_pool);
> > + INIT_WORK(&nt->refill_wq, refill_skbs_work_handler);
> > + refill_skbs(nt);
> > }
> Can this race with target teardown?
> If a network device linked to a deactivated target is unregistered, it queues
> the target on target_cleanup_list and schedules
> netconsole_process_cleanups_core(), which executes netconsole_skb_pool_flush()
> under rtnl_lock.
Let me think about it.
Sashiko said:
> Can this race with target teardown?
> If a network device linked to a deactivated target is unregistered, it
> queues the target on target_cleanup_list and schedules
> netconsole_process_cleanups_core(), which executes
> netconsole_skb_pool_flush() under rtnl_lock.
Correct. This is the summary of the code:
static void netconsole_process_cleanups_core(void) {
ASSERT_RTNL();
mutex_lock(&target_cleanup_list_lock);
list_for_each_entry_safe(nt, tmp, &target_cleanup_list, list) {
netconsole_skb_pool_flush(nt);
..
}
> Concurrently, if a user enables the target via configfs
> enabled_store(), netconsole_skb_pool_init() is called.
Correct. The code is:
static ssize_t enabled_store(struct config_item *item,
dynamic_netconsole_mutex_lock();
netconsole_skb_pool_init(nt);
...
}
> Because this initialization happens before acquiring rtnl_lock inside
> netpoll_setup(), enabled_store() can execute INIT_WORK() and
> skb_queue_head_init() simultaneously with the cleanup thread executing
> cancel_work_sync() and skb_queue_purge_reason() on the exact same
> fields.
So, it seems they can execute in parallel, given that the device might
be in the cleanup list, and, configfs might be toggling it up.
I don't think this is a big issue, given worst case scenario, the pool
will not be populated, but this seems a clear regression.
> Does this initialization need to be moved inside the rtnl_lock
> protected region to avoid data corruption?
This refactor genuinely did move the pool init out of netpoll_setup()'s
RTNL coverage — before the series, __netpoll_setup() did the
skb_queue_head_init/INIT_WORK under RTNL, giving blanket mutual
exclusion with the notifier.
I don't think I want to have the initialization under RTNL, given this
is a heavy lift. At the same time, I don't have a clear view on how to
solve it. Maybe getting the target_cleanup_list_lock() at skb pool
initializion (which seems ugly as hell).
Anyway, let me spend some tokens on it, and see if I can figure out
a better plan.
Thanks for raising this up,
--breno
--
pw-bot: cr
next prev parent reply other threads:[~2026-07-10 9:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 12:19 [PATCH net-next v2 0/8] netconsole: stop charging netpoll users for netconsole-only data Breno Leitao
2026-07-02 12:19 ` [PATCH net-next v2 1/8] netpoll: export refill_skbs(), refill_skbs_work_handler(), skb_pool_flush() Breno Leitao
2026-07-02 12:19 ` [PATCH net-next v2 2/8] netconsole: take over skb pool lifecycle from netpoll Breno Leitao
2026-07-02 12:19 ` [PATCH net-next v2 3/8] netconsole: move refill_skbs_work_handler() " Breno Leitao
2026-07-02 12:19 ` [PATCH net-next v2 4/8] netconsole: move refill_skbs() and skb-pool sizing macros " Breno Leitao
2026-07-02 12:19 ` [PATCH net-next v2 5/8] netconsole: move skb_pool_flush() " Breno Leitao
2026-07-02 12:19 ` [PATCH net-next v2 6/8] netconsole: move skb_pool / refill_wq from struct netpoll to netconsole_target Breno Leitao
2026-07-02 12:19 ` [PATCH net-next v2 7/8] netconsole: move local_port / remote_port " Breno Leitao
2026-07-02 12:19 ` [PATCH net-next v2 8/8] netconsole: move remote_mac " Breno Leitao
2026-07-06 11:55 ` [PATCH net-next v2 0/8] netconsole: stop charging netpoll users for netconsole-only data Breno Leitao
2026-07-09 10:19 ` Simon Horman
2026-07-09 10:27 ` Paolo Abeni
2026-07-09 16:38 ` Breno Leitao
2026-07-09 10:20 ` Paolo Abeni
2026-07-10 9:46 ` Breno Leitao [this message]
2026-07-10 11:01 ` Breno Leitao
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=alC5pjeFfFnBuipL@gmail.com \
--to=leitao@debian.org \
--cc=andrew+netdev@lunn.ch \
--cc=asantostc@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gustavold@gmail.com \
--cc=horms@kernel.org \
--cc=kernel-team@meta.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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