[PATCH] ftrace: only trace preempt off with preempt tracer

From: Steven Rostedt
Date: Tue Jul 15 2008 - 09:53:50 EST



When PREEMPT_TRACER and IRQSOFF_TRACER are both configured and irqsoff
tracer is running, the preempt_off sections might also be traced.

Thanks to Andrew Morton for pointing out my mistake of spin_lock disabling
interrupts while he was reviewing ftrace.txt. Seems that my example I used
actually hit this bug.

Signed-off-by: Steven Rostedt <srostedt@xxxxxxxxxx>
---
kernel/trace/trace_irqsoff.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

Index: linus.git/kernel/trace/trace_irqsoff.c
===================================================================
--- linus.git.orig/kernel/trace/trace_irqsoff.c 2008-07-14 23:08:16.000000000 -0400
+++ linus.git/kernel/trace/trace_irqsoff.c 2008-07-15 00:22:59.000000000 -0400
@@ -337,12 +337,14 @@ EXPORT_SYMBOL(trace_hardirqs_off_caller)
#ifdef CONFIG_PREEMPT_TRACER
void trace_preempt_on(unsigned long a0, unsigned long a1)
{
- stop_critical_timing(a0, a1);
+ if (preempt_trace())
+ stop_critical_timing(a0, a1);
}

void trace_preempt_off(unsigned long a0, unsigned long a1)
{
- start_critical_timing(a0, a1);
+ if (preempt_trace())
+ start_critical_timing(a0, a1);
}
#endif /* CONFIG_PREEMPT_TRACER */


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/