From: James Clark <james.clark@linaro.org>
To: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>, Leo Yan <leo.yan@arm.com>,
Suzuki Poulose <Suzuki.Poulose@arm.com>,
Al Grant <Al.Grant@arm.com>,
linux-arm-kernel@lists.infradead.org,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] perf: arm_spe: Factor HW discard mode out of arm_spe_perf_aux_output_begin()
Date: Mon, 5 Oct 2026 10:31:48 +0100 [thread overview]
Message-ID: <9c5e1aa7-4e0f-4576-b322-b4594cdea5b0@linaro.org> (raw)
In-Reply-To: <asNfh-qywjOPxajj@willie-the-truck>
On 05/10/2026 09:27, Will Deacon wrote:
> On Wed, Aug 05, 2026 at 04:01:52PM +0100, James Clark wrote:
>> Discard mode doesn't call perf_aux_output_begin() or emit aux records,
>> and enabling it never fails. We'll add a second discard mode in the
>> next commit so it will be cleaner if there is a separate begin function
>> just for discard mode.
>>
>> No functional changes intended.
>
> [...]
>
>> +static void arm_spe_pmu_begin_discard(struct perf_output_handle *handle,
>> + struct perf_event *event)
>> +{
>> + u64 limit;
>> +
>> + limit = FIELD_PREP(PMBLIMITR_EL1_FM, PMBLIMITR_EL1_FM_DISCARD);
>> + limit |= PMBLIMITR_EL1_E;
>> +
>> + write_sysreg_s(limit, SYS_PMBLIMITR_EL1);
>> +}
>> +
>> static int arm_spe_perf_aux_output_begin(struct perf_output_handle *handle,
>> struct perf_event *event)
>> {
>> u64 base, limit;
>> struct arm_spe_pmu_buf *buf;
>
> Is it worth checking that we have a discard event in begin_discard() and
> similarly that we don't have a discard event in output_begin()? It looks
> like quite an error-prone interface for the caller, otherwise.
>
Makes sense, I can add that.
>> @@ -775,6 +785,12 @@ static irqreturn_t arm_spe_pmu_irq_handler(int irq, void *dev)
>> arm_spe_pmu_disable_and_drain_local();
>> break;
>> case SPE_PMU_BUF_FAULT_ACT_OK:
>> + if (arm_spe_discard_mode(event)) {
>> + arm_spe_pmu_begin_discard(handle, event);
>> + isb();
>> + break;
>> + }
>
> This looks like new behaviour?
>
> Will
I just extracted the discard part of arm_spe_perf_aux_output_begin()
into here and arm_spe_pmu_begin_discard(). The PMBLIMITR_EL1 write and
isb() should be the same.
Do you mean that now it does arm_spe_pmu_begin_discard() unconditionally
before checking PERF_AUX_FLAG_TRUNCATED? Truncated would never be set in
HW discard mode, so it should be equivalent. And the IRQ would never
fire anyway so we don't get here until SW discard is added, and even if
it did, handle->event is NULL so the handler would exit on the first
line anyway.
I suppose there's another change that it can never call
arm_spe_pmu_stop()? But that wouldn't have happened in discard mode either.
James
next prev parent reply other threads:[~2026-10-05 9:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-05 15:01 [PATCH 0/3] perf: arm_spe: Add support for a 'software' discard mode James Clark
2026-08-05 15:01 ` [PATCH 1/3] perf: arm_spe: Factor aux output and flags out of buffer fault handler James Clark
2026-08-05 15:01 ` [PATCH 2/3] perf: arm_spe: Factor HW discard mode out of arm_spe_perf_aux_output_begin() James Clark
2026-10-05 8:27 ` Will Deacon
2026-10-05 9:31 ` James Clark [this message]
2026-08-05 15:01 ` [PATCH 3/3] perf: arm_spe: Add support for a 'software' discard mode 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=9c5e1aa7-4e0f-4576-b322-b4594cdea5b0@linaro.org \
--to=james.clark@linaro.org \
--cc=Al.Grant@arm.com \
--cc=Suzuki.Poulose@arm.com \
--cc=leo.yan@arm.com \
--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=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