# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1271090027 -3600
# Node ID 5d4038d41fd894f9fc71e64043d559d7c465bd15
# Parent 1d3bec66528900b1b442b6d36f24cd35ca076506
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>
---
xen/drivers/acpi/pmstat.c | 3 ++-
xen/drivers/cpufreq/cpufreq_ondemand.c | 7 +++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff -r 1d3bec665289 -r 5d4038d41fd8 xen/drivers/acpi/pmstat.c
--- a/xen/drivers/acpi/pmstat.c Mon Apr 12 17:30:08 2010 +0100
+++ b/xen/drivers/acpi/pmstat.c Mon Apr 12 17:33:47 2010 +0100
@@ -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 1d3bec665289 -r 5d4038d41fd8 xen/drivers/cpufreq/cpufreq_ondemand.c
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c Mon Apr 12 17:30:08 2010 +0100
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c Mon Apr 12 17:33:47 2010 +0100
@@ -189,9 +189,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);
@@ -206,7 +205,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)
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|