From: Andrew Cooper Date: Mon, 30 Oct 2017 17:42:52 +0000 (+0000) Subject: common/spinlock: Improve the output from check_lock() if it trips X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~1045^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a79d4503e48739b48533737de6978397d8b3e69e;p=xen.git common/spinlock: Improve the output from check_lock() if it trips 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 Reviewed-by: Wei Liu Reviewed-by: George Dunlap Release-acked-by: Julien Grall --- diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c index 44b07b7f1c..8f2ba0818c 100644 --- a/xen/common/spinlock.c +++ b/xen/common/spinlock.c @@ -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(); + } } }