[PATCH 3/4] tracing: fix recursive test level calculation

From: Steven Rostedt
Date: Mon Apr 20 2009 - 13:41:00 EST


From: Steven Rostedt <srostedt@xxxxxxxxxx>

The recursive tests to detect same level recursion in the ring buffers
did not account for the hard/softirq_counts to be shifted. Thus the
numbers could be larger than then mask to be tested.

This patch includes the shift for the calculation of the irq depth.

[ Impact: stop false positives in trace recursion detection ]

Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
---
kernel/trace/ring_buffer.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index e145969..aa40ae9 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -1483,7 +1483,9 @@ rb_reserve_next_event(struct ring_buffer_per_cpu *cpu_buffer,

static int trace_irq_level(void)
{
- return hardirq_count() + softirq_count() + in_nmi();
+ return (hardirq_count() >> HARDIRQ_SHIFT) +
+ (softirq_count() >> + SOFTIRQ_SHIFT) +
+ !!in_nmi();
}

static int trace_recursive_lock(void)
--
1.6.2.1

--
--
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/