[PATCH 1/2] cpufreq/intel_pstate: Do not load on VM that do not report max P state.

From: dirk . brandewie
Date: Tue Mar 05 2013 - 17:15:51 EST


From: Dirk Brandewie <dirk.brandewie@xxxxxxxxx>

It seems some VMs support the P state MSRs but return zeros. Fail
gracefully if we are running in this environment.

https://bugzilla.redhat.com/show_bug.cgi?id=916833

Reported-by: jwboyer@xxxxxxxxxx
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@xxxxxxxxx>
---
drivers/cpufreq/intel_pstate.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 096fde0..2bfd083 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -662,6 +662,9 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)

cpu = all_cpu_data[policy->cpu];

+ if (!policy->cpuinfo.max_freq)
+ return -ENODEV;
+
intel_pstate_get_min_max(cpu, &min, &max);

limits.min_perf_pct = (policy->min * 100) / policy->cpuinfo.max_freq;
--
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/