* [PATCH v1] thermal: core: fix blocking in unregistering zone
@ 2026-04-02 2:18 Jiajia Liu
0 siblings, 0 replies; only message in thread
From: Jiajia Liu @ 2026-04-02 2:18 UTC (permalink / raw)
To: Rafael J . Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
linux-pm, linux-kernel
Cc: Jiajia Liu
From: Jiajia Liu <liujiajia@kylinos.cn>
When hwmon->tz_list has more than one member,
thermal_remove_hwmon_sysfs does not unregister hwmon->device.
Unregistering the zone which is parent of hwmon->device blocks
at wait_for_completion(&tz->removal). Add check and move hwmon
to other zone in thermal_remove_hwmon_sysfs.
One method of reproducing hung task is to unbind the first
acpitz zone on systems with two acpitz zones.
$ cd /sys/bus/platform/drivers/acpi-thermal/
$ ls
bind LNXTHERM:00 LNXTHERM:01 uevent unbind
$ echo 'LNXTHERM:00' | sudo tee unbind > /dev/null
Signed-off-by: Jiajia Liu <liujiajia@kylinos.cn>
---
drivers/thermal/thermal_hwmon.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
index b624892bc6d6..43cde079fef0 100644
--- a/drivers/thermal/thermal_hwmon.c
+++ b/drivers/thermal/thermal_hwmon.c
@@ -242,6 +242,15 @@ void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
list_del(&temp->hwmon_node);
kfree(temp);
if (!list_empty(&hwmon->tz_list)) {
+ if (hwmon->device->parent == &tz->device) {
+ struct thermal_hwmon_temp *first;
+
+ first = list_first_entry(&hwmon->tz_list,
+ struct thermal_hwmon_temp,
+ hwmon_node);
+ device_move(hwmon->device, &first->tz->device,
+ DPM_ORDER_DEV_AFTER_PARENT);
+ }
mutex_unlock(&thermal_hwmon_list_lock);
return;
}
--
2.53.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-04-02 2:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-02 2:18 [PATCH v1] thermal: core: fix blocking in unregistering zone Jiajia Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox