Skip to content

ACPI: scan: Do not hold physical_node_lock across device_offline() and device_online()

Sasha Levin linux-acpi lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 1 replyIn review
  2. v11 patch 1 replySuperseded

Changes in v2 from the cover letter

- New patch 1 (Rafael).
- Patch 2: keep physical_node_lock held across put_device() and leave the loop with break (Rafael).
- Patch 2: move the comments of the helpers next to their loops (Rafael).
- Patch 2: the changelog no longer claims that physical_node_lock only protects the list of physical nodes.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2ACPI: scan: Print the offline failure message in acpi_bus_offline()drivers/acpi/scan.c+2 -21 reply
2/2ACPI: scan: Do not hold physical_node_lock across device_offline() and device_online()drivers/acpi/scan.c include/acpi/acpi_bus.h+88 -190 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/2] ACPI: scan: Do not hold physical_node_lock across device_offline() and device_online()

syzbot has reported a lockdep cycle between physical_node_lock and the CPU hotplug locks, which comes from acpi_bus_offline() holding the ACPI device's physical_node_lock while it offlines a CPU. Patch 2 stops holding physical_node_lock across device_offline() and device_online().

Patch 1 is new in v2. It makes acpi_bus_offline() print the "Offline failed." message itself, while the device cannot go away, instead of passing the device to acpi_scan_try_to_offline() for printing after the lock has been released.

Changes since v1:
- New patch 1 (Rafael).
- Patch 2: keep physical_node_lock held across put_device() and leave the loop with break (Rafael).
- Patch 2: move the comments of the helpers next to their loops (Rafael).
- Patch 2: the changelog no longer claims that physical_node_lock only protects the list of physical nodes.

Tested in a QEMU q35 guest with lockdep: the reproducer no longer triggers the report, CPU and DIMM hot-removal through QMP and sysfs eject work, and when a DIMM cannot be removed because one of its memory blocks fails to go offline, the other blocks are put back online and "memory memory32: Offline failed." is printed, as before.

v1: https://lore.kernel.org/r/[email protected]

Sasha Levin (2):
ACPI: scan: Print the offline failure message in acpi_bus_offline()
ACPI: scan: Do not hold physical_node_lock across device_offline() and
device_online()

 drivers/acpi/scan.c     | 108 ++++++++++++++++++++++++++++++++--------
 include/acpi/acpi_bus.h |   1 +
 2 files changed, 89 insertions(+), 20 deletions(-)
Signature · 1 line
2.53.0