From: Antonio Quartulli <antonio@mandelbit.com>
To: Janis Edvarts Lacis <janislacis06@gmail.com>
Cc: intel-wired-lan@lists.osuosl.org,
Tony Nguyen <anthony.l.nguyen@intel.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Jesper Dangaard Brouer <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Stanislav Fomichev <sdf@fomichev.me>,
Sriram Yagnaraman <sriram.yagnaraman@ericsson.com>,
Kurt Kanzenbach <kurt@linutronix.de>,
Maciej Fijalkowski <maciej.fijalkowski@intel.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
bpf@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH net v4 1/4] igb: don't touch rings that don't exist when disabling an XSK pool
Date: Mon, 23 Nov 2026 21:28:47 +0100 [thread overview]
Message-ID: <5b8c4005-ed10-4be5-b79b-8f59089d6fbf@mandelbit.com> (raw)
In-Reply-To: <xupy6jbpnziq2qji54zjbvm7neggrwkxg3sfrhlolmrd6ysifl@zptk6ynkbu5f>
On 21/11/2026 00:17, Janis Edvarts Lacis wrote:
> On 20 Nov 22:01, Antonio Quartulli wrote:
>> xsk_get_pool_from_qid() checks the queue id against the stack's real
>> queue counts, which can be higher than the number of rings the device
>> has: on 82576, enabling VFs leaves a single Tx queue while keeping two
>> Rx queues, and igb can fall back from MSI-X to MSI with a single queue
>> on resume. Disabling the pool of such a queue, e.g. one bound to queue 1
>> before enabling VFs, then passes a NULL Tx ring to
>> igb_txrx_ring_disable().
>>
>> Only disable and re-enable the rings the device has: skip the queue if
>> it has no Rx ring, and only the Tx part if it has no Tx ring, so that
>> an Rx ring using the pool still stops using it.
>>
>
> What happens if a pool is bound to, say, queue 1 and the socket stays
> open across a runtime resume that falls back from MSI-X to MSI (queue 1
> becomes invalid)?
>
> If the socket is closed after igb_rtnl_resume_task() has reduced both
> real queue counts to one, xsk_get_pool_from_qid() will return NULL for
> queue 1. As I read it, igb_xsk_pool_disable() then returns -EINVAL
> before doing the cleanup and resources get leaked.
>
> I may be mistaken here, if so, please let me know :)
Hi Janis,
actually you're not mistaken, thanks for spotting it.
Once the real Rx queue count is lowered below a queue with a bound XSK
pool, xsk_get_pool_from_qid() no longer finds the pool, the disable
fails ("Failed to disable zero-copy!") and the pool's DMA mappings are
never unmapped.
igb already does this today (it lowers the counts on runtime resume,
just without RTNL), and so does any shrink done by the driver itself
(e.g. SR-IOV reinit), so it's worth fixing here.
In v5 igb I will follow what ethtool does for channel changes: when the
driver lowers its queue counts, it keeps the real Rx count up to the
highest queue that still has an XSK pool, so the pool can still be
disabled and unmapped (the rings are skipped as they don't exist). The
Tx count follows the device, and the Rx count is lowered at the next
open.
This said, I will first wait for Sashiko to report any other potential
issue and then I'll work on v5.
Best regards,
--
Antonio Quartulli
CEO and Co-Founder
Mandelbit Srl
https://www.mandelbit.com
next prev parent reply other threads:[~2026-11-23 20:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 21:01 [PATCH net v4 0/4] igb: fix runtime PM resume issues Antonio Quartulli
2026-11-20 21:01 ` [PATCH net v4 1/4] igb: don't touch rings that don't exist when disabling an XSK pool Antonio Quartulli
2026-11-20 23:17 ` Janis Edvarts Lacis
2026-11-23 20:28 ` Antonio Quartulli [this message]
2026-11-20 21:01 ` [PATCH net v4 2/4] igb: fix RTNL assertion when resuming from runtime suspend Antonio Quartulli
2026-11-20 21:01 ` [PATCH net v4 3/4] igb: link queues to NAPIs under RTNL after runtime resume Antonio Quartulli
2026-11-20 21:01 ` [PATCH net v4 4/4] igb: only allow runtime PM if the device can wake up Antonio Quartulli
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=5b8c4005-ed10-4be5-b79b-8f59089d6fbf@mandelbit.com \
--to=antonio@mandelbit.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=hawk@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=janislacis06@gmail.com \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=kurt@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=sdf@fomichev.me \
--cc=sriram.yagnaraman@ericsson.com \
--cc=stable@vger.kernel.org \
/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
all inboxes | Powered by JetHome®