mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>, Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH 3/4] tracing: fix recursive test level calculation
Date: Mon, 20 Apr 2009 13:38:22 -0400	[thread overview]
Message-ID: <20090420174017.997451662@goodmis.org> (raw)
In-Reply-To: <20090420173819.957332585@goodmis.org>

[-- Attachment #1: 0003-tracing-fix-recursive-test-level-calculation.patch --]
[-- Type: text/plain, Size: 1023 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

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

-- 

  parent reply	other threads:[~2009-04-20 17:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-20 17:38 [PATCH 0/4] [GIT PULL] tracing: recursion and compile fixes Steven Rostedt
2009-04-20 17:38 ` [PATCH 1/4] tracing/events: call the correct event trace selftest init function Steven Rostedt
2009-04-20 17:38 ` [PATCH 2/4] tracing: remove dangling semicolon Steven Rostedt
2009-04-20 17:38 ` Steven Rostedt [this message]
2009-04-20 19:30   ` [PATCH 3/4] tracing: fix recursive test level calculation Andrew Morton
2009-04-20 17:38 ` [PATCH 4/4] tracing: remove recursive test from ring_buffer_event_discard Steven Rostedt
2009-04-20 17:55 ` [PATCH 0/4] [GIT PULL] tracing: recursion and compile fixes Ingo Molnar
2009-04-20 19:28   ` Ingo Molnar
2009-04-20 19:45     ` Frederic Weisbecker
2009-04-20 19:53       ` Steven Rostedt
2009-04-20 20:17       ` Steven Rostedt
2009-04-20 20:33         ` Frederic Weisbecker
2009-04-20 20:44           ` Steven Rostedt
2009-04-20 21:01             ` Frederic Weisbecker
2009-04-20 21:14               ` Steven Rostedt
2009-04-20 21:25                 ` Frederic Weisbecker
2009-04-20 19:29   ` Ingo Molnar
2009-04-20 19:43     ` Steven Rostedt
2009-04-20 19:48       ` Frederic Weisbecker
2009-04-20 19:55       ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090420174017.997451662@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome