Re: [PATCH -printk] printk, tracing: fix console tracepoint

From: Steven Rostedt
Date: Mon Jul 11 2022 - 20:53:27 EST


On Mon, 11 Jul 2022 17:21:28 -0700
"Paul E. McKenney" <paulmck@xxxxxxxxxx> wrote:

> On x86, both srcu_read_lock() and srcu_read_unlock() should be OK from
> NMI context, give or take their use of lockdep. Which is why we have
> srcu_read_lock_notrace() and srcu_read_unlock_notrace(), which do not
> use lockdep. Which __DO_TRACE() does in fact invoke. Ah, but you have
> this: "WARN_ON_ONCE(rcuidle && in_nmi())".
>
> Because all the world is not an x86.

But since NMIs are architecture specific, we could change that to:

WARN_ON_ONCE(!srcu_nmi_safe && rcuidle && in_nmi());

and add a srcu_nmi_safe constant or macro that is 1 on architectures that
srcu is safe in NMI and 0 otherwise.

Or do we care if a tracepoint happens in those architectures where it is
not safe. We could then just do:

if (!srcu_nmi_safe && rcuidle && in_nmi())
return;

and just skip tracepoints that are marked rcu_idle and happen within NMI.

-- Steve