[PATCH v2 11/14] perf tests: Check CoreSight IRQ entry and exit

Leo Yan leo.yan at arm.com
Thu Oct 29 11:03:35 PDT 2026


On Tue, Sep 29, 2026 at 01:22:55PM +0100, James Clark wrote:
> 
> On 23/09/2026 16:21, Leo Yan wrote:
> > Add an AArch64 branch_not_taken_loop workload and a CoreSight shell test
> > checking IRQ entry and exit PCs. Use cpu-clock generates timer
> > interrupts.
> > 
> > Retry at different timer frequencies and skip if no complete pair is
> > captured.
> 
> Maybe we need to look into storing existing recordings somewhere or
> committing small ones into the repo again. This test took 3 minutes to run
> on my N1SDP, which is 3x longer than the entire Coresight suite, and then it
> skipped anyway:
> 
> 173: CoreSight IRQ entry and exit:
> ---- start ----
> test child forked, pid 6804
> Recording timer IRQs at 1000 Hz
> No complete exception entry/exit pair
> No complete IRQ pair in this recording
> Recording timer IRQs at 4000 Hz
> No complete exception entry/exit pair
> No complete IRQ pair in this recording
> Recording timer IRQs at 10000 Hz
> No complete exception entry/exit pair
> No complete IRQ pair in this recording
> [Skip] No complete IRQ pair after three recordings
> ---- end(-2) ----
> 173: CoreSight IRQ entry and exit
> 
> 
> Really this test is only looking for how a single exception on a single
> branch is decoded, it shouldn't be affected by how it was recorded. Even a
> few bytes of trace would be enough to test it. Or maybe we could add some
> kind of unit test framework that mocks out OpenCSD and allows us to script
> how different packets affect the decoder?

As discussed I will reduce the loop in branch_not_taken_loop.c and
don't skip the test if no IRQ pair found.

> > +++ b/tools/perf/tests/shell/coresight/irq_entry_exit.sh
> > @@ -0,0 +1,37 @@
> > +#!/bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +# CoreSight IRQ entry and exit (exclusive)
> > +
> > +# shellcheck source=../lib/coresight_exception.sh
> 
> No need for these anymore, see https://lore.kernel.org/linux-perf-users/20260921-james-perf-shellcheck-source-v1-1-adcfc107c997@linaro.org/

Will do.

> > +record_trace_with_cpu_clock()
> > +{
> > +	local clock_opts=()
> > +
> > +	record_freq=$1
> > +	shift
> > +
> > +	# A zero frequency omits the cpu-clock event.
> > +	if [ "$record_freq" -gt 0 ]; then
> > +		# Generate timer IRQs without delivering a signal to the workload.
> > +		clock_opts=(-e cpu-clock:u -F "$record_freq")
> > +	fi
> > +
> > +	# FIFO control bounds the trace to the workload.
> > +	# --kcore supplies the running kernel's instructions for decoding.
> > +	taskset -c "$cpu" perf record -B --no-bpf-event --per-thread --kcore \
> > +		-e cs_etm/timestamp=0/uk "${clock_opts[@]}" \
> > +		-m,4M -D -1 --control fifo:"$tmpdir/ctl","$tmpdir/ack" \
> > +		-o "$tmpdir/data" -- \
> > +		perf test --record-ctl fifo:"$tmpdir/ctl","$tmpdir/ack" -w "$@" \
> > +		> "$tmpdir/record.log" 2>&1
> 
> There's a shellcheck warning here:
> 
>   (warning): Word is of the form "A"B"C" (B indicated). Did you mean "ABC"
> or "A\"B\"C"?
> 
> You can avoid it by passing the whole path as "$cf" and "$af" like the other
> coresight tests.

Will do. Thanks for suggestions!



More information about the linux-arm-kernel mailing list