Re: Syncing include/linux/coresight-pmu.h with its copy in tools/perf
From: James Clark
Date: Fri Mar 06 2026 - 06:28:15 EST
On 05/03/2026 8:26 pm, Arnaldo Carvalho de Melo wrote:
Hi,
Right now we have this perf build warning:
diff -u tools/include/linux/coresight-pmu.h include/linux/coresight-pmu.h
But when I try to update it it explodes, can someone in the ARM front
take a look at it?
Thanks,
- Arnaldo
Sent "[PATCH 0/2] perf cs-etm: Finish removal of ETM_OPT_*" to fix that and update the header.
Thanks
James
⬢ [acme@toolbx perf-tools]$ m
make: Entering directory '/home/acme/git/perf-tools/tools/perf'
BUILD: Doing 'make -j32' parallel build
Warning: Kernel ABI header differences:
diff -u tools/arch/x86/include/uapi/asm/svm.h arch/x86/include/uapi/asm/svm.h
diff -u tools/include/linux/coresight-pmu.h include/linux/coresight-pmu.h
diff -u tools/arch/x86/include/asm/amd/ibs.h arch/x86/include/asm/amd/ibs.h
diff -u tools/arch/arm64/include/asm/cputype.h arch/arm64/include/asm/cputype.h
Auto-detecting system features:
... libdw: [ on ]
... glibc: [ on ]
... libelf: [ on ]
... libnuma: [ on ]
... numa_num_possible_cpus: [ on ]
... libpython: [ on ]
... libcapstone: [ on ]
... llvm-perf: [ on ]
... zlib: [ on ]
... lzma: [ on ]
... bpf: [ on ]
... libaio: [ on ]
... libzstd: [ on ]
... libopenssl: [ on ]
... rust: [ on ]
INSTALL libsubcmd_headers
INSTALL libapi_headers
INSTALL libperf_headers
INSTALL libsymbol_headers
INSTALL libbpf_headers
INSTALL binaries
INSTALL tests
INSTALL libperf-jvmti.so
INSTALL libexec
INSTALL perf-archive
INSTALL perf-iostat
INSTALL python-scripts
INSTALL dlfilters
INSTALL perf_completion-script
INSTALL perf-tip
make: Leaving directory '/home/acme/git/perf-tools/tools/perf'
⬢ [acme@toolbx perf-tools]$ diff -u tools/include/linux/coresight-pmu.h include/linux/coresight-pmu.h
--- tools/include/linux/coresight-pmu.h 2025-06-16 13:19:13.119223002 -0300
+++ include/linux/coresight-pmu.h 2026-02-21 18:08:24.737530149 -0300
@@ -22,30 +22,6 @@
#define CORESIGHT_LEGACY_CPU_TRACE_ID(cpu) (0x10 + (cpu * 2))
/*
- * Below are the definition of bit offsets for perf option, and works as
- * arbitrary values for all ETM versions.
- *
- * Most of them are orignally from ETMv3.5/PTM's ETMCR config, therefore,
- * ETMv3.5/PTM doesn't define ETMCR config bits with prefix "ETM3_" and
- * directly use below macros as config bits.
- */
-#define ETM_OPT_BRANCH_BROADCAST 8
-#define ETM_OPT_CYCACC 12
-#define ETM_OPT_CTXTID 14
-#define ETM_OPT_CTXTID2 15
-#define ETM_OPT_TS 28
-#define ETM_OPT_RETSTK 29
-
-/* ETMv4 CONFIGR programming bits for the ETM OPTs */
-#define ETM4_CFG_BIT_BB 3
-#define ETM4_CFG_BIT_CYCACC 4
-#define ETM4_CFG_BIT_CTXTID 6
-#define ETM4_CFG_BIT_VMID 7
-#define ETM4_CFG_BIT_TS 11
-#define ETM4_CFG_BIT_RETSTK 12
-#define ETM4_CFG_BIT_VMID_OPT 15
-
-/*
* Interpretation of the PERF_RECORD_AUX_OUTPUT_HW_ID payload.
* Used to associate a CPU with the CoreSight Trace ID.
* [07:00] - Trace ID - uses 8 bits to make value easy to read in file.
⬢ [acme@toolbx perf-tools]$ cp include/linux/coresight-pmu.h tools/include/linux/coresight-pmu.h
⬢ [acme@toolbx perf-tools]$ m
make: Entering directory '/home/acme/git/perf-tools/tools/perf'
BUILD: Doing 'make -j32' parallel build
Warning: Kernel ABI header differences:
diff -u tools/arch/x86/include/uapi/asm/svm.h arch/x86/include/uapi/asm/svm.h
diff -u tools/arch/x86/include/asm/amd/ibs.h arch/x86/include/asm/amd/ibs.h
diff -u tools/arch/arm64/include/asm/cputype.h arch/arm64/include/asm/cputype.h
Auto-detecting system features:
... libdw: [ on ]
... glibc: [ on ]
... libelf: [ on ]
... libnuma: [ on ]
... numa_num_possible_cpus: [ on ]
... libpython: [ on ]
... libcapstone: [ on ]
... llvm-perf: [ on ]
... zlib: [ on ]
... lzma: [ on ]
... bpf: [ on ]
... libaio: [ on ]
... libzstd: [ on ]
... libopenssl: [ on ]
... rust: [ on ]
INSTALL libsubcmd_headers
INSTALL libperf_headers
INSTALL libapi_headers
INSTALL libsymbol_headers
INSTALL libbpf_headers
CC /tmp/build/perf-tools/util/cs-etm-decoder/cs-etm-decoder.o
CC /tmp/build/perf-tools/util/cs-etm.o
LD /tmp/build/perf-tools/util/cs-etm-decoder/perf-util-in.o
In file included from /home/acme/git/perf-tools/tools/include/linux/bits.h:5,
from /home/acme/git/perf-tools/tools/include/linux/bitops.h:14,
from util/cs-etm.c:10:
util/cs-etm.c: In function ‘cs_etm__init_pid_fmt’:
util/cs-etm.c:213:31: error: ‘ETM_OPT_CTXTID’ undeclared (first use in this function)
213 | if (val & BIT(ETM_OPT_CTXTID))
| ^~~~~~~~~~~~~~
/home/acme/git/perf-tools/tools/include/vdso/bits.h:7:44: note: in definition of macro ‘BIT’
7 | #define BIT(nr) (UL(1) << (nr))
| ^~
util/cs-etm.c:213:31: note: each undeclared identifier is reported only once for each function it appears in
213 | if (val & BIT(ETM_OPT_CTXTID))
| ^~~~~~~~~~~~~~
/home/acme/git/perf-tools/tools/include/vdso/bits.h:7:44: note: in definition of macro ‘BIT’
7 | #define BIT(nr) (UL(1) << (nr))
| ^~
util/cs-etm.c:218:32: error: ‘ETM4_CFG_BIT_VMID’ undeclared (first use in this function)
218 | if (val & (BIT(ETM4_CFG_BIT_VMID) | BIT(ETM4_CFG_BIT_VMID_OPT)))
| ^~~~~~~~~~~~~~~~~
/home/acme/git/perf-tools/tools/include/vdso/bits.h:7:44: note: in definition of macro ‘BIT’
7 | #define BIT(nr) (UL(1) << (nr))
| ^~
util/cs-etm.c:218:57: error: ‘ETM4_CFG_BIT_VMID_OPT’ undeclared (first use in this function)
218 | if (val & (BIT(ETM4_CFG_BIT_VMID) | BIT(ETM4_CFG_BIT_VMID_OPT)))
| ^~~~~~~~~~~~~~~~~~~~~
/home/acme/git/perf-tools/tools/include/vdso/bits.h:7:44: note: in definition of macro ‘BIT’
7 | #define BIT(nr) (UL(1) << (nr))
| ^~
util/cs-etm.c:221:36: error: ‘ETM4_CFG_BIT_CTXTID’ undeclared (first use in this function)
221 | else if (val & BIT(ETM4_CFG_BIT_CTXTID))
| ^~~~~~~~~~~~~~~~~~~
/home/acme/git/perf-tools/tools/include/vdso/bits.h:7:44: note: in definition of macro ‘BIT’
7 | #define BIT(nr) (UL(1) << (nr))
| ^~
util/cs-etm.c: In function ‘cs_etm__setup_timeless_decoding’:
util/cs-etm.c:2934:65: error: ‘ETM_OPT_TS’ undeclared (first use in this function)
2934 | !(evsel->core.attr.config & BIT(ETM_OPT_TS));
| ^~~~~~~~~~
/home/acme/git/perf-tools/tools/include/vdso/bits.h:7:44: note: in definition of macro ‘BIT’
7 | #define BIT(nr) (UL(1) << (nr))
| ^~
make[4]: *** [/home/acme/git/perf-tools/tools/build/Makefile.build:95: /tmp/build/perf-tools/util/cs-etm.o] Error 1
make[3]: *** [/home/acme/git/perf-tools/tools/build/Makefile.build:158: util] Error 2
make[2]: *** [Makefile.perf:797: /tmp/build/perf-tools/perf-util-in.o] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile.perf:289: sub-make] Error 2
make: *** [Makefile:119: install-bin] Error 2
make: Leaving directory '/home/acme/git/perf-tools/tools/perf'
⬢ [acme@toolbx perf-tools]$