All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <steven@rostedt.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Yury Norov <ynorov@nvidia.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Ao Sun <ao.sun@transsion.com>, David Carlier <devnexen@gmail.com>,
	Karl Mehltretter <kmehltretter@gmail.com>,
	Martin Kaiser <martin@kaiser.cx>,
	Pengpeng Hou <pengpeng@iscas.ac.cn>,
	Qian-Yu Lin <tiffany019230@gmail.com>,
	Rik van Riel <riel@surriel.com>, Rosen Penev <rosenp@gmail.com>,
	Shuvam Pandey <shuvampandey1@gmail.com>,
	Vineeth Pillai <vineeth@bitbyteword.org>,
	Yash Suthar <yashsuthar983@gmail.com>,
	Yu Peng <pengyu@kylinos.cn>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [GIT PULL] tracing: Updates for 7.2
Date: Sat, 20 Jun 2026 19:43:53 -0400	[thread overview]
Message-ID: <20260620194233.4e1e5d10@fedora> (raw)
In-Reply-To: <CAHk-=wjK1LyLWoQN47nAc6hsh-bcn-zcJnYDOC9Eb0c3jHuqMw@mail.gmail.com>

On Sat, 20 Jun 2026 15:39:25 -0700
Linus Torvalds <torvalds@linux-foundation.org> wrote:

> Feel free to try to come up with such a patch.
> 
> But honestly, before you do, what is the *advantage* of such a thing?

For debugging it is really useful.

> 
> Because you seem to think that "trace_printk()" and "printk()" are the same.
> 
> They really aren't.

I do not in any way think they are the same. To me, printk() is used
for information to the console for various production messages, whereas
trace_printk() is used when you have that nasty bug that you don't know
exactly where it is. trace_printk() should never be used in a
production environment.

When I (and many others) use trace_printk() to debug, we basically use
the "shotgun" approach. That is, we add trace_printk() all over the
place to see where the bug occurs. This could be for 10s of files.
Having to add an include to each one of these files is a burden and
adds to the frustration when you are debugging something that doesn't
work. You just want to add trace_printk() in places to see where the
bug triggers.

A lot of times, all I add is:

	trace_printk("%s:%d\n", __func__, __LINE__):

and cut and paste that in several locations in several files between if
statements. I may even add:

	if (bad_condition())
		tracing_off();

Which will disable tracing when the bad condition is detected. Then I
can look at the trace to see all the prints up to the bug. This is
*really* useful!!!

I really want to avoid having to add an include for trace_printk when
I'm focusing on just finding were the bug happens.

I'm pretty sure others on the Cc list have the same use case.

I totally sympathize with getting rid of junk out of kernel.h (and
possibly getting rid of kernel.h altogether) but I also want to keep
this debugging ability around.

-- Steve

  reply	other threads:[~2026-06-20 23:44 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-16 22:01 [GIT PULL] tracing: Updates for 7.2 Steven Rostedt
2026-06-19  4:23 ` Linus Torvalds
2026-06-19 12:15   ` Steven Rostedt
2026-06-19 14:35     ` Linus Torvalds
2026-06-19 15:40       ` Sebastian Andrzej Siewior
2026-06-19 15:43         ` Linus Torvalds
2026-06-19 18:30           ` Sebastian Andrzej Siewior
2026-06-19 19:07             ` Linus Torvalds
2026-06-19 20:28               ` Thomas Gleixner
2026-06-19 20:55                 ` Linus Torvalds
2026-06-20  9:22                   ` Willy Tarreau
2026-06-19 22:28               ` Linus Torvalds
2026-06-19 15:54       ` Steven Rostedt
2026-06-19 16:29         ` Linus Torvalds
2026-06-20 20:24       ` Julia Lawall
2026-06-20 22:19       ` Steven Rostedt
2026-06-20 22:39         ` Linus Torvalds
2026-06-20 23:43           ` Steven Rostedt [this message]
2026-06-21  0:18             ` Linus Torvalds
2026-06-21  6:34               ` Steven Rostedt
2026-06-21  7:10               ` Steven Rostedt
2026-06-19 15:19   ` Yury Norov
2026-06-19 15:40     ` Linus Torvalds
2026-06-19 22:18       ` Yury Norov
2026-06-19  4:38 ` pr-tracker-bot

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=20260620194233.4e1e5d10@fedora \
    --to=steven@rostedt.org \
    --cc=ao.sun@transsion.com \
    --cc=bigeasy@linutronix.de \
    --cc=devnexen@gmail.com \
    --cc=kmehltretter@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin@kaiser.cx \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=pengpeng@iscas.ac.cn \
    --cc=pengyu@kylinos.cn \
    --cc=peterz@infradead.org \
    --cc=riel@surriel.com \
    --cc=rosenp@gmail.com \
    --cc=shuvampandey1@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=tiffany019230@gmail.com \
    --cc=torvalds@linux-foundation.org \
    --cc=vineeth@bitbyteword.org \
    --cc=yashsuthar983@gmail.com \
    --cc=ynorov@nvidia.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.