linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: paulmck@kernel.org, Masami Hiramatsu <mhiramat@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux Trace Kernel <linux-trace-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] tracing: Do not synchronize freeing of trigger filter on boot up
Date: Wed, 14 Dec 2022 15:37:13 -0500	[thread overview]
Message-ID: <f36375fb-fdd2-4be6-3d74-5137533b6264@efficios.com> (raw)
In-Reply-To: <20221214200333.GA3208104@paulmck-ThinkPad-P17-Gen-1>

On 2022-12-14 15:03, Paul E. McKenney wrote:
> On Wed, Dec 14, 2022 at 08:49:54AM +0900, Masami Hiramatsu wrote:
>> On Tue, 13 Dec 2022 17:24:29 -0500
>> Steven Rostedt <rostedt@goodmis.org> wrote:
>>
>>> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
>>>
>>> If a trigger filter on the kernel command line fails to apply (due to
>>> syntax error), it will be freed. The freeing will call
>>> tracepoint_synchronize_unregister(), but this is not needed during early
>>> boot up, and will even trigger a lockdep splat.
>>>
>>> Avoid calling the synchronization function when system_state is
>>> SYSTEM_BOOTING.
>>
>> Shouldn't this be done inside tracepoint_synchronize_unregister()?
>> Then, it will prevent similar warnings if we expand boot time feature.
> 
> How about the following wide-spectrum fix within RCU_LOCKDEP_WARN()?
> Just in case there are ever additional issues of this sort?

Hi Paul,

Your approach makes sense. Thanks for looking into this.

Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

> 
> 							Thanx, Paul
> 
> ------------------------------------------------------------------------
> 
> commit d493ffca2df6c1963bd1d7b8f8c652a172f095ae
> Author: Paul E. McKenney <paulmck@kernel.org>
> Date:   Wed Dec 14 11:41:44 2022 -0800
> 
>      rcu: Make RCU_LOCKDEP_WARN() avoid early lockdep checks
>      
>      Currently, RCU_LOCKDEP_WARN() checks the condition before checking
>      to see if lockdep is still enabled.  This is necessary to avoid the
>      false-positive splats fixed by commit 3066820034b5dd ("rcu: Reject
>      RCU_LOCKDEP_WARN() false positives").  However, the current state can
>      result in false-positive splats during early boot before lockdep is fully
>      initialized.  This commit therefore checks debug_lockdep_rcu_enabled()
>      both before and after checking the condition, thus avoiding both sets
>      of false-positive error reports.
>      
>      Reported-by: Steven Rostedt <rostedt@goodmis.org>
>      Reported-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>      Reported-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>      Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
>      Cc: Boqun Feng <boqun.feng@gmail.com>
>      Cc: Matthew Wilcox <willy@infradead.org>
>      Cc: Thomas Gleixner <tglx@linutronix.de>
> 
> diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> index aa1b1c3546d7a..1aec1d53b0c91 100644
> --- a/include/linux/rcupdate.h
> +++ b/include/linux/rcupdate.h
> @@ -364,11 +364,18 @@ static inline int debug_lockdep_rcu_enabled(void)
>    * RCU_LOCKDEP_WARN - emit lockdep splat if specified condition is met
>    * @c: condition to check
>    * @s: informative message
> + *
> + * This checks debug_lockdep_rcu_enabled() before checking (c) to
> + * prevent early boot splats due to lockdep not yet being initialized,
> + * and rechecks it after checking (c) to prevent false-positive splats
> + * due to races with lockdep being disabled.  See commit 3066820034b5dd
> + * ("rcu: Reject RCU_LOCKDEP_WARN() false positives") for more detail.
>    */
>   #define RCU_LOCKDEP_WARN(c, s)						\
>   	do {								\
>   		static bool __section(".data.unlikely") __warned;	\
> -		if ((c) && debug_lockdep_rcu_enabled() && !__warned) {	\
> +		if (debug_lockdep_rcu_enabled() && (c) &&		\
> +		    debug_lockdep_rcu_enabled() && !__warned) {		\
>   			__warned = true;				\
>   			lockdep_rcu_suspicious(__FILE__, __LINE__, s);	\
>   		}							\

-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com


  reply	other threads:[~2022-12-14 20:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-13 22:24 [PATCH] tracing: Do not synchronize freeing of trigger filter on boot up Steven Rostedt
2022-12-13 23:49 ` Masami Hiramatsu
2022-12-14  0:03   ` Steven Rostedt
2022-12-14  7:31     ` Masami Hiramatsu
2022-12-14 20:03   ` Paul E. McKenney
2022-12-14 20:37     ` Mathieu Desnoyers [this message]
2022-12-14 21:26       ` Paul E. McKenney
2022-12-15 15:02     ` Steven Rostedt
2022-12-15 17:02       ` Paul E. McKenney
2022-12-15 17:25         ` Paul E. McKenney
2022-12-15 18:51         ` Steven Rostedt
2022-12-15 19:01           ` Paul E. McKenney
2022-12-15 22:39             ` Steven Rostedt
2022-12-15 23:10               ` Paul E. McKenney
2022-12-15 23:42                 ` Steven Rostedt
2022-12-16  1:01                   ` Paul E. McKenney
2022-12-16  4:40                     ` Paul E. McKenney
2022-12-16 11:08                       ` Steven Rostedt
2022-12-18  0:29                         ` Paul E. McKenney

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=f36375fb-fdd2-4be6-3d74-5137533b6264@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=paulmck@kernel.org \
    --cc=rostedt@goodmis.org \
    /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).