From: Steven Rostedt <rostedt@goodmis.org>
To: LKML <linux-kernel@vger.kernel.org>,
Linux Trace Kernel <linux-trace-kernel@vger.kernel.org>,
linux-kselftest <linux-kselftest@vger.kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] tracing/selftests: Make sure trace_printk is set to top instance
Date: Tue, 24 Nov 2026 10:30:20 -0500 [thread overview]
Message-ID: <20261124103020.708990a6@gandalf.local.home> (raw)
In-Reply-To: <20261123145918.0d7f3728@gandalf.local.home>
Masami,
You OK with this patch?
If so...
Shuah, can you take this patch if Masami acks it. It's not urgent and can
go in the next merge window.
Thanks,
-- Steve
On Mon, 23 Nov 2026 14:59:18 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:
> From: Steven Rostedt <rostedt@goodmis.org>
>
> In order to debug a kernel crash, the boot command line added
> the traceprintk flag to have trace_printk() go to the persistent ring
> buffer. When the fix was found, the command line wasn't updated.
>
> Later, when running the ftrace selftests, the direct function tests were
> failing. The reason for this was because these tests would load the
> ftrace-direct.ko module which would add a trampoline that did a
> trace_printk. The test would then search the top level instance buffer for
> the trace_printk output. The issue is that the kernel command line had
> moved the destination to the persistent ring buffer causing the writes of
> trace_printk to go there and not the top level instance and because the
> tests did not find the output it was looking for, they failed.
>
> Update the tests to set the trace_printk destination to the top level
> instance at the start of the tests to force the output to go there so that
> the tests will not fail in such a case again.
>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
> .../testing/selftests/ftrace/test.d/direct/ftrace-direct.tc | 5 +++++
> .../testing/selftests/ftrace/test.d/direct/kprobe-direct.tc | 5 +++++
> 2 files changed, 10 insertions(+)
>
> diff --git a/tools/testing/selftests/ftrace/test.d/direct/ftrace-direct.tc b/tools/testing/selftests/ftrace/test.d/direct/ftrace-direct.tc
> index d75a8695bc21..359257123e6d 100644
> --- a/tools/testing/selftests/ftrace/test.d/direct/ftrace-direct.tc
> +++ b/tools/testing/selftests/ftrace/test.d/direct/ftrace-direct.tc
> @@ -2,6 +2,11 @@
> # SPDX-License-Identifier: GPL-2.0
> # description: Test ftrace direct functions against tracers
>
> +# Make sure trace_printk goes to the main buffer
> +if [ -f options/trace_printk_dest ]; then
> + echo 1 > options/trace_printk_dest
> +fi
> +
> rmmod ftrace-direct ||:
> if ! modprobe ftrace-direct ; then
> echo "No ftrace-direct sample module - please make CONFIG_SAMPLE_FTRACE_DIRECT=m"
> diff --git a/tools/testing/selftests/ftrace/test.d/direct/kprobe-direct.tc b/tools/testing/selftests/ftrace/test.d/direct/kprobe-direct.tc
> index e52e470a1f8f..b22e3fb1c468 100644
> --- a/tools/testing/selftests/ftrace/test.d/direct/kprobe-direct.tc
> +++ b/tools/testing/selftests/ftrace/test.d/direct/kprobe-direct.tc
> @@ -3,6 +3,11 @@
> # description: Test ftrace direct functions against kprobes
> # requires: kprobe_events
>
> +# Make sure trace_printk goes to the main buffer
> +if [ -f options/trace_printk_dest ]; then
> + echo 1 > options/trace_printk_dest
> +fi
> +
> rmmod ftrace-direct ||:
> if ! modprobe ftrace-direct ; then
> echo "No ftrace-direct sample module - please build with CONFIG_SAMPLE_FTRACE_DIRECT=m"
prev parent reply other threads:[~2026-11-24 15:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 19:59 [PATCH] tracing/selftests: Make sure trace_printk is set to top instance Steven Rostedt
2026-11-24 15:30 ` Steven Rostedt [this message]
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=20261124103020.708990a6@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=skhan@linuxfoundation.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox