Re: On trace_*_rcuidle functions in modules

From: John Stultz
Date: Wed Apr 15 2020 - 18:09:09 EST


On Wed, Apr 15, 2020 at 2:49 PM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> On Wed, 15 Apr 2020 14:02:04 -0700
> John Stultz <john.stultz@xxxxxxxxxx> wrote:
>
> >
> > So in my case your concerns may not be a problem, but I guess
> > generally it might. Though I'd hope the callback would be unregistered
> > (and whatever waiting for the grace period to complete be done) before
> > the module removal is complete. But maybe I'm still missing your
> > point?
>
> Hmm, you may have just brought up a problem here...
>
> You're saying that cpu_pm_register_notifier() callers are called from non
> RCU watching context? If that's the case, we have this:

Wait? what? I don't think I'm saying that. :) I'm just trying to fix
a build issue that prevents a driver from being a module since it has
a trace_*_rcuidle call in it.

Honestly, I really don't know much about how the cpu pm notifiers
interact with rcu. It's just this recent change, which seems
necessary, now seemingly prevents the driver from being built as a
module:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=efde2659b0fe835732047357b2902cca14f054d9

Maybe there's a better solution than using trace_*_rcuidle?

thanks
-john