Hi Johnny,
On Mon, Nov 02, 2026 at 04:41:52PM +0800, Johnny.Fan wrote:
[...]
> Group the CPUs by (hetero id, interrupt) and register one platform
> device per group. A GSI may be shared between groups with
> non-overlapping CPU masks, so only unregister the GSI mapping once no
> successfully registered device uses it, as the mapping is not reference
> counted.
This is fine for me in general. For CPU grouping, we would prefter to
use MIDR rather than hetid, as events should be able to migrate between
CPUs with the same MIDR.
My concern is that we need particular change in SPE/TRBE drivers to
retrieve IRQ affinity based on this change. It is better to improve
fwnode layer to provide a general way for retrieve IRQ affinity. I did
a bit experiment with using swnode and seems it makes sense.
I would also consolidate CPU PMU device registration. That means we need
to extend the device registration to support SPI. We also need to update
PMU platform driver for ACPI device probe.
Based on above idea, I would fold your patch into my series (but I will
drop the first patch for changing TRBE/SPE drivers). I will keep you as
the author but please bear me a bit that I may refactor it to fit into
the extensions. Hope this is fine for you.
Thanks,
Leo
From: Arnaldo Carvalho de Melo <acme(a)redhat.com>
Hi,
Please consider merging,
Nothing measured how much of perf the test suite reaches. Patch 1 adds
tools/perf/scripts/coverage.sh: it builds perf with clang source based
coverage, runs the complete perf test suite and reports line and function
coverage, optionally against a baseline, with --table and --html like
pahole's coverage_table.py. Also as 'make -C tools/perf coverage',
'coverage-prep' and 'coverage-table'.
The rest is what the first runs found, in the code, the build and the
tests:
- clang DWARF 5 describes globals with DW_OP_addrx, which was not
resolved (patch 2).
- The flexible array member had no test; one showed the struct row at
0.00% while the member said 100.00% (patches 3-4).
- A struct pointer that -O2 keeps in a register was not resolved from
its DWARF location (patch 5).
- --insn-stat was printed before the loop that accounts the samples,
so --code-with-type showed zeros (patch 6).
- The libbfd probe printed a missing bfd.h error five times per
build-test run (patch 7).
- FEATURE-DUMP didn't record llvm-perf and rust, disabling both in the
build-test builds (patch 8).
- GCC 16 caught an uninitialized T32 instruction buffer read in cs-etm
(patch 9).
- The Intel PT virtual LBR check lost every aux sample with a single
data page (patch 10).
- The dlfilter test kept samples whose IP the kernel now zeroes on a
userspace-to-kernel skid (patch 11).
- The LBR inline unwinding check failed instead of skipping when the
AMD PMU rejects branch sampling (patch 12).
In a root run on this box the suite covered 49.16% of perf's 201,180
lines; three tests failed in code this series does not change (the
POLL_HUP tracepoint regression, the AMD BRS branch sampling rejection
and the lock contention count).
The harness and the tests were developed with an AI coding assistant
(OpenCode), which drafted the script and the tests and helped debug the
failures; I reviewed every change and reproduced each failure before
fixing it.
Best regards,
- Arnaldo
Arnaldo Carvalho de Melo (12):
perf scripts: Add a coverage harness for perf
perf annotate-data: Resolve DW_OP_addrx global variables
perf tests: Exercise the flexible array member path
perf annotate-data: Count flexible array accesses for the whole struct
perf tests: Exercise data type resolution from a register
perf annotate: Print the stats after the annotations
perf tests: Silence the libbfd probe in build-test
perf build: Record the display-only features in FEATURE-DUMP
perf cs-etm: Fall back to the recorded instruction size on a failed read
perf tests: Fix the Intel PT virtual LBR check
perf test: Drop samples without an IP in the dlfilter test
perf test: Skip the LBR inline unwinding check when unsupported
tools/perf/.gitignore | 1 +
tools/perf/Makefile | 11 +-
tools/perf/Makefile.config | 4 +
tools/perf/Makefile.perf | 4 +
tools/perf/builtin-annotate.c | 10 +-
tools/perf/scripts/coverage.sh | 703 ++++++++++++++++++
tools/perf/tests/make | 2 +-
tools/perf/tests/shell/addr2line_inlines.sh | 9 +-
tools/perf/tests/shell/annotate_stats.sh | 58 ++
.../perf/tests/shell/data_type_flex_array.sh | 142 ++++
.../tests/shell/data_type_profiling_clang.sh | 108 +++
tools/perf/tests/shell/data_type_register.sh | 120 +++
tools/perf/tests/shell/script_dlfilter.sh | 2 +-
tools/perf/tests/shell/test_intel_pt.sh | 9 +-
tools/perf/util/annotate-data.c | 24 +-
tools/perf/util/cs-etm.c | 7 +-
tools/perf/util/dwarf-aux.c | 42 +-
17 files changed, 1234 insertions(+), 22 deletions(-)
create mode 100755 tools/perf/scripts/coverage.sh
create mode 100755 tools/perf/tests/shell/annotate_stats.sh
create mode 100755 tools/perf/tests/shell/data_type_flex_array.sh
create mode 100755 tools/perf/tests/shell/data_type_profiling_clang.sh
create mode 100755 tools/perf/tests/shell/data_type_register.sh
base-commit: cc905a18a647a8e3ad42cd1596baa0e08fba26eb
--
2.56.0
Hi,
On Fri, Nov 13, 2026 at 07:46:41AM +0200, Igor Velkov wrote:
> Hi,
>
> Cortex-A55 (Amlogic S905X3) reports EDDEVID.PCSample = 0, so
> coresight-cpu-debug cannot use it. The PC is available through PMPCSR
> in the external PMU frame (debug frame + 0x20000, PMDEVID.PCSample = 1).
> A lab module reading PMPCSR caught the PC of a CPU stuck on a PCIe bus
> access with IRQs off; on this GICv2 SoC the stop IPI never reaches it.
>
> Two observations:
> - A panic notifier samples too late: the other CPUs are stopped by
> then, and on this SoC reading the PMU frame of a stopped CPU raises a
> synchronous external abort. Sampling on entry to smp_send_stop()
> works.
Arm ARM, section I5.3.48 PMPCSR mentions "PMPCSR is in the Core power
domain". The challenge is ensuring that the target core remains powered
_throughout_ the access; checking its power state beforehand still
leaves a race.
For example, with CPUidle enabled, a CPU can be powered off any time so
it still race even move sampling in smp_send_stop().
This seems to be the main challenge. I'll check a bit if any guidance
for safely accessing PMPCSR.
> - Marvell has an out-of-tree patch, "coresight: cpu-debug: Add support
> to dump PMPCSR" (2023, carried in linux-yocto); I could not find it
> on the lists.
>
> Is PMPCSR support in coresight-cpu-debug planned or welcome? And how
> should such a PMU frame be described in DT: arm,coresight-cpu-debug or
> a new compatible?
Would it make sense to describe external PMU frames in the PMU node
and have cpu-debug reference its phandle? As Suzuki mentioned, this
can be reviewed on patch.
Thanks,
Leo
Hi Ian,
On Thu, Nov 12, 2026 at 11:07:55PM -0800, Ian Rogers wrote:
[...]
> Hi Leo,
>
> After commit 9648f9fc3525 ("perf cs-etm: Synthesize exception entries
> separately from branches") in perf-tools-next, perf's build-test
> (`make -C tools/perf O=/tmp/build CORESIGHT=1`, i.e. `make_with_coresight_O`)
> with GCC 15.2.0 (`gcc (Debian 15.2.0-14) 15.2.0`, `-O3`) fails with:
>
> In function ‘cs_etm__t32_instr_size’,
> inlined from ‘cs_etm__instr_size’ at util/cs-etm.c:1390:10,
> inlined from ‘cs_etm__copy_insn’ at util/cs-etm.c:1572:21:
> util/cs-etm.c:1381:28: error: ‘instrBytes’ may be used uninitialized
> [-Werror=maybe-uninitialized]
> 1381 | return ((instrBytes[1] & 0xF8) >= 0xE8) ? 4 : 2;
> | ~~~~~~~~~~^~~
> util/cs-etm.c: In function ‘cs_etm__copy_insn’:
> util/cs-etm.c:1372:12: note: ‘instrBytes’ declared here
> 1372 | u8 instrBytes[2];
> | ^~~~~~~~~~
>
> The uninitialized `instrBytes` in cs_etm__t32_instr_size() is actually
> pre-existing from commit a7ee4d625ede ("perf cs-etm: Support for ARM
> A32/T32 instruction sets in CoreSight trace"): cs_etm__frontend_mem_access()
> (via __cs_etm__mem_access()) can return 0 without writing to instrBytes
> when thread__find_map(), map__dso(), or dso__data_read_offset() fails.
> The changes around cs_etm__copy_insn() in this patch just shifted GCC's
> -O3 inlining enough for it to inline __cs_etm__mem_access() and spot the
> uninitialized read of instrBytes[1].
>
> Zero-initializing `u8 instrBytes[2] = {};` (similar to instr16/instr32 in
> cs_etm__is_svc_instr()) or checking that cs_etm__frontend_mem_access() read
> ARRAY_SIZE(instrBytes) bytes before inspecting instrBytes[1] should fix it.
See the series to fix the issue:
https://lore.kernel.org/linux-perf-users/20261113-perf_fix_gcc15_failure-v1…
Thanks for sharing the log and analysis.
This series fixes the GCC 15 build failure reported by Ian Rogers [1]
(thanks, Ian!).
Two follow-up refactoring patches use the packet’s recorded instruction
size for stack events and centralize error checking for frontend
instruction reads.
[1] https://lore.kernel.org/linux-perf-users/20261030-perf_cs_etm_fix_non_taken…
Signed-off-by: Leo Yan <leo.yan(a)arm.com>
---
Leo Yan (3):
perf cs-etm: Initialize the Thumb instruction buffer
perf cs-etm: Use the packet instruction size for stack events
perf cs-etm: Check frontend instruction reads
tools/perf/util/cs-etm.c | 83 +++++++++++++++++++++++++++++-------------------
1 file changed, 51 insertions(+), 32 deletions(-)
---
base-commit: 4af65363b11fc4fe65fcb497f68bbe4f3e3a4d2c
change-id: 20261113-perf_fix_gcc15_failure-1e31233be802
Best regards,
--
Leo Yan <leo.yan(a)arm.com>
On 13/11/2026 02:49, Songwei Chai wrote:
> CORESIGHT_LAR and the CS_LOCK()/CS_UNLOCK() helpers implement the
> generic ARM CoreSight Software Lock Access Register sequence, which
> is also present on non-CoreSight-labelled components that follow the
> same architecture (e.g. the Qualcomm TGU). Keeping them private to
> coresight-priv.h forces such drivers to duplicate the exact same
> definitions instead of reusing them.
>
> Move CORESIGHT_LAR, CS_LOCK() and CS_UNLOCK() into the public
> include/linux/coresight.h so they can be shared outside of
> drivers/hwtracing/coresight/ as well.
>
> Suggested-by: Suzuki K Poulose <suzuki.poulose(a)arm.com>
> Signed-off-by: Songwei Chai <songwei.chai(a)oss.qualcomm.com>
> ---
> drivers/hwtracing/coresight/coresight-priv.h | 19 -------------------
> include/linux/coresight.h | 19 +++++++++++++++++++
> 2 files changed, 19 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h
> index dddac946659f..0d3f6229b282 100644
> --- a/drivers/hwtracing/coresight/coresight-priv.h
> +++ b/drivers/hwtracing/coresight/coresight-priv.h
> @@ -23,7 +23,6 @@ extern const struct device_type coresight_dev_type[];
> #define CORESIGHT_ITCTRL 0xf00
> #define CORESIGHT_CLAIMSET 0xfa0
> #define CORESIGHT_CLAIMCLR 0xfa4
> -#define CORESIGHT_LAR 0xfb0
> #define CORESIGHT_LSR 0xfb4
> #define CORESIGHT_DEVARCH 0xfbc
> #define CORESIGHT_AUTHSTATUS 0xfb8
Move all of these register defs above to linux/coresight.h. We can keep
them in a central place, in linux/coresight.h and drop patch 3
Suzuki
Hi Igor
On 13/11/2026 05:46, Igor Velkov wrote:
> Hi,
>
> Cortex-A55 (Amlogic S905X3) reports EDDEVID.PCSample = 0, so
> coresight-cpu-debug cannot use it. The PC is available through PMPCSR
> in the external PMU frame (debug frame + 0x20000, PMDEVID.PCSample = 1).
> A lab module reading PMPCSR caught the PC of a CPU stuck on a PCIe bus
> access with IRQs off; on this GICv2 SoC the stop IPI never reaches it.
>
> Two observations:
> - A panic notifier samples too late: the other CPUs are stopped by
> then, and on this SoC reading the PMU frame of a stopped CPU raises a
> synchronous external abort. Sampling on entry to smp_send_stop()
> works.
> - Marvell has an out-of-tree patch, "coresight: cpu-debug: Add support
> to dump PMPCSR" (2023, carried in linux-yocto); I could not find it
> on the lists.
>
> Is PMPCSR support in coresight-cpu-debug planned or welcome? And how
Patches are definitely welcome, as such I don't know of anyone working
on it from within Arm. So, please go ahead and post it.
> should such a PMU frame be described in DT: arm,coresight-cpu-debug or
> a new compatible?
If the support can be detected using the "standard" cpu-debug frame,
via the DEVID registers, I don't think we need a new compatible.
But we can debate on it with the patch review.
Cheers
Suzuki
>
> Thanks,
> Igor
Concurrent per-thread events results in a WARN on N1SDP which leads to
the realization that per-thread events shouldn't have been sharing sinks
in the first place.
This slips through because different per-thread events will have the
same PID if owned by the same process, and we only check the PID and
nothing else. That results in unexpected WARNs because it looks like we
assumed it couldn't happen (although exclusive PMU rules allow it). But
even if it was supported it would result in trace from the wrong thread
in another event's per-thread buffer, so we should disallow it.
Fix it by determining if sharing can happen at setup time. Then remove
everywhere the same PID checking logic was copy pasted in each sink.
The first three patches fix configuration initialization, AUX cleanup
and topology locking. The remaining patches enforce the sharing rules
and simplify the sink drivers.
Signed-off-by: James Clark <james.clark(a)linaro.org>
---
Changes in v4:
- Count CPU sources in the registered topology and retain each sink's
sharing classification until its last AUX session ends.
- Serialize AUX topology access and provide locked and locking path
release functions.
- Reject unexpected path setup errors while retaining silent skips for
missing ETMs and unreachable sinks.
- Prevent all problematic sharing cases at aux setup rather than at
runtime. (Leo)
- Drop "coresight: tmc-etr: Don't stop Perf cleanup for active sysfs
reads". It was a pre-existing bug and is even more unrelated now with
the new model.
- Remove workqueue rather than fix the lifecycle, its no longer
needed. (Leo)
- Add a getter for the config manager, cscfg_get_state(). (Leo)
- Link to v3: https://lore.kernel.org/r/20260728-james-cs-multiple-per-threads-v3-0-6aee7…
Changes in v3:
- Storing and accessing event owners at runtime causes problems due to
various scenarios of: events (and sibling events) exiting, children
inheriting event FDs, PID reuse, CPU affine events that also have a
target process set but different inherit settings. Fix it by creating
a session ID in etm_setup_aux() and holding the references in it for
the duration of the whole session. (Leo)
- Make the ETR buffer allocator consistent with sink sharing rules by
not doing numeric PID comparisons there either.
- Fix up some Sashiko reports that it sees after interacting with cscfg
and taking extra references to tasks and PIDs.
- Link to v2: https://lore.kernel.org/r/20260709-james-cs-multiple-per-threads-v2-0-10ac7…
Changes in v2:
- Fix inherited events by following event->parent
- Link to v1: https://lore.kernel.org/r/20260709-james-cs-multiple-per-threads-v1-0-d384e…
---
James Clark (10):
coresight: configfs: Don't assume active until cscfg_mgr is set
coresight: etm-perf: Remove workqueue for freeing AUX data
coresight: etm-perf: Serialize AUX topology access
coresight: etm-perf: Reject event if building path fails
coresight: etm-perf: Prevent sink sharing at setup time
coresight: tmc-etr: Reflect new sharing rules in allocator
coresight: tmc-etr: Remove sharing guards from ETR
coresight: tmc-etf: Remove sharing guards from ETF
coresight: etb10: Remove sharing guards from ETB10
coresight: ultrasoc-smb: Remove sharing guards from SMB
drivers/hwtracing/coresight/coresight-core.c | 104 +++++++++++++++--
drivers/hwtracing/coresight/coresight-etb10.c | 28 +----
drivers/hwtracing/coresight/coresight-etm-perf.c | 119 ++++++++++---------
drivers/hwtracing/coresight/coresight-etm-perf.h | 2 -
drivers/hwtracing/coresight/coresight-priv.h | 4 +-
drivers/hwtracing/coresight/coresight-syscfg.c | 11 +-
drivers/hwtracing/coresight/coresight-sysfs.c | 4 +-
drivers/hwtracing/coresight/coresight-tmc-core.c | 6 +-
drivers/hwtracing/coresight/coresight-tmc-etf.c | 22 +---
drivers/hwtracing/coresight/coresight-tmc-etr.c | 142 +++++++----------------
drivers/hwtracing/coresight/coresight-tmc.h | 16 +--
drivers/hwtracing/coresight/coresight-trace-id.c | 97 ++++++++++++++--
drivers/hwtracing/coresight/coresight-trace-id.h | 26 +++--
drivers/hwtracing/coresight/ultrasoc-smb.c | 20 +---
drivers/hwtracing/coresight/ultrasoc-smb.h | 3 -
include/linux/coresight.h | 26 ++++-
16 files changed, 346 insertions(+), 284 deletions(-)
---
base-commit: 343cfcbb3ecfdb80aa576a428cfa3b65ad783842
change-id: 20260708-james-cs-multiple-per-threads-ed1d25ed1734
Best regards,
--
James Clark <james.clark(a)linaro.org>