[PATCH] perf/aux: Order padding stores before publishing aux_head
From: Leo Yan
Date: Wed Dec 02 2026 - 10:45:39 EST
Drivers commonly fill alignment gaps with CPU stores before calling
perf_aux_output_skip(). Put smp_wmb() in the helper so all callers
order their padding stores before publishing aux_head. This pairs with
the reader's smp_rmb() after loading aux_head.
Fixes: 1a5941312414 ("perf: Add wakeup watermark control to the AUX area")
Signed-off-by: Leo Yan <leo.yan@xxxxxxx>
---
Intel BTS, Arm SPE and CoreSight TRBE all use perf_aux_output_skip()
after writing padding. Ordering those stores in the helper covers all
three callers. Each PMU driver still handles its trace hardware's
synchronization requirements.
---
kernel/events/ring_buffer.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
index 95f4fbdfd2764de5b72d901d778c46302f525fad..b564abb7f1e8f798997683b753ced73fadafdcd3 100644
--- a/kernel/events/ring_buffer.c
+++ b/kernel/events/ring_buffer.c
@@ -558,6 +558,8 @@ int perf_aux_output_skip(struct perf_output_handle *handle, unsigned long size)
rb->aux_head += size;
+ /* Order any padding stores before publishing aux_head */
+ smp_wmb();
WRITE_ONCE(rb->user_page->aux_head, rb->aux_head);
if (rb_need_aux_wakeup(rb)) {
perf_output_wakeup(handle);
---
base-commit: 693c2e04e3f1d4c59af236e1211b7b8cb165a790
change-id: 20261202-perf-aux-padding-order-5e3ea6fa0b65
Best regards,
--
Leo Yan <leo.yan@xxxxxxx>