diff options
| -rw-r--r-- | arch/x86/xen/spinlock.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c index 23f6793af88a..290a69ec7d4d 100644 --- a/arch/x86/xen/spinlock.c +++ b/arch/x86/xen/spinlock.c | |||
| @@ -45,17 +45,12 @@ static void xen_qlock_wait(u8 *byte, u8 val) | |||
| 45 | if (irq == -1) | 45 | if (irq == -1) |
| 46 | return; | 46 | return; |
| 47 | 47 | ||
| 48 | /* clear pending */ | 48 | /* If irq pending already clear it and return. */ |
| 49 | xen_clear_irq_pending(irq); | 49 | if (xen_test_irq_pending(irq)) { |
| 50 | barrier(); | 50 | xen_clear_irq_pending(irq); |
| 51 | return; | ||
| 52 | } | ||
| 51 | 53 | ||
| 52 | /* | ||
| 53 | * We check the byte value after clearing pending IRQ to make sure | ||
| 54 | * that we won't miss a wakeup event because of the clearing. | ||
| 55 | * | ||
| 56 | * The sync_clear_bit() call in xen_clear_irq_pending() is atomic. | ||
| 57 | * So it is effectively a memory barrier for x86. | ||
| 58 | */ | ||
| 59 | if (READ_ONCE(*byte) != val) | 54 | if (READ_ONCE(*byte) != val) |
| 60 | return; | 55 | return; |
| 61 | 56 | ||
