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

[Xen-devel] RE: [PATCH]CPUFREQ: Fix two racing issues during cpu hotplug


  • To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "Wei, Gang" <gang.wei@xxxxxxxxx>
  • Date: Mon, 12 Apr 2010 15:40:32 +0800
  • Accept-language: zh-CN, en-US
  • Acceptlanguage: zh-CN, en-US
  • Cc:
  • Delivery-date: Mon, 12 Apr 2010 00:42:44 -0700
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: AcrZ+wAOQtQIXlCDQjCnYThDbZTKrgAC7vOLAAA2QHAAAYhX3QABQR3g
  • Thread-topic: [PATCH]CPUFREQ: Fix two racing issues during cpu hotplug

Resend.

CPUFREQ: fix racing issue for cpu hotplug

To eliminate racing between dbs timer handler and cpufreq_del_cpu, using 
kill_timer instead of stop_timer to make sure timer handler execution finished 
before other stuff in cpufreq_del_cpu.

BTW, fix a lost point of cpufreq_statistic_lock taking sequence.

Signed-off-by: Wei Gang <gang.wei@xxxxxxxxx>

diff -r 824d35c72a8d xen/drivers/acpi/pmstat.c
--- a/xen/drivers/acpi/pmstat.c Mon Apr 12 15:32:32 2010 +0800
+++ b/xen/drivers/acpi/pmstat.c Mon Apr 12 15:33:00 2010 +0800
@@ -86,12 +86,13 @@ int do_get_pm_info(struct xen_sysctl_get
     case PMSTAT_get_pxstat:
     {
         uint32_t ct;
-        struct pm_px *pxpt = cpufreq_statistic_data[op->cpuid];
+        struct pm_px *pxpt;
         spinlock_t *cpufreq_statistic_lock = 
                    &per_cpu(cpufreq_statistic_lock, op->cpuid);
 
         spin_lock(cpufreq_statistic_lock);
 
+        pxpt = cpufreq_statistic_data[op->cpuid];
         if ( !pxpt || !pxpt->u.pt || !pxpt->u.trans_pt )
         {
             spin_unlock(cpufreq_statistic_lock);
diff -r 824d35c72a8d xen/drivers/cpufreq/cpufreq_ondemand.c
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c    Mon Apr 12 15:32:32 2010 +0800
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c    Mon Apr 12 15:33:17 2010 +0800
@@ -196,9 +196,8 @@ static void dbs_timer_init(struct cpu_db
 {
     dbs_info->enable = 1;
 
-    if ( !dbs_timer[dbs_info->cpu].function )
-        init_timer(&dbs_timer[dbs_info->cpu], do_dbs_timer, 
-            (void *)dbs_info, dbs_info->cpu);
+    init_timer(&dbs_timer[dbs_info->cpu], do_dbs_timer, 
+        (void *)dbs_info, dbs_info->cpu);
 
     set_timer(&dbs_timer[dbs_info->cpu], NOW()+dbs_tuners_ins.sampling_rate);
 
@@ -213,7 +212,7 @@ static void dbs_timer_exit(struct cpu_db
 {
     dbs_info->enable = 0;
     dbs_info->stoppable = 0;
-    stop_timer(&dbs_timer[dbs_info->cpu]);
+    kill_timer(&dbs_timer[dbs_info->cpu]);
 }
 
 int cpufreq_governor_dbs(struct cpufreq_policy *policy, unsigned int event)

Attachment: dbs-timer-fix-v2.patch
Description: dbs-timer-fix-v2.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®.