|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v3 1/3] xen/spinlocks: spin_trylock with interrupts off is always fine
Hi Juergen, On 04/11/2020 08:15, Juergen Gross wrote: Even if a spinlock was taken with interrupts on before calling spin_trylock() with interrupts off is fine, as it can't block. Add a bool parameter "try" to check_lock() for handling this case. Remove the call of check_lock() from _spin_is_locked(), as it really serves no purpose and it can even lead to false crashes, e.g. when a lock was taken correctly with interrupts enabled and the call of _spin_is_locked() happened with interrupts off. In case the lock is taken with wrong interrupt flags this will be catched when taking the lock. Signed-off-by: Juergen Gross <jgross@xxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> Acked-by: Julien Grall <jgrall@xxxxxxxxxx> Cheers, --- V2: - corrected comment (Jan Beulich) --- xen/common/spinlock.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c index ce3106e2d3..b4aaf6bce6 100644 --- a/xen/common/spinlock.c +++ b/xen/common/spinlock.c @@ -13,7 +13,7 @@static atomic_t spin_debug __read_mostly = ATOMIC_INIT(0); -static void check_lock(union lock_debug *debug) -- Julien Grall
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |