Skip to contentSkip to conversation

tracing: Export tracing_start() and tracing_stop()

PATCH NAK Vincent Whitchurch 3 participants 5 messages Jun 2, 2021 – Jun 8, 2021 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tracing: Export tracing_start() and tracing_stop()

tracing_stop() is very useful during hands-on debugging for getting the trace to stop exactly when the problem is detected. Export this to modules.

Personally, I haven't yet found the need to use tracing_start() from code since I usually start tracing via tracefs, but export that too for symmetry since it may have its uses together with tracing_stop().

---
 kernel/trace/trace.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/trace/trace.c +2 -0
index a21ef9cd2aae..5fa36f0705b7 100644
@@ -2301,6 +2301,7 @@ void tracing_start(void)
  out:
 	raw_spin_unlock_irqrestore(&global_trace.start_lock, flags);
 }
+EXPORT_SYMBOL_GPL(tracing_start);
 
 static void tracing_start_tr(struct trace_array *tr)
 {
@@ -2366,6 +2367,7 @@ void tracing_stop(void)
  out:
 	raw_spin_unlock_irqrestore(&global_trace.start_lock, flags);
 }
+EXPORT_SYMBOL_GPL(tracing_stop);
 
 static void tracing_stop_tr(struct trace_array *tr)
 {
Signature · 1 line
2.28.0
#1 lore raw
Quoted 7 lines · Vincent Whitchurch

tracing_stop() is very useful during hands-on debugging for getting the trace to stop exactly when the problem is detected. Export this to modules.

Personally, I haven't yet found the need to use tracing_start() from code since I usually start tracing via tracefs, but export that too for symmetry since it may have its uses together with tracing_stop().

NAK, no exports for unused symbols.

maintainer
#2 lore raw
Quoted 10 lines · On Mon, 7 Jun 2021 09:25:19 +0100 Christoph Hellwig <[email protected]> wrote:
Quoted 7 lines · Vincent Whitchurch

tracing_stop() is very useful during hands-on debugging for getting the trace to stop exactly when the problem is detected. Export this to modules.

Personally, I haven't yet found the need to use tracing_start() from code since I usually start tracing via tracefs, but export that too for symmetry since it may have its uses together with tracing_stop().

NAK, no exports for unused symbols.

Normally I would NAK this NAK because this is not normal functionality that modules could use. It's for debugging, similar to trace_printk(), and there should be no used symbols in any modules. This is something for debugging purposes only and should never be in shipped kernels.

That said though, tracing_stop() is probably not what is wanted (unless its for a suspend to ram thing). According to the above description, the author really wants to use "tracing_off()" and not "tracing_stop()" as tracing_off() is faster and can be turned back on in user-space with the "tracing_on" file in tracefs, where as, tracing_stop() can not be. tracing_stop() needs a tracing_start() to get it going again.

And tracing_off() is already EXPORT_SYMBOL_GPL() (as it is commonly used for debugging of modules). Again, it shouldn't have any in-kernel users in modules, because, like I stated above, it's similar to trace_printk() which should be removed before pushing to Linus.

I'll NAK this patch for a different reason. Use tracing_off() instead.

-- Steve

#3 lore raw
Quoted 8 lines · Steven Rostedt

That said though, tracing_stop() is probably not what is wanted (unless its for a suspend to ram thing). According to the above description, the author really wants to use "tracing_off()" and not "tracing_stop()" as tracing_off() is faster and can be turned back on in user-space with the "tracing_on" file in tracefs, where as, tracing_stop() can not be. tracing_stop() needs a tracing_start() to get it going again.

Quoted 6 lines

And tracing_off() is already EXPORT_SYMBOL_GPL() (as it is commonly used for debugging of modules). Again, it shouldn't have any in-kernel users in modules, because, like I stated above, it's similar to trace_printk() which should be removed before pushing to Linus.

I'll NAK this patch for a different reason. Use tracing_off() instead.

Right, thanks, that's certainly much simpler. I'd only used tracing_stop() before and never noticed that tracing_on can't be used to restart tracing, probably because the kind of problems I used it for usually resulted in the system needing a restart anyway to be usable.

maintainer
#4 lore raw
Quoted 4 lines · On Tue, 8 Jun 2021 14:59:27 +0200 Vincent Whitchurch…

Right, thanks, that's certainly much simpler. I'd only used tracing_stop() before and never noticed that tracing_on can't be used to restart tracing, probably because the kind of problems I used it for usually resulted in the system needing a restart anyway to be usable.

You must have been using this from the beginning, because tracing_stop() was first, but people complained that it was slow and you couldn't turn it back on. Thus "tracing_off()" was added, and documented as the "thing to use" (if you looked at the comments around them). But that was years (decade?) ago.

-- Steve