xcp-1.6-updates/xen-4.1.hg

changeset 23317:c1f43d07dc1e

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
author George Dunlap <george.dunlap@eu.citrix.com>
date Mon Jul 09 10:24:44 2012 +0100 (2012-07-09)
parents 01366a324587
children 1d437f7fb15d
files xen/common/schedule.c
line diff
     1.1 --- a/xen/common/schedule.c	Mon Jul 09 10:23:57 2012 +0100
     1.2 +++ b/xen/common/schedule.c	Mon Jul 09 10:24:44 2012 +0100
     1.3 @@ -1122,6 +1122,7 @@ static void schedule(void)
     1.4      bool_t                tasklet_work_scheduled = 0;
     1.5      struct schedule_data *sd;
     1.6      struct task_slice     next_slice;
     1.7 +    int cpu = smp_processor_id();
     1.8  
     1.9      ASSERT(!in_atomic());
    1.10  
    1.11 @@ -1146,7 +1147,7 @@ static void schedule(void)
    1.12          BUG();
    1.13      }
    1.14  
    1.15 -    spin_lock_irq(sd->schedule_lock);
    1.16 +    pcpu_schedule_lock_irq(cpu);
    1.17  
    1.18      stop_timer(&sd->s_timer);
    1.19      
    1.20 @@ -1163,7 +1164,7 @@ static void schedule(void)
    1.21  
    1.22      if ( unlikely(prev == next) )
    1.23      {
    1.24 -        spin_unlock_irq(sd->schedule_lock);
    1.25 +        pcpu_schedule_unlock_irq(cpu);
    1.26          trace_continue_running(next);
    1.27          return continue_running(prev);
    1.28      }
    1.29 @@ -1201,7 +1202,7 @@ static void schedule(void)
    1.30      ASSERT(!next->is_running);
    1.31      next->is_running = 1;
    1.32  
    1.33 -    spin_unlock_irq(sd->schedule_lock);
    1.34 +    pcpu_schedule_unlock_irq(cpu);
    1.35  
    1.36      perfc_incr(sched_ctx);
    1.37