]> xenbits.xensource.com Git - xen.git/commitdiff
common/spinlock: Improve the output from check_lock() if it trips
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 30 Oct 2017 17:42:52 +0000 (17:42 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 2 Nov 2017 16:49:57 +0000 (16:49 +0000)
If check_lock() triggers, a crash will occur.  Instead of simply identifying
"the irq context was different", indicate the expected and current irq
context.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
Release-acked-by: Julien Grall <julien.grall@linaro.org>
xen/common/spinlock.c

index 44b07b7f1c98bbcef4d34dc2263b2e301a9459ba..8f2ba0818c38da9de2cb0c573055c91fd0750a5f 100644 (file)
@@ -44,7 +44,13 @@ static void check_lock(struct lock_debug *debug)
     if ( unlikely(debug->irq_safe != irq_safe) )
     {
         int seen = cmpxchg(&debug->irq_safe, -1, irq_safe);
-        BUG_ON(seen == !irq_safe);
+
+        if ( seen == !irq_safe )
+        {
+            printk("CHECKLOCK FAILURE: prev irqsafe: %d, curr irqsafe %d\n",
+                   seen, irq_safe);
+            BUG();
+        }
     }
 }