Thread (2 messages) 2 messages, 2 authors, 2011-08-30

Re: [PATCH] ACPI: Ensure thermal limits match CPU frequencies

From: Josh Boyer <hidden>
Date: 2011-08-30 14:04:09

On Mon, Aug 29, 2011 at 02:28:27PM -0400, Matthew Garrett wrote:
quoted hunk ↗ jump to hunk
The ACPI thermal management code supports slowing down a CPU when it's
overheating. Right now that's done by choosing to run it at 100%, 75%, 50%
or 25% of full speed. However, most CPUs do not allow an arbitrary
frequency to be set and so will run at the first frequency below that value.
This doesn't match the intent of the specification, which is to drop the
frequency state by state until the temperature stabalises. Fix this up
so it uses actual frequencies rather than percentages.

Reported by: Gene Snider [off-list ref]
Signed-off-by: Matthew Garrett <redacted>
---
 drivers/acpi/processor_thermal.c |   45 +++++++++++++++++++++----------------
 1 files changed, 25 insertions(+), 20 deletions(-)
diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c
index 870550d..1c4eb60 100644
--- a/drivers/acpi/processor_thermal.c
+++ b/drivers/acpi/processor_thermal.c
@@ -52,10 +52,8 @@ ACPI_MODULE_NAME("processor_thermal");
  * _any_ cpufreq driver and not only the acpi-cpufreq driver.
  */
 
-#define CPUFREQ_THERMAL_MIN_STEP 0
-#define CPUFREQ_THERMAL_MAX_STEP 3
 
-static DEFINE_PER_CPU(unsigned int, cpufreq_thermal_reduction_pctg);
+static DEFINE_PER_CPU(unsigned int, cpufreq_thermal_limit_state);
 static unsigned int acpi_thermal_cpufreq_is_init = 0;
 
 static int cpu_has_cpufreq(unsigned int cpu)
@@ -70,19 +68,19 @@ static int acpi_thermal_cpufreq_notifier(struct notifier_block *nb,
 					 unsigned long event, void *data)
 {
 	struct cpufreq_policy *policy = data;
-	unsigned long max_freq = 0;
+	int state = per_cpu(cpufreq_thermal_limit_state, policy->cpu);
+	struct cpufreq_frequency_table *table;
 
 	if (event != CPUFREQ_ADJUST)
-		goto out;
+		return 0;
+
+	table = cpufreq_frequency_get_table(policy->cpu);
If CONFIG_CPU_FREQ_TABLE=m and CONFIG_ACPI_PROCESSOR=y, you'll get a
link error for an undefined symbol on this.  This requires
ACPI_PROCESSOR to select CPU_FREQ_TABLE.

josh
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help