From: Leo Yan <leo.yan@arm.com>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
James Clark <james.clark@linaro.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
Ingo Molnar <mingo@kernel.org>, Leo Yan <leo.yan@arm.com>
Subject: [PATCH] perf/aux: Order padding stores before publishing aux_head
Date: Wed, 02 Dec 2026 15:45:11 +0000 [thread overview]
Message-ID: <20261202-perf-aux-padding-order-v1-1-7c69fb8b43f7@arm.com> (raw)
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@arm.com>
---
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@arm.com>
reply other threads:[~2026-12-02 15:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261202-perf-aux-padding-order-v1-1-7c69fb8b43f7@arm.com \
--to=leo.yan@arm.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=will@kernel.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
all inboxes | Powered by JetHome®