From: Steven Rostedt <rostedt@goodmis.org>
To: Tianchen Ding <dtcccc@linux.alibaba.com>,
Shuah Khan <skhan@linuxfoundation.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Shuah Khan <shuah@kernel.org>,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v3] selftests/ftrace: Fix trace_marker_raw test on 64K page kernels
Date: Mon, 1 Jun 2026 09:51:50 -0400 [thread overview]
Message-ID: <20260601095150.69180421@fedora> (raw)
In-Reply-To: <20260601023251.1916483-1-dtcccc@linux.alibaba.com>
Shuah,
can you take this?
Reviewed-by: Steven Rostedt <rostedt@goodmis.org.
Tianchen,
for future patches, please send new versions as a separate thread and
not a reply to the thread of the previous version.
Thanks,
-- Steve
On Mon, 1 Jun 2026 10:32:51 +0800
Tianchen Ding <dtcccc@linux.alibaba.com> wrote:
> On ARM64 kernels with 64K pages, the trace_marker_raw test fails because
> bash's printf builtin uses stdio buffering which splits output into
> multiple small write() calls to the tracefs file. Since each individual
> write is within TRACE_MARKER_MAX_SIZE (4096), they all succeed, causing
> the "too big" write test to incorrectly pass.
>
> Fix by writing through dd with iflag=fullblock to guarantee a single
> atomic write() syscall to trace_marker_raw.
>
> Fixes: 37f46601383a ("selftests/tracing: Add basic test for trace_marker_raw file")
> Signed-off-by: Tianchen Ding <dtcccc@linux.alibaba.com>
> ---
> v3:
> Measure the binary length via wc -c instead of hard-coding "size + 4".
>
> v2:
> Update comment about 64K pages.
> ---
> .../ftrace/test.d/00basic/trace_marker_raw.tc | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/ftrace/test.d/00basic/trace_marker_raw.tc b/tools/testing/selftests/ftrace/test.d/00basic/trace_marker_raw.tc
> index 8e905d4fe6dd..f985ff391463 100644
> --- a/tools/testing/selftests/ftrace/test.d/00basic/trace_marker_raw.tc
> +++ b/tools/testing/selftests/ftrace/test.d/00basic/trace_marker_raw.tc
> @@ -36,15 +36,23 @@ make_str() {
>
> data=`printf -- 'X%.0s' $(seq $cnt)`
>
> - printf "${val}${data}"
> + # Return escape-sequence text (e.g. "\003\000..."); the caller
> + # converts to binary. Shell command substitution strips NUL bytes,
> + # so the binary form cannot survive being captured into a variable.
> + printf '%s' "${val}${data}"
> }
>
> write_buffer() {
> id=$1
> size=$2
>
> - # write the string into the raw marker
> - make_str $id $size > trace_marker_raw
> + str=`make_str $id $size`
> + len=`printf "$str" | wc -c`
> + # Pipe through dd to ensure a single atomic write() syscall
> + # on architectures with 64K pages, where shell's printf builtin
> + # uses stdio buffering which may split the output into multiple
> + # writes.
> + printf "$str" | dd of=trace_marker_raw bs=$len iflag=fullblock
> }
>
>
prev parent reply other threads:[~2026-06-01 13:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-27 9:54 [PATCH] selftests/ftrace: Fix trace_marker_raw test on 64K page kernels Tianchen Ding
2026-05-27 14:09 ` Steven Rostedt
2026-05-28 2:24 ` [PATCH v2] " Tianchen Ding
2026-05-28 13:13 ` Steven Rostedt
2026-05-29 2:59 ` Tianchen Ding
2026-05-29 13:15 ` Steven Rostedt
2026-06-01 2:32 ` [PATCH v3] " Tianchen Ding
2026-06-01 13:51 ` 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=20260601095150.69180421@fedora \
--to=rostedt@goodmis.org \
--cc=dtcccc@linux.alibaba.com \
--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=shuah@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 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.