From 63daebef02c2e321056be5fe7b5e82e732152bb4 Mon Sep 17 00:00:00 2001 From: leoliu-oc Date: Thu, 30 Oct 2025 16:08:36 +0800 Subject: [PATCH 1/2] Optimize VIA CPU Temp Monitoring During Suspend/Resume zhaoxin inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IDARG5 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. 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 3c960b999958..e1c10b9ec467 100644 --- a/drivers/hwmon/via-cputemp.c +++ b/drivers/hwmon/via-cputemp.c @@ -230,6 +230,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; @@ -269,6 +276,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 dcd0ed02777fa35f9f98f4896a801bf8f52a3be1 Mon Sep 17 00:00:00 2001 From: leoliu-oc Date: Thu, 30 Oct 2025 16:08:36 +0800 Subject: [PATCH 2/2] Optimize Zhaoxin CPU Temp Monitoring During Suspend/Resume zhaoxin inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IDARG5 CVE: NA -------------------- Modified 'zhaoxin_cputemp_down_prep' to avoid system freezes during suspend by skipping device removal when 'cpuhp_tasks_frozen' is true. 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 8b88228a334d..2a69b22b86fa 100644 --- a/drivers/hwmon/zhaoxin-cputemp.c +++ b/drivers/hwmon/zhaoxin-cputemp.c @@ -201,6 +201,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; @@ -240,6 +247,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