* [PATCH net v3 0/4] igb: fix runtime PM resume issues
@ 2026-11-19 14:04 Antonio Quartulli
2026-11-19 14:04 ` [PATCH net v3 1/4] igb: don't disable rings that don't exist when disabling an XSK pool Antonio Quartulli
0 siblings, 1 reply; 3+ messages in thread
From: Antonio Quartulli @ 2026-11-19 14:04 UTC (permalink / raw)
To: intel-wired-lan
Cc: Antonio Quartulli, Tony Nguyen, Przemek Kitszel, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Janis Edvarts Lacis, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Sriram Yagnaraman, Kurt Kanzenbach, Maciej Fijalkowski,
Heiner Kallweit, Joe Damato, netdev, linux-kernel, bpf
igb can be runtime suspended when the link goes down (with
power/control set to auto). Resuming it calls functions that need RTNL
without holding it (patches 2 and 3), and devices that can't signal a
wake-up are suspended anyway, so their port stays down when the link
comes back (patch 4). Patch 1 fixes a NULL dereference in the XSK pool
disable path when the stack has more queues than the device, which can
happen after a fallback from MSI-X to MSI on resume.
Tested with the 82576 emulated by QEMU, including, with test-only hooks,
a runtime resume and a simulated system sleep (the suspend/resume
callbacks called directly, as the test kernel has no CONFIG_SUSPEND)
with the device forced to come back with MSI and a single queue. Not
tested: real hardware and PME wake-up, a real system sleep, the MSI-X
allocation failure itself, the window before the work item runs, and
SR-IOV.
igc has the same issues (see the notes); Joe Damato offered to test on
igc, so its fix will be sent separately.
Changes in v3:
- new patch 1
- patch 2: set the real queue counts on system sleep resume and from a
work item on runtime resume, and drop packets for queues the device
doesn't have until then (Janis, Sashiko)
- patch 3: link the NAPIs from the same work item
Changes in v2:
- patch 2 (v2 patch 1): keep setting the queue counts in __igb_open(),
only skipping them on resume (Sashiko)
- mention the tested hardware in the commit messages
v2: https://lore.kernel.org/netdev/20261116153041.3002666-1-antonio@mandelbit.com/
v1: https://lore.kernel.org/netdev/20261113105835.3821433-1-antonio@mandelbit.com/
Antonio Quartulli (4):
igb: don't disable rings that don't exist when disabling an XSK pool
igb: fix RTNL assertion when resuming from runtime suspend
igb: link queues to NAPIs under RTNL after runtime resume
igb: only allow runtime PM if the device can wake up
drivers/net/ethernet/intel/igb/igb.h | 1 +
drivers/net/ethernet/intel/igb/igb_main.c | 96 +++++++++++++++++------
drivers/net/ethernet/intel/igb/igb_xsk.c | 7 +-
3 files changed, 80 insertions(+), 24 deletions(-)
--
2.56.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH net v3 1/4] igb: don't disable rings that don't exist when disabling an XSK pool
2026-11-19 14:04 [PATCH net v3 0/4] igb: fix runtime PM resume issues Antonio Quartulli
@ 2026-11-19 14:04 ` Antonio Quartulli
2026-11-20 14:04 ` sashiko-bot
0 siblings, 1 reply; 3+ messages in thread
From: Antonio Quartulli @ 2026-11-19 14:04 UTC (permalink / raw)
To: intel-wired-lan
Cc: Antonio Quartulli, Tony Nguyen, Przemek Kitszel, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Janis Edvarts Lacis, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Sriram Yagnaraman, Kurt Kanzenbach, Maciej Fijalkowski, netdev,
linux-kernel, bpf, stable
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, e.g. after igb falls back from MSI-X to MSI on resume. Disabling
the pool of such a queue then passes a NULL ring to
igb_txrx_ring_disable().
Only disable and re-enable the rings the device has, as
igb_xsk_pool_enable() and igb_xsk_wakeup() already check.
Compile-tested only: the XSK pool path isn't reachable with the QEMU
82576 setup used for the rest of the series.
Fixes: 80f6ccf9f116 ("igb: Introduce XSK data structures and helpers")
Cc: stable@vger.kernel.org # 6.14+
Link: https://lore.kernel.org/netdev/20261116153041.3002666-2-antonio@mandelbit.com/
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
---
v3: new patch.
drivers/net/ethernet/intel/igb/igb_xsk.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/igb/igb_xsk.c b/drivers/net/ethernet/intel/igb/igb_xsk.c
index ce4a7b5..8ed82bb 100644
--- a/drivers/net/ethernet/intel/igb/igb_xsk.c
+++ b/drivers/net/ethernet/intel/igb/igb_xsk.c
@@ -148,7 +148,12 @@ static int igb_xsk_pool_disable(struct igb_adapter *adapter, u16 qid)
return -EINVAL;
rx_ring = adapter->rx_ring[qid];
- if_running = netif_running(adapter->netdev) && igb_xdp_is_enabled(adapter);
+ /* The stack can know more queues than the device has, e.g. after a
+ * fallback to fewer queues on resume: skip the rings it doesn't have.
+ */
+ if_running = netif_running(adapter->netdev) &&
+ igb_xdp_is_enabled(adapter) &&
+ qid < adapter->num_rx_queues;
if (if_running)
igb_txrx_ring_disable(adapter, qid);
--
2.56.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net v3 1/4] igb: don't disable rings that don't exist when disabling an XSK pool
2026-11-19 14:04 ` [PATCH net v3 1/4] igb: don't disable rings that don't exist when disabling an XSK pool Antonio Quartulli
@ 2026-11-20 14:04 ` sashiko-bot
0 siblings, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-11-20 14:04 UTC (permalink / raw)
To: Antonio Quartulli, intel-wired-lan; +Cc: bpf
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] igb: missing num_tx_queues check in igb_xsk_pool_disable()
dereferences NULL
--
commit e4f6db572e101ec4f5da6fee01a7451218673315
Author: Antonio Quartulli <antonio@mandelbit.com>
igb: don't disable rings that don't exist when disabling an XSK pool
This commit checks qid against adapter->num_rx_queues in
igb_xsk_pool_disable() so rings that do not exist are not disabled or
re-enabled.
Link: https://lore.kernel.org/netdev/20261116153041.3002666-2-antonio@mandelbit.com/
> diff --git a/drivers/net/ethernet/intel/igb/igb_xsk.c b/drivers/net/ethernet/intel/igb/igb_xsk.c
> index ce4a7b58cad2f..8ed82bb1def9a 100644
> --- a/drivers/net/ethernet/intel/igb/igb_xsk.c
> +++ b/drivers/net/ethernet/intel/igb/igb_xsk.c
> @@ -148,7 +148,12 @@ static int igb_xsk_pool_disable(struct igb_adapter *adapter, u16 qid)
> return -EINVAL;
>
> rx_ring = adapter->rx_ring[qid];
> - if_running = netif_running(adapter->netdev) && igb_xdp_is_enabled(adapter);
> + /* The stack can know more queues than the device has, e.g. after a
> + * fallback to fewer queues on resume: skip the rings it doesn't have.
> + */
> + if_running = netif_running(adapter->netdev) &&
> + igb_xdp_is_enabled(adapter) &&
> + qid < adapter->num_rx_queues;
> if (if_running)
> igb_txrx_ring_disable(adapter, qid);
[Severity: Medium]
Can igb_txrx_ring_disable() still dereference a NULL adapter->tx_ring[qid]
when qid >= adapter->num_tx_queues?
In igb_set_interrupt_capability(), allocating SR-IOV VFs forces
adapter->num_tx_queues to 1 while leaving adapter->num_rx_queues at
adapter->rss_queues (up to 2 on 82576):
drivers/net/ethernet/intel/igb/igb_main.c:igb_set_interrupt_capability() {
...
adapter->num_rx_queues = adapter->rss_queues;
if (adapter->vfs_allocated_count)
adapter->num_tx_queues = 1;
else
adapter->num_tx_queues = adapter->rss_queues;
...
}
Because igb_xsk_pool_enable() also only checks qid >= adapter->num_rx_queues,
disabling a pool bound to qid 1 when SR-IOV is active passes qid <
adapter->num_rx_queues and reaches igb_txrx_ring_disable(), which
immediately dereferences adapter->tx_ring[1] (NULL).
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261119140412.163202-1-antonio@mandelbit.com?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-20 14:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19 14:04 [PATCH net v3 0/4] igb: fix runtime PM resume issues Antonio Quartulli
2026-11-19 14:04 ` [PATCH net v3 1/4] igb: don't disable rings that don't exist when disabling an XSK pool Antonio Quartulli
2026-11-20 14:04 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox