[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220715151000.GY1790663@paulmck-ThinkPad-P17-Gen-1>
Date: Fri, 15 Jul 2022 08:10:00 -0700
From: "Paul E. McKenney" <paulmck@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Marco Elver <elver@...gle.com>, Petr Mladek <pmladek@...e.com>,
John Ogness <john.ogness@...utronix.de>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
kasan-dev@...glegroups.com, Thomas Gleixner <tglx@...utronix.de>,
Johannes Berg <johannes.berg@...el.com>,
Alexander Potapenko <glider@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Naresh Kamboju <naresh.kamboju@...aro.org>,
Peter Zijlstra <peterz@...radead.org>,
Linux Kernel Functional Testing <lkft@...aro.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] printk: Make console tracepoint safe in NMI() context
On Fri, Jul 15, 2022 at 09:51:56AM -0400, Steven Rostedt wrote:
> On Fri, 15 Jul 2022 14:39:52 +0200
> Marco Elver <elver@...gle.com> wrote:
>
> > Couldn't this just use rcu_is_watching()?
> >
> > | * rcu_is_watching - see if RCU thinks that the current CPU is not idle
>
> Maybe, but I was thinking that Petr had a way to hit the issue that we
> worry about. But since the non _rcuide() call requires rcu watching,
> prehaps that is better to use.
In case this helps... ;-)
The rcu_is_watching() function is designed to be used from the current
CPU, so it dispenses with memory ordering. However, it explicitly
disables preemption in order to avoid weird preemption patterns.
The formulation that Marco used is designed to be used from a remote
CPU, and so it includes explicit memory ordering that is not needed
in this case. But it does not disable preemption.
So if preemption is enabled at that point in tracing, you really want
to be using rcu_is_watching().
Thanx, Paul
Powered by blists - more mailing lists