Jelajahi Sumber

softirqs, debug: preemption check

if a preempt count leaks out of a softirq handler it can be very hard
to figure it out. Add a debug check for this.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Thomas Gleixner 16 tahun lalu
induk
melakukan
8e85b4b553
1 mengubah file dengan 11 tambahan dan 0 penghapusan
  1. 11 0
      kernel/softirq.c

+ 11 - 0
kernel/softirq.c

@@ -205,7 +205,18 @@ restart:
 
 
 	do {
 	do {
 		if (pending & 1) {
 		if (pending & 1) {
+			int prev_count = preempt_count();
+
 			h->action(h);
 			h->action(h);
+
+			if (unlikely(prev_count != preempt_count())) {
+				printk(KERN_ERR "huh, entered sotfirq %ld %p"
+				       "with preempt_count %08x,"
+				       " exited with %08x?\n", h - softirq_vec,
+				       h->action, prev_count, preempt_count());
+				preempt_count() = prev_count;
+			}
+
 			rcu_bh_qsctr_inc(cpu);
 			rcu_bh_qsctr_inc(cpu);
 		}
 		}
 		h++;
 		h++;