Re: [PATCH] tracing: Do not synchronize freeing of trigger filter on boot up

From: Steven Rostedt
Date: Thu Dec 15 2022 - 13:51:16 EST


On Thu, 15 Dec 2022 09:02:56 -0800
"Paul E. McKenney" <paulmck@xxxxxxxxxx> wrote:

> On Thu, Dec 15, 2022 at 10:02:41AM -0500, Steven Rostedt wrote:
> > On Wed, 14 Dec 2022 12:03:33 -0800
> > "Paul E. McKenney" <paulmck@xxxxxxxxxx> wrote:
> >
> > > > > Avoid calling the synchronization function when system_state is
> > > > > SYSTEM_BOOTING.
> > > >
> > > > Shouldn't this be done inside tracepoint_synchronize_unregister()?
> > > > Then, it will prevent similar warnings if we expand boot time feature.
> > >
> > > How about the following wide-spectrum fix within RCU_LOCKDEP_WARN()?
> > > Just in case there are ever additional issues of this sort?
> >
> > Adding more tracing command line parameters is triggering this more. I now
> > hit:
>
> Fair point, and apologies for the hassle.
>
> Any chance of getting an official "it is now late enough in boot to
> safely invoke lockdep" API? ;-)

lockdep API isn't the problem, it's that we are still in the earlyboot stage
where interrupts are disabled, and you can't enable them. Lockdep works
just fine there, and is reporting interrupts being disabled correctly. The
backtrace reported *does* have interrupts disabled.

The thing is, because we are still running on a single CPU with interrupts
disabled, there is no need for synchronization. Even grabbing a mutex is
safe because there's guaranteed to be no contention (unless it's not
released). This is why a lot of warnings are suppressed if system_state is
SYSTEM_BOOTING.

>
> In the meantime, does the (untested and quite crude) patch at the end
> of this message help?

I'll go and test it, but I'm guessing it will work fine. You could also test
against system_state != SYSTEM_BOOTING, as that gets cleared just before
kernel_init() can continue (it waits for the complete() that is called
after system_state is set to SYSTEM_SCHEDULING). Which happens shortly
after rcu_scheduler_starting().

I wonder if you could even replace RCU_SCHEDULER_RUNNING with
system_state != SYSTEM_BOOTING, and remove the rcu_scheduler_starting()
call.

-- Steve