Skip to content

igb: fix runtime PM resume issues

Antonio Quartulli bpf intel-wired-lan lkml netdev stable 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest6 patches 7 repliesIn review
  2. v44 patches 5 repliesSuperseded
  3. v34 patches 1 replySuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v23 patches3 repliesSuperseded
v13 patches1 replySuperseded

Changes in v5 from the cover letter

- new patch 3: keep the stack's Rx queues that still have an XSK pool (Janis)
- patch 4: cancel the work item before a suspend (Sashiko)
- new patch 5: resume the device before changing XDP or XSK settings (Sashiko)
- patch 6: check pci_dev_run_wake() when scheduling the suspend (Sashiko)

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6igb: don't touch rings that don't exist when disabling an XSK pooldrivers/net/ethernet/intel/igb/igb_xsk.c+26 -111 reply
2/6igb: fix RTNL assertion when resuming from runtime suspenddrivers/net/ethernet/intel/igb/igb.h drivers/net/ethernet/intel/igb/igb_main.c+54 -201 reply
3/6igb: keep the stack's Rx queues that still have an XSK pooldrivers/net/ethernet/intel/igb/igb_main.c+22 -51 reply
4/6igb: link queues to NAPIs under RTNL after runtime resumedrivers/net/ethernet/intel/igb/igb_main.c+20 -21 reply
5/6igb: resume the device before changing XDP or XSK settingsdrivers/net/ethernet/intel/igb/igb_main.c+16 -41 reply
6/6igb: only allow runtime PM if the device can wake updrivers/net/ethernet/intel/igb/igb_main.c+11 -31 reply

Reviews trailers per patch

All 6 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchJanis Edvarts Lacis
SeriesR-b
1/6R-b
2/6R-b
3/6R-b
4/6R-b
5/6R-b
6/6R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH net v5 0/6] igb: fix runtime PM resume issues

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 4), XDP and XSK changes race with a resume (patch 5), and devices that can't signal a wake-up are suspended anyway, so their port stays down when the link comes back (patch 6).

Patch 1 fixes the XSK pool disable path when the device has fewer rings than the stack has queues: a NULL dereference with VFs (a single Tx queue on 82576), or after a fallback from MSI-X to MSI on resume. Patch 3 keeps such queues while they still have an XSK pool, so that the pool can still be disabled.

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. Patches 1 and 3 were tested with a zero-copy AF_XDP socket: closing it after enabling a VF oopses (queue 1, stock igb and v3) or warns and leaks (queue 2, v4), and warns after a resume forced to use MSI (v4); patch 5 by closing a socket and attaching an XDP program while runtime suspended. 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, SR-IOV with runtime PM, and a device that can wake up. Not run under KASAN.

Sashiko also found two pre-existing issues in the XSK queue disable/ enable paths (the Tx NAPI isn't stopped when Rx and Tx don't share a vector; a failed buffer reallocation leaves the queue half torn down); they will be fixed separately.

igc has the same issues (see the notes); Joe Damato offered to test on igc, so its fix will be sent separately.

Changes in v5:
- new patch 3: keep the stack's Rx queues that still have an XSK pool (Janis)
- patch 4: cancel the work item before a suspend (Sashiko)
- new patch 5: resume the device before changing XDP or XSK settings (Sashiko)
- patch 6: check pci_dev_run_wake() when scheduling the suspend (Sashiko)

Changes in v4:
- patch 1: also handle queues with an Rx but no Tx ring, as with VFs:
tear down the Rx ring and skip only the Tx part (Sashiko); subject changed from "don't disable rings ..." to "don't touch rings ..."

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 (now 4): 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

v4: https://lore.kernel.org/netdev/[email protected]/
v3: https://lore.kernel.org/netdev/[email protected]/
v2: https://lore.kernel.org/netdev/[email protected]/
v1: https://lore.kernel.org/netdev/[email protected]/

Antonio Quartulli (6):
igb: don't touch rings that don't exist when disabling an XSK pool
igb: fix RTNL assertion when resuming from runtime suspend
igb: keep the stack's Rx queues that still have an XSK pool
igb: link queues to NAPIs under RTNL after runtime resume
igb: resume the device before changing XDP or XSK settings
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 | 144 +++++++++++++++++-----
 drivers/net/ethernet/intel/igb/igb_xsk.c  |  37 ++++--
 3 files changed, 143 insertions(+), 39 deletions(-)
Signature · 1 line
2.56.1