linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tracing: Export tracing_start() and tracing_stop()
@ 2021-06-02  8:01 Vincent Whitchurch
  2021-06-07  8:25 ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Vincent Whitchurch @ 2021-06-02  8:01 UTC (permalink / raw)
  To: Steven Rostedt, Ingo Molnar; +Cc: kernel, Vincent Whitchurch, linux-kernel

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().

Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
---
 kernel/trace/trace.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index a21ef9cd2aae..5fa36f0705b7 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -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)
 {
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] tracing: Export tracing_start() and tracing_stop()
  2021-06-02  8:01 [PATCH] tracing: Export tracing_start() and tracing_stop() Vincent Whitchurch
@ 2021-06-07  8:25 ` Christoph Hellwig
  2021-06-07 13:14   ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2021-06-07  8:25 UTC (permalink / raw)
  To: Vincent Whitchurch; +Cc: Steven Rostedt, Ingo Molnar, kernel, linux-kernel

On Wed, Jun 02, 2021 at 10:01:18AM +0200, Vincent Whitchurch wrote:
> 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] tracing: Export tracing_start() and tracing_stop()
  2021-06-07  8:25 ` Christoph Hellwig
@ 2021-06-07 13:14   ` Steven Rostedt
  2021-06-08 12:59     ` Vincent Whitchurch
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2021-06-07 13:14 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Vincent Whitchurch, Ingo Molnar, kernel, linux-kernel

On Mon, 7 Jun 2021 09:25:19 +0100
Christoph Hellwig <hch@infradead.org> wrote:

> On Wed, Jun 02, 2021 at 10:01:18AM +0200, Vincent Whitchurch wrote:
> > 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] tracing: Export tracing_start() and tracing_stop()
  2021-06-07 13:14   ` Steven Rostedt
@ 2021-06-08 12:59     ` Vincent Whitchurch
  2021-06-08 13:24       ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: Vincent Whitchurch @ 2021-06-08 12:59 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Christoph Hellwig, Ingo Molnar, kernel, linux-kernel

On Mon, Jun 07, 2021 at 03:14:32PM +0200, Steven Rostedt wrote:
> 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.

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] tracing: Export tracing_start() and tracing_stop()
  2021-06-08 12:59     ` Vincent Whitchurch
@ 2021-06-08 13:24       ` Steven Rostedt
  0 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2021-06-08 13:24 UTC (permalink / raw)
  To: Vincent Whitchurch; +Cc: Christoph Hellwig, Ingo Molnar, kernel, linux-kernel

On Tue, 8 Jun 2021 14:59:27 +0200
Vincent Whitchurch <vincent.whitchurch@axis.com> wrote:

> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-08 13:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-02  8:01 [PATCH] tracing: Export tracing_start() and tracing_stop() Vincent Whitchurch
2021-06-07  8:25 ` Christoph Hellwig
2021-06-07 13:14   ` Steven Rostedt
2021-06-08 12:59     ` Vincent Whitchurch
2021-06-08 13:24       ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).