diff mbox

xen: sched: fix spinlock issue in schedule_cpu_switch().

Message ID 20160411162701.19274.72053.stgit@Solace.fritz.box (mailing list archive)
State New, archived
Headers show

Commit Message

Dario Faggioli April 11, 2016, 4:27 p.m. UTC
Commit 94734ab7c3f5 ("xen: sched: close potential races
when switching scheduler to CPUs") buggily replaced a call
to pcpu_schedule_lock_irq() with just pcpu_schedule_lock(),
causing the relevant irq_safe vs. non-irq_safe ASSERT()
in check_lock() to trigger.

Fix that.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
---
Cc: George Dunlap <george.dunlap@citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Aaron Cornelius <aaron.cornelius@dornerworks.com>
---
 xen/common/schedule.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

George Dunlap April 11, 2016, 4:38 p.m. UTC | #1
On 11/04/16 17:27, Dario Faggioli wrote:
> Commit 94734ab7c3f5 ("xen: sched: close potential races
> when switching scheduler to CPUs") buggily replaced a call
> to pcpu_schedule_lock_irq() with just pcpu_schedule_lock(),
> causing the relevant irq_safe vs. non-irq_safe ASSERT()
> in check_lock() to trigger.
> 
> Fix that.
> 
> Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>

Acked-by: George Dunlap <george.dunlap@citrix.com>

> ---
> Cc: George Dunlap <george.dunlap@citrix.com>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> Cc: Aaron Cornelius <aaron.cornelius@dornerworks.com>
> ---
>  xen/common/schedule.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/xen/common/schedule.c b/xen/common/schedule.c
> index 922b035..013e5f1 100644
> --- a/xen/common/schedule.c
> +++ b/xen/common/schedule.c
> @@ -1702,7 +1702,7 @@ int schedule_cpu_switch(unsigned int cpu, struct cpupool *c)
>       * that the lock itself changed, and retry acquiring the new one (which
>       * will be the correct, remapped one, at that point).
>       */
> -    old_lock = pcpu_schedule_lock(cpu);
> +    old_lock = pcpu_schedule_lock_irq(cpu);
>  
>      vpriv_old = idle->sched_priv;
>      ppriv_old = per_cpu(schedule_data, cpu).sched_priv;
>
Dario Faggioli April 11, 2016, 4:59 p.m. UTC | #2
On Mon, 2016-04-11 at 17:38 +0100, George Dunlap wrote:
> On 11/04/16 17:27, Dario Faggioli wrote:
> > 
> > Commit 94734ab7c3f5 ("xen: sched: close potential races
> > when switching scheduler to CPUs") buggily replaced a call
> > to pcpu_schedule_lock_irq() with just pcpu_schedule_lock(),
> > causing the relevant irq_safe vs. non-irq_safe ASSERT()
> > in check_lock() to trigger.
> > 
> > Fix that.
> > 
> > Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
> Acked-by: George Dunlap <george.dunlap@citrix.com>
> 
Thanks George.

Sorry again for the issue, and sorry if it did take longer.

I said "Monday morning", but this morning my test box was otherwise
busy, and this time, I really wanted to make sure I tested this on a
debug build! :-P

Dario
Konrad Rzeszutek Wilk April 11, 2016, 5:09 p.m. UTC | #3
On Mon, Apr 11, 2016 at 06:59:23PM +0200, Dario Faggioli wrote:
> On Mon, 2016-04-11 at 17:38 +0100, George Dunlap wrote:
> > On 11/04/16 17:27, Dario Faggioli wrote:
> > > 
> > > Commit 94734ab7c3f5 ("xen: sched: close potential races
> > > when switching scheduler to CPUs") buggily replaced a call
> > > to pcpu_schedule_lock_irq() with just pcpu_schedule_lock(),
> > > causing the relevant irq_safe vs. non-irq_safe ASSERT()
> > > in check_lock() to trigger.
> > > 
> > > Fix that.
> > > 
> > > Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
> > Acked-by: George Dunlap <george.dunlap@citrix.com>
> > 
> Thanks George.

And applied.
diff mbox

Patch

diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 922b035..013e5f1 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -1702,7 +1702,7 @@  int schedule_cpu_switch(unsigned int cpu, struct cpupool *c)
      * that the lock itself changed, and retry acquiring the new one (which
      * will be the correct, remapped one, at that point).
      */
-    old_lock = pcpu_schedule_lock(cpu);
+    old_lock = pcpu_schedule_lock_irq(cpu);
 
     vpriv_old = idle->sched_priv;
     ppriv_old = per_cpu(schedule_data, cpu).sched_priv;