Re: [PATCH] tracing: remove tracing_is_on export

From: Steven Rostedt
Date: Thu Jul 25 2024 - 09:54:01 EST


On Thu, 25 Jul 2024 15:35:00 +0200
Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:

> Generally, we don't allow symbols that are not actually being used in
> the kernel tree? tracing_is_on() is a "code flow" type of thing, where
> code can operate differently if it is enabled or not.
>
> And I would argue that tracing_on() and tracing_off() should also not be
> allowed to be in a module, why would you want that? Just enable/disable
> it from userspace when doing your testing, IF you have permission to do
> so.

tracing_off() is key to development, and one that I would argue very much
against removing. The other two are more just for "completeness".

It usually is used by adding a bunch of trace_printk(), and then:

if (condition) {
trace_printk("Condition hit!\n");
tracing_off();
}

And then you run your kernel until you noticed that something weird
happened. Then look at the trace file, and it will have all the events that
happened up to the anomaly condition, and you don't have to worry about the
ring buffer overflowing and losing your data.

This workflow is used by many developers.

-- Steve