]> xenbits.xensource.com Git - people/aperard/xen-arm.git/commitdiff
xen: Introduce ASSERT_NOT_IN_ATOMIC() to give more info on in_atomic() crash.
authorKeir Fraser <keir@xen.org>
Mon, 14 Jan 2013 16:47:22 +0000 (16:47 +0000)
committerKeir Fraser <keir@xen.org>
Mon, 14 Jan 2013 16:47:22 +0000 (16:47 +0000)
Signed-off-by: Keir Fraser <keir@xen.org>
xen/common/preempt.c
xen/common/schedule.c
xen/common/softirq.c
xen/common/wait.c
xen/include/asm-x86/asm_defns.h
xen/include/xen/preempt.h

index 38f73b023e51fa0b9f6a4f4f401a15eb189e82b7..ec50dae22442eb6ef11b657e80dbaca63a9af0a4 100644 (file)
@@ -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
index f3fc6bcc3edafa4b4d28317a0e59cb779621b9ee..e6a90d85feb4579c6743f4fa4f3d99d5da0ef6ed 100644 (file)
@@ -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);
 
index 3f1b3029897bf71dd1e65c78128b2ea710ab996d..ea26825723bdcb35a9cc15e0b4ed03e161bd37c1 100644 (file)
@@ -58,7 +58,7 @@ void process_pending_softirqs(void)
 
 asmlinkage void do_softirq(void)
 {
-    ASSERT(!in_atomic());
+    ASSERT_NOT_IN_ATOMIC();
     __do_softirq(0);
 }
 
index aafeb745101dc2a39df7151569d7acdd77ea5734..4d6924fd27e000af6cc6415fe0507b9ffc829f50 100644 (file)
@@ -211,7 +211,7 @@ void prepare_to_wait(struct waitqueue_head *wq)
     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));
index d167e33593b52bbbf97a694e37210ea6701268a6..81d490559c6e06de291e17235341499cb154a5a5 100644 (file)
@@ -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
index fd02ada12bc1464e81162f73b6f0662cf9159a3d..bef83135a1b8c1d2d0b71ddd231f9136bbbf6514 100644 (file)
@@ -28,4 +28,10 @@ DECLARE_PER_CPU(unsigned int, __preempt_count);
 
 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__ */