[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xen: Introduce ASSERT_NOT_IN_ATOMIC() to give more info on in_atomic() crash.


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Wed, 16 Jan 2013 08:22:27 +0000
  • Delivery-date: Wed, 16 Jan 2013 08:23:57 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1358182042 0
# Node ID 21a2ecc7318344ffe6e73018c6230292496bb6b7
# Parent  f6a81b41ad710464f255fb6e75f569c71f58045e
xen: Introduce ASSERT_NOT_IN_ATOMIC() to give more info on in_atomic() crash.

Signed-off-by: Keir Fraser <keir@xxxxxxx>
---


diff -r f6a81b41ad71 -r 21a2ecc73183 xen/common/preempt.c
--- a/xen/common/preempt.c      Mon Jan 14 14:06:05 2013 +0000
+++ b/xen/common/preempt.c      Mon Jan 14 16:47:22 2013 +0000
@@ -31,8 +31,11 @@ bool_t in_atomic(void)
     return preempt_count() || in_irq() || !local_irq_is_enabled();
 }
 
-/* asm helper */
-void bug_if_in_atomic(void)
+#ifndef NDEBUG
+void ASSERT_NOT_IN_ATOMIC(void)
 {
-    BUG_ON(in_atomic());
+    ASSERT(!preempt_count());
+    ASSERT(!in_irq());
+    ASSERT(local_irq_is_enabled());
 }
+#endif
diff -r f6a81b41ad71 -r 21a2ecc73183 xen/common/schedule.c
--- a/xen/common/schedule.c     Mon Jan 14 14:06:05 2013 +0000
+++ b/xen/common/schedule.c     Mon Jan 14 16:47:22 2013 +0000
@@ -1086,7 +1086,7 @@ static void schedule(void)
     struct task_slice     next_slice;
     int cpu = smp_processor_id();
 
-    ASSERT(!in_atomic());
+    ASSERT_NOT_IN_ATOMIC();
 
     SCHED_STAT_CRANK(sched_run);
 
diff -r f6a81b41ad71 -r 21a2ecc73183 xen/common/softirq.c
--- a/xen/common/softirq.c      Mon Jan 14 14:06:05 2013 +0000
+++ b/xen/common/softirq.c      Mon Jan 14 16:47:22 2013 +0000
@@ -58,7 +58,7 @@ void process_pending_softirqs(void)
 
 asmlinkage void do_softirq(void)
 {
-    ASSERT(!in_atomic());
+    ASSERT_NOT_IN_ATOMIC();
     __do_softirq(0);
 }
 
diff -r f6a81b41ad71 -r 21a2ecc73183 xen/common/wait.c
--- a/xen/common/wait.c Mon Jan 14 14:06:05 2013 +0000
+++ b/xen/common/wait.c Mon Jan 14 16:47:22 2013 +0000
@@ -211,7 +211,7 @@ void prepare_to_wait(struct waitqueue_he
     struct vcpu *curr = current;
     struct waitqueue_vcpu *wqv = curr->waitqueue_vcpu;
 
-    ASSERT(!in_atomic());
+    ASSERT_NOT_IN_ATOMIC();
     __prepare_to_wait(wqv);
 
     ASSERT(list_empty(&wqv->list));
diff -r f6a81b41ad71 -r 21a2ecc73183 xen/include/asm-x86/asm_defns.h
--- a/xen/include/asm-x86/asm_defns.h   Mon Jan 14 14:06:05 2013 +0000
+++ b/xen/include/asm-x86/asm_defns.h   Mon Jan 14 16:47:22 2013 +0000
@@ -62,7 +62,7 @@ void ret_from_intr(void);
 #ifndef NDEBUG
 #define ASSERT_NOT_IN_ATOMIC                                             \
     sti; /* sometimes called with interrupts disabled: safe to enable */ \
-    call bug_if_in_atomic
+    call ASSERT_NOT_IN_ATOMIC
 #else
 #define ASSERT_NOT_IN_ATOMIC
 #endif
diff -r f6a81b41ad71 -r 21a2ecc73183 xen/include/xen/preempt.h
--- a/xen/include/xen/preempt.h Mon Jan 14 14:06:05 2013 +0000
+++ b/xen/include/xen/preempt.h Mon Jan 14 16:47:22 2013 +0000
@@ -28,4 +28,10 @@ DECLARE_PER_CPU(unsigned int, __preempt_
 
 bool_t in_atomic(void);
 
+#ifndef NDEBUG
+void ASSERT_NOT_IN_ATOMIC(void);
+#else
+#define ASSERT_NOT_IN_ATOMIC() ((void)0)
+#endif
+
 #endif /* __XEN_PREEMPT_H__ */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.