Re: [PATCH v2] tracing/perf: Move rcu_irq_enter/exit_irqson() to perf trace point hook

From: Mathieu Desnoyers
Date: Tue Feb 11 2020 - 11:27:39 EST


----- On Feb 11, 2020, at 11:18 AM, rostedt rostedt@xxxxxxxxxxx wrote:

> On Tue, 11 Feb 2020 16:34:52 +0100
> Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
>> > + if (unlikely(in_nmi()))
>> > + goto out;
>>
>> unless I'm mistaken, we can simply do rcu_nmi_enter() in this case, and
>> rcu_nmi_exit() on the other end.
>>
>> > + rcu_irq_enter_irqson();
>
> The thing is, I don't think this can ever happen. We've had in the
> tracepoint.h:
>
> /* srcu can't be used from NMI */ \
> WARN_ON_ONCE(rcuidle && in_nmi()); \
>
> And this has yet to trigger.

But that "rcuidle" state is defined on a per-tracepoint basis, whereas
"!rcu_is_watching()" is a state which depends on the current execution
context. I don't follow how the fact that this WARN_ON_ONCE() never
triggered allows us to infer anything about (!rcu_is_watching() && in_nmi()).

Thanks,

Mathieu

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