xen/spinlock: disable spinlock debugging in console_force_unlock()
authorJuergen Gross <jgross@suse.com>
Wed, 8 Jan 2020 10:43:24 +0000 (11:43 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 8 Jan 2020 18:43:17 +0000 (18:43 +0000)
console_force_unlock() might result in subsequent ASSERT() triggering
when CONFIG_DEBUG_LOCKS was active. Avoid that by calling
spin_debug_disable() in console_force_unlock() and make the spinlock
debug assertions trigger only if spin_debug was active.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/common/spinlock.c
xen/drivers/char/console.c

index ed69f0a4d2c1e829debda8b211332de8b72c496e..286f916bca598a73038862ece56789a50a016823 100644 (file)
@@ -85,7 +85,8 @@ static void got_lock(union lock_debug *debug)
 
 static void rel_lock(union lock_debug *debug)
 {
-    ASSERT(debug->cpu == smp_processor_id());
+    if ( atomic_read(&spin_debug) > 0 )
+        ASSERT(debug->cpu == smp_processor_id());
     debug->cpu = SPINLOCK_NO_CPU;
 }
 
index b31d789a5d040b80ec39242fc0edf1555199a80b..4bcbbfa7d62f65d5168d6dcc165b88f25ec04798 100644 (file)
@@ -1077,6 +1077,7 @@ void console_unlock_recursive_irqrestore(unsigned long flags)
 void console_force_unlock(void)
 {
     watchdog_disable();
+    spin_debug_disable();
     spin_lock_init(&console_lock);
     serial_force_unlock(sercon_handle);
     console_locks_busted = 1;