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

From: Peter Zijlstra
Date: Wed Feb 12 2020 - 03:02:48 EST


On Tue, Feb 11, 2020 at 12:35:21PM -0500, Mathieu Desnoyers wrote:

> Minor nits:
>
> Why not make these an enum ?
>
> > +
> > +#define trace_rcu_enter() \
> > +({ \
> > + unsigned long state = 0; \
> > + if (!rcu_is_watching()) { \
> > + if (in_nmi()) { \
> > + state = __TR_NMI; \
> > + rcu_nmi_enter(); \
> > + } else { \
> > + state = __TR_IRQ; \
> > + rcu_irq_enter_irqson(); \
> > + } \
> > + } \
> > + state; \
> > +})
> > +
> > +#define trace_rcu_exit(state) \
> > +do { \
> > + switch (state) { \
> > + case __TR_IRQ: \
> > + rcu_irq_exit_irqson(); \
> > + break; \
> > + case __IRQ_NMI: \
> > + rcu_nmi_exit(); \
> > + break; \
> > + default: \
> > + break; \
> > + } \
> > +} while (0)
>
> And convert these into static inline functions ?

Probably the same reason the rest of the file is macros; header hell.

Now, I could probably make these inlines, but then I'd have to add more
RCU function declariations to this file (which is outside of
rcupdate.h). Do we want to do that?

The reason these were in this file is because I want to keep the comment
and implementation near to nmi_enter/exit.