Skip to content

Commit

Permalink
tracing: fix recursive test level calculation
Browse files Browse the repository at this point in the history
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@goodmis.org>
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed Apr 20, 2009
1 parent 23de29d commit 17487bf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kernel/trace/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 17487bf

Please sign in to comment.