Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPI: processor: thermal: Update CPU cooling devices on cpufreq policy changes

When a cpufreq policy appears or goes away, the CPU cooling devices for
the CPUs covered by that policy need to be updated so that the new
processor_get_max_state() value is stored as max_state and the
statistics in sysfs are rearranged for each of them.

Do that accordingly in acpi_thermal_cpufreq_init() and
acpi_thermal_cpufreq_exit().

Fixes: a365105c685c("thermal: sysfs: Reuse cdev->max_state")
Reported-by: Wang, Quanxian <quanxian.wang@intel.com>
Link: https://lore.kernel.org/linux-pm/53ec1f06f61c984100868926f282647e57ecfb2d.camel@intel.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Zhang Rui <rui.zhang@intel.com>
Reviewed-by: Zhang Rui <rui.zhang@intel.com>

+11 -3
+11 -3
drivers/acpi/processor_thermal.c
··· 140 140 ret = freq_qos_add_request(&policy->constraints, 141 141 &pr->thermal_req, 142 142 FREQ_QOS_MAX, INT_MAX); 143 - if (ret < 0) 143 + if (ret < 0) { 144 144 pr_err("Failed to add freq constraint for CPU%d (%d)\n", 145 145 cpu, ret); 146 + continue; 147 + } 148 + 149 + thermal_cooling_device_update(pr->cdev); 146 150 } 147 151 } 148 152 ··· 157 153 for_each_cpu(cpu, policy->related_cpus) { 158 154 struct acpi_processor *pr = per_cpu(processors, cpu); 159 155 160 - if (pr) 161 - freq_qos_remove_request(&pr->thermal_req); 156 + if (!pr) 157 + continue; 158 + 159 + freq_qos_remove_request(&pr->thermal_req); 160 + 161 + thermal_cooling_device_update(pr->cdev); 162 162 } 163 163 } 164 164 #else /* ! CONFIG_CPU_FREQ */