All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Ogness <john.ogness@linutronix.de>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Vincent Whitchurch <vincent.whitchurch@axis.com>,
	jbaron@akamai.com, mingo@redhat.com, kernel@axis.com,
	corbet@lwn.net, linux-kernel@vger.kernel.org,
	Petr Mladek <pmladek@suse.com>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: Re: [PATCH] dynamic debug: allow printing to trace event
Date: Thu, 23 Jul 2020 16:08:44 +0206	[thread overview]
Message-ID: <87blk6cosb.fsf@jogness.linutronix.de> (raw)
In-Reply-To: <20200722112525.694880d3@oasis.local.home>

On 2020-07-22, Steven Rostedt <rostedt@goodmis.org> wrote:
>>> +static void dynamic_printk(unsigned int flags, const char *fmt, ...)
>>> +{
>>> +	if (flags & _DPRINTK_FLAGS_TRACE) {
>>> +		va_list args;
>>> +
>>> +		va_start(args, fmt);
>>> +		/*
>>> +		 * All callers include the KERN_DEBUG prefix to keep the
>>> +		 * vprintk case simple; strip it out for tracing.
>>> +		 */
>>> +		dynamic_trace(fmt + strlen(KERN_DEBUG), args);  
>> 
>> Do we really need a separate tracing event for this? Why not just:
>> 
>>                 ftrace_vprintk(fmt + strlen(KERN_DEBUG), args);
>
> It must be an event, one that can be enabled or disabled separately
> from trace_printk().
>
> If you are asking if this could be something like trace_printk(),
> which ftrace_vprintk() is. The reason for that nasty banner when
> people use trace_printk() is to keep developers from using it as their
> personal debugging tool in production.
>
> A trace_printk() can not be discretely disabled. It's either totally
> on, or totally off. And since it is used for debugging, if there's
> trace_printk()s all over the kernel, you will have to deal with the
> noise of everyone else's trace_printk(), making trace_printk()
> useless.

I understand and agree with your concern about trace_printk(). But it
seems to me that trace_printk() via pr_debug() should be OK because
there is discrete control per message implemented. Yes, more code is
necessary to distinguish between the two, such as letting dynamic_printk
use an internal function that does not trigger a splat. But I think that
is reasonable.

For me a trace event represents a specific point in the kernel code. But
this new printk trace event, instead, represents general log
redirection. I do not oppose it, but it feels like a hack to me. In
contrast, simply setting a dynamic printk flag to write the message
string to the trace buffer (without also activating some pseudo trace
event) feels more natural.

Just sharing my thoughts, as requested.

John Ogness

  reply	other threads:[~2020-07-23 14:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-21 14:11 [PATCH] dynamic debug: allow printing to trace event Vincent Whitchurch
2020-07-21 21:30 ` Steven Rostedt
2020-07-22 11:37   ` Sergey Senozhatsky
2020-07-22 13:52   ` John Ogness
2020-07-22 14:49     ` Vincent Whitchurch
2020-07-22 15:28       ` Steven Rostedt
2020-07-23 10:57         ` Vincent Whitchurch
2020-07-23 15:26           ` Steven Rostedt
2020-08-14 13:34             ` Vincent Whitchurch
2020-07-22 15:25     ` Steven Rostedt
2020-07-23 14:02       ` John Ogness [this message]
2020-07-23 14:20         ` John Ogness
2020-07-23 15:39         ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87blk6cosb.fsf@jogness.linutronix.de \
    --to=john.ogness@linutronix.de \
    --cc=corbet@lwn.net \
    --cc=jbaron@akamai.com \
    --cc=kernel@axis.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=vincent.whitchurch@axis.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.