Skip to content

ring-buffer: Fix forced 8-byte alignment event length

Hui Wang linux-kselftest linux-trace-kernel 1 version NAK

Status from this message: NACK

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 8 repliesNAK

Patches in v1

#Subject and filesSizeRepliesApplied
1/2ring-buffer: Fix event length with forced 8-byte alignmentkernel/trace/ring_buffer.c+2 -14 replies
2/2selftests/ftrace: Account for 8-byte aligned trace_marker_raw eventstools/testing/selftests/ftrace/test.d/00basic/trace_marker_raw.tc tools/testing/selftests/ftrace/test.d/functions+46 -34 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchMasami Hiramatsu (Google)
1/2R-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] ring-buffer: Fix forced 8-byte alignment event length

This series fixes the event length reported by ring_buffer_event_length() when RB_FORCE_8BYTE_ALIGNMENT is enabled, and updates the ftrace trace_marker_raw selftest to account for that layout.

On architectures where CONFIG_HAVE_64BIT_ALIGNED_ACCESS is enabled, the ring buffer forces 8-byte alignment. In that mode, the event length is stored in event->array[0] even for small data events, and the payload starts from event->array[1]. However, ring_buffer_event_length() only subtracted the extra length field for large events. As a result, small events reported a payload length 4 bytes larger than expected.

This was observed on riscv64 with CONFIG_HAVE_64BIT_ALIGNED_ACCESS=y when running the ftrace trace_marker_raw.tc selftest. The first patch fixes the ring-buffer length calculation. The second patch updates the selftest expectation when the running kernel uses forced 8-byte alignment.

Hui Wang (2):
ring-buffer: Fix event length with forced 8-byte alignment selftests/ftrace: Account for 8-byte aligned trace_marker_raw events

 kernel/trace/ring_buffer.c                    |  3 +-
 .../ftrace/test.d/00basic/trace_marker_raw.tc | 16 +++++++--
 .../testing/selftests/ftrace/test.d/functions | 33 +++++++++++++++++++
 3 files changed, 48 insertions(+), 4 deletions(-)
Signature · 1 line
2.43.0