summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorVegard Nossum <vegard.nossum@oracle.com>2016-07-23 09:46:39 +0200
committerMohammed Khajapasha <mkhaja@codeaurora.org>2017-03-30 13:30:38 +0530
commit4748cf2bdee373fba9cec3f1f7e95928ae21c100 (patch)
tree0c31f9caae0b9beff69956ace442c1114610fdc8 /include/linux
parent6f55033ecf068f77136caac2e7c4a7869b3ec2bd (diff)
sched/debug: Make the "Preemption disabled at ..." message more useful
This message is currently really useless since it always prints a value that comes from the printk() we just did, e.g.: BUG: sleeping function called from invalid context at mm/slab.h:388 in_atomic(): 0, irqs_disabled(): 0, pid: 31996, name: trinity-c1 Preemption disabled at:[<ffffffff8119db33>] down_trylock+0x13/0x80 BUG: sleeping function called from invalid context at include/linux/freezer.h:56 in_atomic(): 0, irqs_disabled(): 0, pid: 31996, name: trinity-c1 Preemption disabled at:[<ffffffff811aaa37>] console_unlock+0x2f7/0x930 Here, both down_trylock() and console_unlock() is somewhere in the printk() path. We should save the value before calling printk() and use the saved value instead. That immediately reveals the offending callsite: BUG: sleeping function called from invalid context at mm/slab.h:388 in_atomic(): 0, irqs_disabled(): 0, pid: 14971, name: trinity-c2 Preemption disabled at:[<ffffffff819bcd46>] rhashtable_walk_start+0x46/0x150 Bug report: http://marc.info/?l=linux-netdev&m=146925979821849&w=2 Change-Id: I5b08294385a2ac625dbf28d1f18ffd164aedabe0 Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rusty Russel <rusty@rustcorp.com.au> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@kernel.org> [mkhaja@codeaurora.org: Fix trivial merge conflict] Git-commit: d1c6d149cf04d6c7c3c3ebf4b66c82500cbcf6e1 Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git Signed-off-by: Mohammed Khajapasha <mkhaja@codeaurora.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/sched.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 3a7521064fe3..e32cab9fe290 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -3246,6 +3246,15 @@ static inline void cond_resched_rcu(void)
#endif
}
+static inline unsigned long get_preempt_disable_ip(struct task_struct *p)
+{
+#ifdef CONFIG_DEBUG_PREEMPT
+ return p->preempt_disable_ip;
+#else
+ return 0;
+#endif
+}
+
/*
* Does a critical section need to be broken due to another
* task waiting?: (technically does not depend on CONFIG_PREEMPT,