diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2014-02-07 14:58:39 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-02-22 12:08:08 -0500 |
commit | 8f47b1871b8aac98f1a9d93bc3467fb97b65199a (patch) | |
tree | 0eebff7b82d2cfa93a728a363d0bd4019356d9cf /kernel/sched/core.c | |
parent | db273be2a7d42f92b3471e0f717982928214a650 (diff) |
sched: Add better debug output for might_sleep()
might_sleep() can tell us where interrupts have been disabled, but we
have no idea what disabled preemption. Add some debug infrastructure.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1391803122-4425-4-git-send-email-bigeasy@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched/core.c')
-rw-r--r-- | kernel/sched/core.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index a01fe6cfdb9b..c94e851dc981 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -2501,8 +2501,13 @@ void __kprobes preempt_count_add(int val) | |||
2501 | DEBUG_LOCKS_WARN_ON((preempt_count() & PREEMPT_MASK) >= | 2501 | DEBUG_LOCKS_WARN_ON((preempt_count() & PREEMPT_MASK) >= |
2502 | PREEMPT_MASK - 10); | 2502 | PREEMPT_MASK - 10); |
2503 | #endif | 2503 | #endif |
2504 | if (preempt_count() == val) | 2504 | if (preempt_count() == val) { |
2505 | trace_preempt_off(CALLER_ADDR0, get_parent_ip(CALLER_ADDR1)); | 2505 | unsigned long ip = get_parent_ip(CALLER_ADDR1); |
2506 | #ifdef CONFIG_DEBUG_PREEMPT | ||
2507 | current->preempt_disable_ip = ip; | ||
2508 | #endif | ||
2509 | trace_preempt_off(CALLER_ADDR0, ip); | ||
2510 | } | ||
2506 | } | 2511 | } |
2507 | EXPORT_SYMBOL(preempt_count_add); | 2512 | EXPORT_SYMBOL(preempt_count_add); |
2508 | 2513 | ||
@@ -2545,6 +2550,13 @@ static noinline void __schedule_bug(struct task_struct *prev) | |||
2545 | print_modules(); | 2550 | print_modules(); |
2546 | if (irqs_disabled()) | 2551 | if (irqs_disabled()) |
2547 | print_irqtrace_events(prev); | 2552 | print_irqtrace_events(prev); |
2553 | #ifdef CONFIG_DEBUG_PREEMPT | ||
2554 | if (in_atomic_preempt_off()) { | ||
2555 | pr_err("Preemption disabled at:"); | ||
2556 | print_ip_sym(current->preempt_disable_ip); | ||
2557 | pr_cont("\n"); | ||
2558 | } | ||
2559 | #endif | ||
2548 | dump_stack(); | 2560 | dump_stack(); |
2549 | add_taint(TAINT_WARN, LOCKDEP_STILL_OK); | 2561 | add_taint(TAINT_WARN, LOCKDEP_STILL_OK); |
2550 | } | 2562 | } |
@@ -6946,6 +6958,13 @@ void __might_sleep(const char *file, int line, int preempt_offset) | |||
6946 | debug_show_held_locks(current); | 6958 | debug_show_held_locks(current); |
6947 | if (irqs_disabled()) | 6959 | if (irqs_disabled()) |
6948 | print_irqtrace_events(current); | 6960 | print_irqtrace_events(current); |
6961 | #ifdef CONFIG_DEBUG_PREEMPT | ||
6962 | if (!preempt_count_equals(preempt_offset)) { | ||
6963 | pr_err("Preemption disabled at:"); | ||
6964 | print_ip_sym(current->preempt_disable_ip); | ||
6965 | pr_cont("\n"); | ||
6966 | } | ||
6967 | #endif | ||
6949 | dump_stack(); | 6968 | dump_stack(); |
6950 | } | 6969 | } |
6951 | EXPORT_SYMBOL(__might_sleep); | 6970 | EXPORT_SYMBOL(__might_sleep); |