aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Dunlap <george.dunlap@eu.citrix.com>2012-07-09 10:24:44 +0100
committerGeorge Dunlap <george.dunlap@eu.citrix.com>2012-07-09 10:24:44 +0100
commit4e8f99fc6e93baff90fcff4993cc40f4be77b2df (patch)
tree991da118ed42d6e7ae96010e7d52a27c7aae7585
parentc279f333a7716b1b4e9f21beedaada751be1f2d5 (diff)
downloadxen-4e8f99fc6e93baff90fcff4993cc40f4be77b2df.tar.gz
xen-4e8f99fc6e93baff90fcff4993cc40f4be77b2df.tar.bz2
xen-4e8f99fc6e93baff90fcff4993cc40f4be77b2df.zip
xen: Fix schedule()'s grabbing of the schedule lock
Because the location of the lock can change between the time you read it and the time you grab it, the per-cpu schedule locks need to check after lock acquisition that the lock location hasn't changed, and release and re-try if so. This change was effected throughout the source code, but one very important place was apparently missed: in schedule() itself. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Committed-by: Keir Fraser <keir@xen.org> xen-unstable changeset: 25162:478bec603d3d xen-unstable date: Tue Apr 10 10:41:30 2012 +0100
-rw-r--r--xen/common/schedule.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 1ed1bbb4ad..e06e44e690 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -1122,6 +1122,7 @@ static void schedule(void)
bool_t tasklet_work_scheduled = 0;
struct schedule_data *sd;
struct task_slice next_slice;
+ int cpu = smp_processor_id();
ASSERT(!in_atomic());
@@ -1146,7 +1147,7 @@ static void schedule(void)
BUG();
}
- spin_lock_irq(sd->schedule_lock);
+ pcpu_schedule_lock_irq(cpu);
stop_timer(&sd->s_timer);
@@ -1163,7 +1164,7 @@ static void schedule(void)
if ( unlikely(prev == next) )
{
- spin_unlock_irq(sd->schedule_lock);
+ pcpu_schedule_unlock_irq(cpu);
trace_continue_running(next);
return continue_running(prev);
}
@@ -1201,7 +1202,7 @@ static void schedule(void)
ASSERT(!next->is_running);
next->is_running = 1;
- spin_unlock_irq(sd->schedule_lock);
+ pcpu_schedule_unlock_irq(cpu);
perfc_incr(sched_ctx);