[xen master] common/spinlock: Improve the output from check_lock() if it trips

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen master] common/spinlock: Improve the output from check_lock() if it trips

patchbot
commit a79d4503e48739b48533737de6978397d8b3e69e
Author:     Andrew Cooper <[hidden email]>
AuthorDate: Mon Oct 30 17:42:52 2017 +0000
Commit:     Andrew Cooper <[hidden email]>
CommitDate: Thu Nov 2 16:49:57 2017 +0000

    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 <[hidden email]>
    Reviewed-by: Wei Liu <[hidden email]>
    Reviewed-by: George Dunlap <[hidden email]>
    Release-acked-by: Julien Grall <[hidden email]>
---
 xen/common/spinlock.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
index 44b07b7..8f2ba08 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();
+        }
     }
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog