mirror-linux/drivers/base
Johannes Berg e246518aa2 PM: sleep: annotate RCU list iterations
These iterations require the read lock, otherwise RCU
lockdep will splat:

=============================
WARNING: suspicious RCU usage
6.17.0-rc3-00014-g31419c045d64 #6 Tainted: G           O
-----------------------------
drivers/base/power/main.c:1333 RCU-list traversed in non-reader section!!

other info that might help us debug this:

rcu_scheduler_active = 2, debug_locks = 1
5 locks held by rtcwake/547:
 #0: 00000000643ab418 (sb_writers#6){.+.+}-{0:0}, at: file_start_write+0x2b/0x3a
 #1: 0000000067a0ca88 (&of->mutex#2){+.+.}-{4:4}, at: kernfs_fop_write_iter+0x181/0x24b
 #2: 00000000631eac40 (kn->active#3){.+.+}-{0:0}, at: kernfs_fop_write_iter+0x191/0x24b
 #3: 00000000609a1308 (system_transition_mutex){+.+.}-{4:4}, at: pm_suspend+0xaf/0x30b
 #4: 0000000060c0fdb0 (device_links_srcu){.+.+}-{0:0}, at: device_links_read_lock+0x75/0x98

stack backtrace:
CPU: 0 UID: 0 PID: 547 Comm: rtcwake Tainted: G           O        6.17.0-rc3-00014-g31419c045d64 #6 VOLUNTARY
Tainted: [O]=OOT_MODULE
Stack:
 223721b3a80 6089eac6 00000001 00000001
 ffffff00 6089eac6 00000535 6086e528
 721b3ac0 6003c294 00000000 60031fc0
Call Trace:
 [<600407ed>] show_stack+0x10e/0x127
 [<6003c294>] dump_stack_lvl+0x77/0xc6
 [<6003c2fd>] dump_stack+0x1a/0x20
 [<600bc2f8>] lockdep_rcu_suspicious+0x116/0x13e
 [<603d8ea1>] dpm_async_suspend_superior+0x117/0x17e
 [<603d980f>] device_suspend+0x528/0x541
 [<603da24b>] dpm_suspend+0x1a2/0x267
 [<603da837>] dpm_suspend_start+0x5d/0x72
 [<600ca0c9>] suspend_devices_and_enter+0xab/0x736
 [...]

Add the fourth argument to the iteration to annotate
this and avoid the splat.

Fixes: 06799631d5 ("PM: sleep: Make async suspend handle suppliers like parents")
Fixes: ed18738fff ("PM: sleep: Make async resume handle consumers like children")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20250826134348.aba79f6e6299.I9ecf55da46ccf33778f2c018a82e1819d815b348@changeid
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-08-26 15:27:04 +02:00
..
firmware_loader Driver core changes for 6.17-rc1 2025-07-29 12:15:39 -07:00
power PM: sleep: annotate RCU list iterations 2025-08-26 15:27:04 +02:00
regmap regmap: Fixes for v6.17 2025-08-09 08:40:28 +03:00
test drivers: base: test: Add ...find_device_by...(... NULL) tests 2024-12-24 09:48:09 +01:00
Kconfig arch_numa: switch over to numa_memblks 2024-09-03 21:15:32 -07:00
Makefile driver core: add a faux bus for use when a simple device/bus is needed 2025-02-13 16:58:51 +01:00
arch_numa.c arch_numa: Restore nid checks before registering a memblock with a node 2024-12-01 22:04:52 +02:00
arch_topology.c arch_topology: Relocate cpu_scale to topology.[h|c] 2025-05-07 21:56:55 +02:00
attribute_container.c driver core: attribute_container: Remove unused functions 2024-09-13 15:41:42 +02:00
auxiliary.c Driver core changes for 6.17-rc1 2025-07-29 12:15:39 -07:00
auxiliary_sysfs.c driver core: auxiliary bus: show auxiliary device IRQs 2024-07-11 14:17:03 -07:00
base.h driver core: fix potential NULL pointer dereference in dev_uevent() 2025-04-15 17:04:35 +02:00
bus.c driver core: fix potential NULL pointer dereference in dev_uevent() 2025-04-15 17:04:35 +02:00
cacheinfo.c cacheinfo: Add arch hook to compress CPU h/w id into 32 bits for cache-id 2025-07-16 15:04:27 +02:00
class.c drivers: core: remove device_link argument from class_compat_[create|remove]_link 2025-01-10 15:42:20 +01:00
component.c component: do not try to unbind unbound components 2025-04-15 18:05:40 +02:00
container.c driver core: container: make container_subsys const 2023-12-21 13:56:10 +01:00
core.c Driver core changes for 6.17-rc1 2025-07-29 12:15:39 -07:00
cpu.c x86/bugs: Add a Transient Scheduler Attacks mitigation 2025-06-17 17:17:02 +02:00
dd.c PM: domains: Detach on device_unbind_cleanup() 2025-07-07 20:41:21 +02:00
devcoredump.c sysfs: treewide: switch back to attribute_group::bin_attrs 2025-06-17 10:44:15 +02:00
devres.c Immutable tag for the driver core tree to pull from 2025-04-28 10:18:29 +02:00
devtmpfs.c devtmpfs: don't use vfs_getattr_nosec to query i_mode 2025-04-25 12:11:45 +02:00
driver.c driver core: Introduce device_iter_t for device iterating APIs 2025-01-10 15:26:12 +01:00
faux.c driver core: faux: Quiet probe failures 2025-06-10 19:23:25 +02:00
firmware.c
hypervisor.c
init.c driver core: add a faux bus for use when a simple device/bus is needed 2025-02-13 16:58:51 +01:00
isa.c driver core: have match() callback in struct bus_type take a const * 2024-07-03 15:16:54 +02:00
map.c
memory.c drivers/base/node: optimize memory block registration to reduce boot time 2025-07-09 22:41:59 -07:00
module.c drivers: base: handle module_kobject creation 2025-04-16 15:10:55 +02:00
node.c Summary of significant series in this pull request: 2025-07-31 14:57:54 -07:00
physical_location.c driver core: location: Use str_yes_no() helper function 2025-02-21 09:20:30 +01:00
physical_location.h driver core: physical_location.h remove extern from function prototypes 2023-03-24 15:35:48 +01:00
pinctrl.c
platform-msi.c platform-msi: Add msi_remove_device_irq_domain() in platform_device_msi_free_irqs_all() 2025-05-07 17:49:00 +02:00
platform.c driver core: platform: Drop dev_pm_domain_detach() call 2025-07-07 20:41:21 +02:00
property.c Char/Misc/IIO pull request for 6.16-rc1 2025-06-06 11:50:47 -07:00
soc.c driver core: mark remaining local bus_type variables as const 2023-12-21 13:56:30 +01:00
swnode.c Linux 6.15-rc4 2025-04-28 09:51:34 +02:00
syscore.c
topology.c sysfs: treewide: switch back to attribute_group::bin_attrs 2025-06-17 10:44:15 +02:00
trace.c
trace.h devres: Fix page faults when tracing devres from unloaded modules 2024-10-14 08:21:09 +02:00
transport_class.c drivers: base: transport_class: fix resource leak when transport_add_device() fails 2023-01-20 14:22:53 +01:00