From da16fc120b49b76e25e788ec3e77b2d3ef2260f8 Mon Sep 17 00:00:00 2001 From: LeoLiu-oc Date: Mon, 20 Oct 2025 18:07:58 +0800 Subject: [PATCH 1/2] Optimize VIA CPU Temp Monitoring During Suspend/Resume zhaoxin inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ID2Q5B CVE: NA -------------------- This patch improves the VIA CPU temperature driver's behavior during suspend and resume. It adds conditions in 'via_cputemp_online' and 'via_cputemp_down_prep' functions to skip processes when the system is suspending or resuming, using 'cpuhp_tasks_frozen'. This prevents potential lock-ups and ensures smoother temperature monitoring during power state transitions. Reviewed-by: Runa Guo Tested-by: Lyle Li Signed-off-by: LeoLiu-oc --- drivers/hwmon/via-cputemp.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/hwmon/via-cputemp.c b/drivers/hwmon/via-cputemp.c index 0a5057dbe51a..c79fa618efaf 100644 --- a/drivers/hwmon/via-cputemp.c +++ b/drivers/hwmon/via-cputemp.c @@ -216,6 +216,13 @@ static int via_cputemp_online(unsigned int cpu) struct platform_device *pdev; struct pdev_entry *pdev_entry; + /* + * Don't execute this on suspend as the device remove locks + * up the machine. + */ + if (cpuhp_tasks_frozen) + return 0; + pdev = platform_device_alloc(DRVNAME, cpu); if (!pdev) { err = -ENOMEM; @@ -255,6 +262,13 @@ static int via_cputemp_down_prep(unsigned int cpu) { struct pdev_entry *p; + /* + * Don't execute this on suspend as the device remove locks + * up the machine. + */ + if (cpuhp_tasks_frozen) + return 0; + mutex_lock(&pdev_list_mutex); list_for_each_entry(p, &pdev_list, list) { if (p->cpu == cpu) { -- Gitee From 03480c01e5185228ef448f067c6143c8702834af Mon Sep 17 00:00:00 2001 From: LeoLiu-oc Date: Mon, 20 Oct 2025 19:36:05 +0800 Subject: [PATCH 2/2] Optimize Zhaoxin CPU Temp Monitoring During Suspend/Resume zhaoxin inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ID2Q5B CVE: NA -------------------- Modified 'zhaoxin_cputemp_down_prep' to avoid system freezes during suspend by skipping device removal when 'cpuhp_tasks_frozen' is true. Reviewed-by: RunaGuo Tested-by: Lyle Li Signed-off-by: LeoLiu-oc --- drivers/hwmon/zhaoxin-cputemp.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/hwmon/zhaoxin-cputemp.c b/drivers/hwmon/zhaoxin-cputemp.c index 751d2c5a868a..ae1c6f066324 100644 --- a/drivers/hwmon/zhaoxin-cputemp.c +++ b/drivers/hwmon/zhaoxin-cputemp.c @@ -189,6 +189,13 @@ static int zhaoxin_cputemp_online(unsigned int cpu) struct platform_device *pdev; struct pdev_entry *pdev_entry; + /* + * Don't execute this on suspend as the device remove locks + * up the machine. + */ + if (cpuhp_tasks_frozen) + return 0; + pdev = platform_device_alloc(DRVNAME, cpu); if (!pdev) { err = -ENOMEM; @@ -228,6 +235,13 @@ static int zhaoxin_cputemp_down_prep(unsigned int cpu) { struct pdev_entry *p; + /* + * Don't execute this on suspend as the device remove locks + * up the machine. + */ + if (cpuhp_tasks_frozen) + return 0; + mutex_lock(&pdev_list_mutex); list_for_each_entry(p, &pdev_list, list) { if (p->cpu == cpu) { -- Gitee