aboutsummaryrefslogtreecommitdiffstats
path: root/xen/drivers/cpufreq
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-03-09 09:59:59 +0000
committerKeir Fraser <keir.fraser@citrix.com>2010-03-09 09:59:59 +0000
commit0e2f4c8cf08ea7da9a1c0fde256950cd33d1ee56 (patch)
tree6d7a5e5514be4373b867430f3265bde70f13e9a0 /xen/drivers/cpufreq
parent9e4f8153248f3db4e240e803759c764d83a0e54c (diff)
downloadxen-0e2f4c8cf08ea7da9a1c0fde256950cd33d1ee56.tar.gz
xen-0e2f4c8cf08ea7da9a1c0fde256950cd33d1ee56.tar.bz2
xen-0e2f4c8cf08ea7da9a1c0fde256950cd33d1ee56.zip
Add cpufreq sanity check
This fixes bug 1585 http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=3D1585 root cause: with incorrect BIOS info, cpufreq driver may not start. in this case, if user use xenpm to manipulate cpufreq driver, NULL pointer will cause xen panic. this patch add the sanity check and warning info to fix this issue. Signed-off-by: Yu Ke <ke.yu@intel.com>
Diffstat (limited to 'xen/drivers/cpufreq')
-rw-r--r--xen/drivers/cpufreq/cpufreq.c10
-rw-r--r--xen/drivers/cpufreq/cpufreq_ondemand.c6
2 files changed, 16 insertions, 0 deletions
diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c
index 7ef193a987..5524bc92a6 100644
--- a/xen/drivers/cpufreq/cpufreq.c
+++ b/xen/drivers/cpufreq/cpufreq.c
@@ -177,6 +177,15 @@ int cpufreq_add_cpu(unsigned int cpu)
processor_pminfo[firstcpu]->perf.domain_info.coord_type) ||
(perf->domain_info.num_processors !=
processor_pminfo[firstcpu]->perf.domain_info.num_processors)) {
+
+ printk(KERN_WARNING "cpufreq fail to add CPU%d:"
+ "incorrect _PSD(%"PRIu64":%"PRIu64"), "
+ "expect(%"PRIu64"/%"PRIu64")\n",
+ cpu, perf->domain_info.coord_type,
+ perf->domain_info.num_processors,
+ processor_pminfo[firstcpu]->perf.domain_info.coord_type,
+ processor_pminfo[firstcpu]->perf.domain_info.num_processors
+ );
return -EINVAL;
}
}
@@ -193,6 +202,7 @@ int cpufreq_add_cpu(unsigned int cpu)
ret = cpufreq_driver->init(policy);
if (ret) {
xfree(policy);
+ cpufreq_cpu_policy[cpu] = NULL;
return ret;
}
printk(KERN_EMERG"CPU %u initialization completed\n", cpu);
diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c b/xen/drivers/cpufreq/cpufreq_ondemand.c
index c30e8346db..e85bcdf45d 100644
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c
@@ -286,6 +286,12 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy, unsigned int event)
break;
case CPUFREQ_GOV_LIMITS:
+ if ( this_dbs_info->cur_policy == NULL )
+ {
+ printk(KERN_WARNING "CPU%d ondemand governor not started yet,"
+ "unable to GOV_LIMIT\n", cpu);
+ return -EINVAL;
+ }
if (policy->max < this_dbs_info->cur_policy->cur)
__cpufreq_driver_target(this_dbs_info->cur_policy,
policy->max, CPUFREQ_RELATION_H);