Linux Perf Users
 help / color / mirror / Atom feed
From: Leo Yan <leo.yan@arm.com>
To: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Mike Leach <mike.leach@arm.com>,
	James Clark <james.clark@linaro.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Anshuman Khandual <anshuman.khandual@arm.com>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	coresight@lists.linaro.org
Subject: Re: [PATCH 1/2] perf: arm_spe: Order padding before publishing AUX head
Date: Fri, 27 Nov 2026 21:14:13 +0000	[thread overview]
Message-ID: <20261127211413.GH861809@e132581.arm.com> (raw)
In-Reply-To: <awnPG6QADpRAgEzx@willie-the-truck>

On Fri, Nov 27, 2026 at 06:42:35PM +0000, Will Deacon wrote:

> > @@ -487,8 +487,11 @@ static void arm_spe_pmu_pad_buf(struct perf_output_handle *handle, int len)
> >  	u64 head = PERF_IDX2OFF(handle->head, buf);
> >  
> >  	memset(buf->base + head, ARM_SPE_BUF_PAD_BYTE, len);
> > -	if (!buf->snapshot)
> > +	if (!buf->snapshot) {
> > +		/* Order the padding stores before publishing the new aux_head. */
> > +		smp_wmb();
> >  		perf_aux_output_skip(handle, len);
> > +	}
> 
> This looks correct to me, but I wonder if it should be handled by
> perf_aux_output_skip() instead? arm_spe_pmu_pad_buf() is called from a
> bunch of places in the driver, including in conjunction with
> perf_aux_output_end(), which looks like it already has the necessary
> memory barrier. So doing it here seems weird inconsistent to me.

As I mentioned in the cover letter, the choice of barrier depends on the
CPU memory model and the trace hardware. Perf deliberately leaves that
choice to the AUX driver [1].

SPE driver implicitly relies on the dsb(nsh) in
arm_spe_pmu_disable_and_drain_local() to make trace writes visible
before calling perf_aux_output_end(). I kept the barrier in the driver
for perf_aux_output_skip() to follow the same convention.

Thanks,
Leo

[1] https://lore.kernel.org/all/YLUFMzxin1PpgIdZ@hirez.programming.kicks-ass.net/

  reply	other threads:[~2026-11-27 21:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15 15:51 [PATCH 0/2] perf: Order SPE and TRBE padding before publishing AUX head Leo Yan
2026-10-15 15:51 ` [PATCH 1/2] perf: arm_spe: Order " Leo Yan
2026-10-15 16:03   ` sashiko-bot
2026-11-27 18:42   ` Will Deacon
2026-11-27 21:14     ` Leo Yan [this message]
2026-10-15 15:51 ` [PATCH 2/2] coresight: trbe: " Leo Yan
2026-10-15 16:09   ` sashiko-bot
2026-10-16 10:18 ` [PATCH 0/2] perf: Order SPE and TRBE " James Clark

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=20261127211413.GH861809@e132581.arm.com \
    --to=leo.yan@arm.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=anshuman.khandual@arm.com \
    --cc=coresight@lists.linaro.org \
    --cc=james.clark@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=mike.leach@arm.com \
    --cc=suzuki.poulose@arm.com \
    --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