thermal: core: fix blocking in unregistering zone
PATCH 1/1 thermal: core: fix blocking in unregistering zone
From: Jiajia Liu <[email protected]>
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 <[email protected]>
--- drivers/thermal/thermal_hwmon.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/thermal/thermal_hwmon.c +9 -0
@@ -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 ; }
Signature · 1 line
2.53.0