Re: [GIT PULL] tracing: minor fixes

From: Steven Rostedt
Date: Thu Mar 10 2022 - 20:51:05 EST


On Thu, 10 Mar 2022 17:28:31 -0800
Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:

> On Thu, Mar 10, 2022 at 2:45 PM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> >
> > - Fix unregistering the same event twice a the user could disable
> > the event osnoise will disable on unregistering.
>
> What? That sounds like a (bad) markov chain text generator made random
> commit noises.
>
> I tried to edit that to something that actually makes some sense, but
> who knows..

Ah sorry. That was something difficult to shorten, and I wrote that up at
the end of the night.

tracepoints will warn if you try to unregister a callback that is not
registered. It doesn't break anything to do so, but because tracepoints are
asynchronous, and when the user reads the ring buffer it triggers calls to
special functions associated to a tracepoint, unregistering twice usually
is because of a bug that can cause a hard to debug situation. So we warn if
a callback is unregistered from a tracepoint that is not currently
registered.

What happened above is that the osnoise tracer registered callbacks to the
tracepoints. And it unregisters them when the tracer is stopped (echo 0
into tracing_on) or removed (echo nop > current_tracer). If the user stops
osnoise with the echo 0 to tracing_on that will cause the tracepoint
callbacks to be unregistered. If the user then turns off osnoise, then it
will unregister the callbacks again, even though they were no longer
registered.

Basically it was just an accounting error.

-- Steve