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

From: Paul E. McKenney
Date: Wed Feb 12 2020 - 04:05:26 EST


On Wed, Feb 12, 2020 at 09:05:22AM +0100, Peter Zijlstra wrote:
> On Tue, Feb 11, 2020 at 10:54:57AM -0800, Paul E. McKenney wrote:
> > On Tue, Feb 11, 2020 at 06:32:13PM +0100, Peter Zijlstra wrote:
> > > On Tue, Feb 11, 2020 at 06:29:52PM +0100, Peter Zijlstra wrote:
> > > > +#define trace_rcu_enter() \
> > > > +({ \
> > > > + unsigned long state = 0; \
> > > > + if (!rcu_is_watching()) { \
> > >
> > > Also, afaict rcu_is_watching() itself needs more love, the functio has
> > > notrace, but calls other stuff that does not have notrace or inline.
> >
> > Good catch! Like this?
> >
> > Thanx, Paul
> >
> > ------------------------------------------------------------------------
> >
> > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> > index 1f5fdf7..51616e72 100644
> > --- a/kernel/rcu/tree.c
> > +++ b/kernel/rcu/tree.c
> > @@ -295,7 +295,7 @@ static void rcu_dynticks_eqs_online(void)
> > *
> > * No ordering, as we are sampling CPU-local information.
> > */
> > -static bool rcu_dynticks_curr_cpu_in_eqs(void)
> > +static bool notrace rcu_dynticks_curr_cpu_in_eqs(void)
>
> Right, except that, given the size of the thing, I'd opt for 'inline'
> over 'notrace'.

Like this, then?

Thanx, Paul

------------------------------------------------------------------------

commit 164a7e5204cf32d22d0e444efd97ac7f2243b8d2
Author: Paul E. McKenney <paulmck@xxxxxxxxxx>
Date: Tue Feb 11 11:10:00 2020 -0800

rcu: Make rcu_dynticks_curr_cpu_in_eqs() be inline

The rcu_is_watching() function is and must be notrace in order to allow
it to be used by the tracing infrastructure. However, it also invokes
rcu_dynticks_curr_cpu_in_eqs(), which therefore needs to be either
notrace or inline. But isn't.

This commit therefore adds "inline" to the rcu_dynticks_curr_cpu_in_eqs()
definition.

Reported-by: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxx>

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 1f5fdf7..16fd113 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -295,7 +295,7 @@ static void rcu_dynticks_eqs_online(void)
*
* No ordering, as we are sampling CPU-local information.
*/
-static bool rcu_dynticks_curr_cpu_in_eqs(void)
+static bool inline rcu_dynticks_curr_cpu_in_eqs(void)
{
struct rcu_data *rdp = this_cpu_ptr(&rcu_data);