linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Petr Mladek <pmladek@suse.com>
Cc: 王贇 <yun.wang@linux.alibaba.com>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	"Paul Walmsley" <paul.walmsley@sifive.com>,
	"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
	"Paul Mackerras" <paulus@samba.org>,
	"Jisheng Zhang" <jszhang@kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	live-patching@vger.kernel.org, linux-riscv@lists.infradead.org,
	"Miroslav Benes" <mbenes@suse.cz>,
	"Joe Lawrence" <joe.lawrence@redhat.com>,
	"Helge Deller" <deller@gmx.de>,
	x86@kernel.org, linux-csky@vger.kernel.org,
	"Ingo Molnar" <mingo@redhat.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	"Jiri Kosina" <jikos@kernel.org>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Borislav Petkov" <bp@alien8.de>,
	"Josh Poimboeuf" <jpoimboe@redhat.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	linux-parisc@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Masami Hiramatsu" <mhiramat@kernel.org>,
	"Guo Ren" <guoren@kernel.org>,
	"Colin Ian King" <colin.king@canonical.com>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] tracing: Have all levels of checks prevent recursion
Date: Mon, 18 Oct 2021 22:02:03 -0400	[thread overview]
Message-ID: <20211018220203.064a42ed@gandalf.local.home> (raw)
In-Reply-To: <YW1KKCFallDG+E01@alley>

On Mon, 18 Oct 2021 12:19:20 +0200
Petr Mladek <pmladek@suse.com> wrote:

> > -
> >  	bit = trace_get_context_bit() + start;
> >  	if (unlikely(val & (1 << bit))) {
> >  		/*
> >  		 * It could be that preempt_count has not been updated during
> >  		 * a switch between contexts. Allow for a single recursion.
> >  		 */
> > -		bit = TRACE_TRANSITION_BIT;
> > +		bit = TRACE_CTX_TRANSITION + start;  
>

[..]

> Could we please update the comment? I mean to say if it is a race
> or if we trace a function that should not get traced.

What do you think of this change?

diff --git a/include/linux/trace_recursion.h b/include/linux/trace_recursion.h
index 1d8cce02c3fb..24f284eb55a7 100644
--- a/include/linux/trace_recursion.h
+++ b/include/linux/trace_recursion.h
@@ -168,8 +168,12 @@ static __always_inline int trace_test_and_set_recursion(unsigned long ip, unsign
 	bit = trace_get_context_bit() + start;
 	if (unlikely(val & (1 << bit))) {
 		/*
-		 * It could be that preempt_count has not been updated during
-		 * a switch between contexts. Allow for a single recursion.
+		 * If an interrupt occurs during a trace, and another trace
+		 * happens in that interrupt but before the preempt_count is
+		 * updated to reflect the new interrupt context, then this
+		 * will think a recursion occurred, and the event will be dropped.
+		 * Let a single instance happen via the TRANSITION_BIT to
+		 * not drop those events.
 		 */
 		bit = TRACE_TRANSITION_BIT;
 		if (val & (1 << bit)) {


-- Steve

  parent reply	other threads:[~2021-10-19  2:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-15 15:00 [PATCH] tracing: Have all levels of checks prevent recursion Steven Rostedt
2021-10-15 16:17 ` Peter Zijlstra
2021-10-15 17:35   ` Steven Rostedt
2021-10-15 17:58     ` Steven Rostedt
2021-10-15 18:04       ` Peter Zijlstra
2021-10-15 18:20         ` Steven Rostedt
2021-10-15 18:24           ` Peter Zijlstra
2021-10-15 19:00             ` Steven Rostedt
2021-10-15 18:25           ` Steven Rostedt
2023-07-21 15:34             ` Alexander Lobakin
2023-07-21 16:00               ` Steven Rostedt
2023-07-21 16:06                 ` Alexander Lobakin
2023-07-21 16:26                   ` Steven Rostedt
2023-07-22  1:22                     ` Jakub Kicinski
2021-10-18 10:19 ` Petr Mladek
2021-10-18 13:50   ` Steven Rostedt
2021-10-18 15:09     ` Petr Mladek
2021-10-19  2:02   ` Steven Rostedt [this message]
2021-10-19  6:41     ` Petr Mladek
2021-10-19 13:00       ` 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=20211018220203.064a42ed@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=bp@alien8.de \
    --cc=colin.king@canonical.com \
    --cc=deller@gmx.de \
    --cc=guoren@kernel.org \
    --cc=hpa@zytor.com \
    --cc=jikos@kernel.org \
    --cc=joe.lawrence@redhat.com \
    --cc=jpoimboe@redhat.com \
    --cc=jszhang@kernel.org \
    --cc=linux-csky@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=npiggin@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yun.wang@linux.alibaba.com \
    /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;
as well as URLs for NNTP newsgroup(s).