Re: [PATCH v2] selftests/ftrace: Fix trace_marker_raw test on 64K page kernels

From: Steven Rostedt

Date: Thu May 28 2026 - 09:17:25 EST


On Thu, 28 May 2026 10:24:17 +0800
Tianchen Ding <dtcccc@xxxxxxxxxxxxxxxxx> wrote:

>
> 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..f68f1901f65f 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
> @@ -43,8 +43,11 @@ write_buffer() {
> id=$1
> size=$2
>
> - # write the string into the raw marker
> - make_str $id $size > trace_marker_raw
> + # 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.
> + make_str $id $size | dd of=trace_marker_raw bs=`expr $size + 4` iflag=fullblock

I was looking at this more, and I'm not comfortable with the hard coded
4 above. I rather use the length of the string. Something like:

str=`make_str $id $size`
len=${#str}
echo "$str" | dd of=trace_marker_raw bs=$len iflag=fullblock

-- Steve

> }
>
>