From: Jiajia Liu <liujia6264@gmail.com>
To: "Rafael J . Wysocki" <rafael@kernel.org>,
Daniel Lezcano <daniel.lezcano@kernel.org>,
Zhang Rui <rui.zhang@intel.com>,
Lukasz Luba <lukasz.luba@arm.com>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Jiajia Liu <liujiajia@kylinos.cn>
Subject: [PATCH v1] thermal: core: fix blocking in unregistering zone
Date: Thu, 2 Apr 2026 10:18:28 +0800 [thread overview]
Message-ID: <20260402021828.16556-1-liujia6264@gmail.com> (raw)
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
reply other threads:[~2026-04-02 2:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260402021828.16556-1-liujia6264@gmail.com \
--to=liujia6264@gmail.com \
--cc=daniel.lezcano@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=liujiajia@kylinos.cn \
--cc=lukasz.luba@arm.com \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox