[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] Add cpufreq sanity check


  • To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "Yu, Ke" <ke.yu@xxxxxxxxx>
  • Date: Tue, 9 Mar 2010 14:44:36 +0800
  • Accept-language: en-US
  • Acceptlanguage: en-US
  • Delivery-date: Mon, 08 Mar 2010 22:45:30 -0800
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: Acq/U/V0HMSRq3DiRdil3wSIDFu96A==
  • Thread-topic: [PATCH] Add cpufreq sanity check

this patch fix the bug 1585 
(http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1585)

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@xxxxxxxxx>

diff -r 92f2ee87e501 xen/drivers/cpufreq/cpufreq.c
--- a/xen/drivers/cpufreq/cpufreq.c     Mon Mar 01 16:50:26 2010 +0000
+++ b/xen/drivers/cpufreq/cpufreq.c     Mon Mar 08 17:14:36 2010 +0800
@@ -177,6 +177,14 @@ 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(%d:%d), expect(%d/%d)\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 +201,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 -r 92f2ee87e501 xen/drivers/cpufreq/cpufreq_ondemand.c
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c    Mon Mar 01 16:50:26 2010 +0000
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c    Mon Mar 08 17:14:36 2010 +0800
@@ -286,6 +286,12 @@ int cpufreq_governor_dbs(struct cpufreq_
         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);

Attachment: cpufreq_governor_fix.patch
Description: cpufreq_governor_fix.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.