summaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_irqsoff.c
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2008-05-12 21:20:54 +0200
committerThomas Gleixner <tglx@linutronix.de>2008-05-23 21:13:02 +0200
commit4fe8c3048cd8280a54256bca9cac2007bd546c33 (patch)
treeb6bba481a3dde79a027654675d3b34da24ca54f2 /kernel/trace/trace_irqsoff.c
parent8f96da02c14d722ad9a3713cd7273ce28c9036ad (diff)
downloadop-kernel-dev-4fe8c3048cd8280a54256bca9cac2007bd546c33.zip
op-kernel-dev-4fe8c3048cd8280a54256bca9cac2007bd546c33.tar.gz
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: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/trace/trace_irqsoff.c')
-rw-r--r--kernel/trace/trace_irqsoff.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c
index 7a4dc01..d0c1748 100644
--- a/kernel/trace/trace_irqsoff.c
+++ b/kernel/trace/trace_irqsoff.c
@@ -165,18 +165,20 @@ check_critical_timing(struct trace_array *tr,
update_max_tr_single(tr, current, cpu);
- if (tracing_thresh) {
- printk(KERN_INFO "(%16s-%-5d|#%d):"
- " %lu us critical section violates %lu us threshold.\n",
- current->comm, current->pid,
- raw_smp_processor_id(),
- latency, nsecs_to_usecs(tracing_thresh));
- } else {
- printk(KERN_INFO "(%16s-%-5d|#%d):"
- " new %lu us maximum-latency critical section.\n",
- current->comm, current->pid,
- raw_smp_processor_id(),
- latency);
+ if (!runqueue_is_locked()) {
+ if (tracing_thresh) {
+ printk(KERN_INFO "(%16s-%-5d|#%d): %lu us critical"
+ " section violates %lu us threshold.\n",
+ current->comm, current->pid,
+ raw_smp_processor_id(),
+ latency, nsecs_to_usecs(tracing_thresh));
+ } else {
+ printk(KERN_INFO "(%16s-%-5d|#%d): new %lu us"
+ " maximum-latency critical section.\n",
+ current->comm, current->pid,
+ raw_smp_processor_id(),
+ latency);
+ }
}
max_sequence++;
OpenPOWER on IntegriCloud