]> Git Repo - linux.git/commit
xen: fix race in xen_qlock_wait()
authorJuergen Gross <[email protected]>
Mon, 1 Oct 2018 05:57:42 +0000 (07:57 +0200)
committerJuergen Gross <[email protected]>
Wed, 24 Oct 2018 08:17:38 +0000 (10:17 +0200)
commit2ac2a7d4d9ff4e01e36f9c3d116582f6f655ab47
treed28c742b57503c1118c87dc79f66515a2e38f010
parentaf320de90ec864bb78fdbc9c0c3e99f28d1aab0f
xen: fix race in xen_qlock_wait()

In the following situation a vcpu waiting for a lock might not be
woken up from xen_poll_irq():

CPU 1:                CPU 2:                      CPU 3:
takes a spinlock
                      tries to get lock
                      -> xen_qlock_wait()
frees the lock
-> xen_qlock_kick(cpu2)
                        -> xen_clear_irq_pending()

takes lock again
                                                  tries to get lock
                                                  -> *lock = _Q_SLOW_VAL
                        -> *lock == _Q_SLOW_VAL ?
                        -> xen_poll_irq()
frees the lock
-> xen_qlock_kick(cpu3)

And cpu 2 will sleep forever.

This can be avoided easily by modifying xen_qlock_wait() to call
xen_poll_irq() only if the related irq was not pending and to call
xen_clear_irq_pending() only if it was pending.

Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Juergen Gross <[email protected]>
Reviewed-by: Jan Beulich <[email protected]>
Signed-off-by: Juergen Gross <[email protected]>
arch/x86/xen/spinlock.c
This page took 0.07638 seconds and 4 git commands to generate.