WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] RE: [PATCH]CPUFREQ: Fix two racing issues during cpu hotplug
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
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C7E88368.105A2%keir.fraser@xxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <E6467867A6B05E4FA831B7DF29925F5C40F16BEE@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> <C7E88368.105A2%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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