[PATCH 0/3] perf: arm_spe: Add support for a 'software' discard mode
James Clark
james.clark at linaro.org
Wed Aug 5 08:01:50 PDT 2026
Add a mode similar to discard mode that we get in SPE V1P2, but without
requiring hardware support. It works by allocating a single page in the
driver when opening the event so the buffer can still be programmed and
SPE enabled. The same page is mapped multiple times to make up a 4MB
buffer so the full interrupt is serviced less frequently.
Unfortunately we can't rely on userspace to do the allocation because
the existing HW discard mode came with the relaxation that an event can
be opened without mapping a buffer. Therefore adding SW discard mode
without doing the allocation in the driver would break old tools. It
will also be useful for very simple tools that only do raw
perf_event_open() calls and don't want to mess around with mmaps. Tools
also can't do the hack to present a 4MB buffer to hardware while only
being backed by a single page.
Discard mode is used to activate SPE related PMU events so that they can
be counted by the PMU, without the overhead of collecting any SPE data.
So it's likely that simple tools are using discard mode with only raw
perf_event_open() calls.
Signed-off-by: James Clark <james.clark at linaro.org>
---
James Clark (3):
perf: arm_spe: Factor aux output and flags out of buffer fault handler
perf: arm_spe: Factor HW discard mode out of arm_spe_perf_aux_output_begin()
perf: arm_spe: Add support for a 'software' discard mode
drivers/perf/arm_spe_pmu.c | 208 ++++++++++++++++++++++++++++++++++++---------
1 file changed, 168 insertions(+), 40 deletions(-)
---
base-commit: 075b74841bd0065a3bda3440873c747938e69b68
change-id: 20260804-james-spe-software-discard-87691ce1a949
Best regards,
--
James Clark <james.clark at linaro.org>
More information about the linux-arm-kernel
mailing list