Skip to content

Commit

Permalink
ring-buffer: Fix duplicate results in mapping context to bits in recu…
Browse files Browse the repository at this point in the history
…rsive lock

In bringing back the context checks, the code checks first if its normal
(non-interrupt) context, and then for NMI then IRQ then softirq. The final
check is redundant. Since the if branch is only hit if the context is one of
NMI, IRQ, or SOFTIRQ, if it's not NMI or IRQ there's no reason to check if
it is SOFTIRQ. The current code returns the same result even if its not a
SOFTIRQ. Which is confusing.

  pc & SOFTIRQ_OFFSET ? 2 : RB_CTX_SOFTIRQ

Is redundant as RB_CTX_SOFTIRQ *is* 2!

Fixes: a0e3a18 ("ring-buffer: Bring back context level recursive checks")
Signed-off-by: Steven Rostedt (VMware) <[email protected]>
rostedt committed Jan 18, 2018
1 parent 68e76e0 commit 0164e0d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions kernel/trace/ring_buffer.c
Original file line number Diff line number Diff line change
@@ -2579,8 +2579,7 @@ trace_recursive_lock(struct ring_buffer_per_cpu *cpu_buffer)
bit = RB_CTX_NORMAL;
else
bit = pc & NMI_MASK ? RB_CTX_NMI :
pc & HARDIRQ_MASK ? RB_CTX_IRQ :
pc & SOFTIRQ_OFFSET ? 2 : RB_CTX_SOFTIRQ;
pc & HARDIRQ_MASK ? RB_CTX_IRQ : RB_CTX_SOFTIRQ;

if (unlikely(val & (1 << bit)))
return 1;

0 comments on commit 0164e0d

Please sign in to comment.