Commit 4fe8c304 authored by Steven Rostedt's avatar Steven Rostedt Committed by Thomas Gleixner

ftrace: printk and trace irqsoff and wakeups

printk called from wakeup critical timings and irqs off can
cause deadlocks since printk might do a wakeup itself. If the
call to printk happens with the runqueue lock held, it can
deadlock.

This patch protects the printk from being called in trace irqs off
with a test to see if the runqueue for the current CPU is locked.
If it is locked, the printk is skipped.

The wakeup always holds the runqueue lock, so the printk is
simply removed.
Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 8f96da02
...@@ -165,18 +165,20 @@ check_critical_timing(struct trace_array *tr, ...@@ -165,18 +165,20 @@ check_critical_timing(struct trace_array *tr,
update_max_tr_single(tr, current, cpu); update_max_tr_single(tr, current, cpu);
if (tracing_thresh) { if (!runqueue_is_locked()) {
printk(KERN_INFO "(%16s-%-5d|#%d):" if (tracing_thresh) {
" %lu us critical section violates %lu us threshold.\n", printk(KERN_INFO "(%16s-%-5d|#%d): %lu us critical"
current->comm, current->pid, " section violates %lu us threshold.\n",
raw_smp_processor_id(), current->comm, current->pid,
latency, nsecs_to_usecs(tracing_thresh)); raw_smp_processor_id(),
} else { latency, nsecs_to_usecs(tracing_thresh));
printk(KERN_INFO "(%16s-%-5d|#%d):" } else {
" new %lu us maximum-latency critical section.\n", printk(KERN_INFO "(%16s-%-5d|#%d): new %lu us"
current->comm, current->pid, " maximum-latency critical section.\n",
raw_smp_processor_id(), current->comm, current->pid,
latency); raw_smp_processor_id(),
latency);
}
} }
max_sequence++; max_sequence++;
......
...@@ -106,19 +106,6 @@ wakeup_sched_switch(struct task_struct *prev, struct task_struct *next) ...@@ -106,19 +106,6 @@ wakeup_sched_switch(struct task_struct *prev, struct task_struct *next)
update_max_tr(tr, wakeup_task, wakeup_cpu); update_max_tr(tr, wakeup_task, wakeup_cpu);
if (tracing_thresh) {
printk(KERN_INFO "(%16s-%-5d|#%d):"
" %lu us wakeup latency violates %lu us threshold.\n",
wakeup_task->comm, wakeup_task->pid,
raw_smp_processor_id(),
latency, nsecs_to_usecs(tracing_thresh));
} else {
printk(KERN_INFO "(%16s-%-5d|#%d):"
" new %lu us maximum wakeup latency.\n",
wakeup_task->comm, wakeup_task->pid,
cpu, latency);
}
out_unlock: out_unlock:
__wakeup_reset(tr); __wakeup_reset(tr);
spin_unlock_irqrestore(&wakeup_lock, flags); spin_unlock_irqrestore(&wakeup_lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment