Skip to contentSkip to conversation

Remove NO_AUXTRACE build option

PATCH Applied Ian Rogers 3 participants 10 messages Nov 10, 2025 – Nov 14, 2025

Subsystems (5)
lore
Share & tools
lore

Ian Rogers

author reviewer
#0 lore raw

cover Remove NO_AUXTRACE build option

Switch the __get_cpuid feature for intel-pt to use the provided cpuid function in perf, this removes the need for NO_AUXTRACE when the feature detection fails. Remove the now unnecessary feature detection. Remove NO_AUXTRACE as it just builds a more broken version of perf and isn't guarding dependencies on any libraries, etc. Clean up headers files for auxtrace.h.

This was prompted by needing to make a v2 patch set of:
https://lore.kernel.org/lkml/[email protected]/
due to a broken NO_AUXTRACE configuration.

Ian Rogers (5):
perf intel-pt: Use the perf provided "cpuid.h"
perf build: Don't add NO_AUXTRACE if missing feature-get_cpuid tool build: Remove __get_cpuid feature test
perf build: Remove NO_AUXTRACE build option
perf auxtrace: Remove errno.h from auxtrace.h and fix transitive
dependencies

 tools/build/Makefile.feature                  |   2 -
 tools/build/feature/Makefile                  |   4 -
 tools/build/feature/test-all.c                |   5 -
 tools/build/feature/test-get_cpuid.c          |   8 -
 tools/perf/Documentation/perf-check.txt       |   1 -
 tools/perf/Makefile.config                    |  13 --
 tools/perf/Makefile.perf                      |   2 -
 tools/perf/arch/arm/annotate/instructions.c   |   1 +
 tools/perf/arch/arm/util/Build                |   2 +-
 tools/perf/arch/arm/util/auxtrace.c           |   1 +
 tools/perf/arch/arm/util/pmu.c                |   2 -
 tools/perf/arch/arm64/annotate/instructions.c |   1 +
 tools/perf/arch/arm64/util/Build              |  19 +-
 tools/perf/arch/arm64/util/arm-spe.c          |   1 +
 tools/perf/arch/arm64/util/hisi-ptt.c         |   1 +
 tools/perf/arch/powerpc/util/Build            |   2 +-
 tools/perf/arch/powerpc/util/auxtrace.c       |   2 +-
 tools/perf/arch/s390/util/Build               |   2 +-
 tools/perf/arch/s390/util/auxtrace.c          |   1 +
 tools/perf/arch/x86/tests/Build               |   4 +-
 tools/perf/arch/x86/tests/arch-tests.c        |   4 -
 tools/perf/arch/x86/tests/intel-pt-test.c     |   6 +-
 tools/perf/arch/x86/tests/topdown.c           |   1 +
 tools/perf/arch/x86/util/Build                |   6 +-
 tools/perf/arch/x86/util/intel-pt.c           |   4 +-
 tools/perf/arch/x86/util/pmu.c                |   2 -
 tools/perf/arch/x86/util/topdown.c            |   1 +
 tools/perf/bench/evlist-open-close.c          |   1 +
 tools/perf/bench/futex.c                      |   1 +
 tools/perf/bench/pmu-scan.c                   |   1 +
 tools/perf/bench/synthesize.c                 |   1 +
 tools/perf/builtin-check.c                    |   1 -
 tools/perf/builtin-inject.c                   |  15 --
 tools/perf/builtin-mem.c                      |   1 +
 tools/perf/builtin-record.c                   |  36 ---
 tools/perf/builtin-script.c                   |  12 -
 tools/perf/tests/hwmon_pmu.c                  |   1 +
 tools/perf/tests/make                         |   4 +-
 tools/perf/tests/parse-metric.c               |   1 +
 tools/perf/tests/pfm.c                        |   1 +
 tools/perf/ui/hist.c                          |   1 +
 tools/perf/util/Build                         |  24 +-
 tools/perf/util/annotate-data.c               |   2 +-
 tools/perf/util/arm-spe-decoder/Build         |   2 +-
 tools/perf/util/auxtrace.h                    | 221 +-----------------
 tools/perf/util/bpf-filter.h                  |   2 +
 tools/perf/util/bpf-trace-summary.c           |   1 +
 tools/perf/util/bpf_counter_cgroup.c          |   1 +
 tools/perf/util/bpf_ftrace.c                  |   3 +-
 tools/perf/util/bpf_map.c                     |   1 +
 tools/perf/util/cgroup.c                      |   1 +
 tools/perf/util/cs-etm-decoder/Build          |   2 +-
 tools/perf/util/drm_pmu.c                     |   1 +
 tools/perf/util/evswitch.c                    |   1 +
 tools/perf/util/hisi-ptt-decoder/Build        |   2 +-
 tools/perf/util/intel-pt-decoder/Build        |   8 +-
 tools/perf/util/intel-tpebs.c                 |   1 +
 tools/perf/util/kvm-stat.h                    |   1 +
 tools/perf/util/mmap.c                        |   1 +
 tools/perf/util/pfm.c                         |   1 +
 tools/perf/util/powerpc-vpadtl.c              |   1 +
 tools/perf/util/stat-shadow.c                 |   1 +
 tools/perf/util/synthetic-events.h            |  15 --
 63 files changed, 77 insertions(+), 391 deletions(-)
 delete mode 100644 tools/build/feature/test-get_cpuid.c
Signature · 1 line
2.51.2.1041.gc1ab5b90ca-goog
author reviewer
#1 lore raw

PATCH 1/5 perf intel-pt: Use the perf provided "cpuid.h"

Rather than having a feature test and include of <cpuid.h> for the __get_cpuid function, use the cpuid function provided by tools/perf/arch/x86/util/cpuid.h.

---
 tools/perf/arch/x86/tests/intel-pt-test.c | 6 +++---
 tools/perf/arch/x86/util/intel-pt.c       | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)
tools/perf/arch/x86/tests/intel-pt-test.c +3 -3
index b217ed67cd4e..970997759ec2 100644
@@ -3,7 +3,6 @@
 #include <linux/compiler.h>
 #include <linux/bits.h>
 #include <string.h>
-#include <cpuid.h>
 #include <sched.h>
 
 #include "intel-pt-decoder/intel-pt-pkt-decoder.h"
@@ -11,6 +10,7 @@
 #include "debug.h"
 #include "tests/tests.h"
 #include "arch-tests.h"
+#include "../util/cpuid.h"
 #include "cpumap.h"
 
 /**
@@ -363,7 +363,7 @@ static int get_pt_caps(int cpu, struct pt_caps *caps)
 	memset(caps, 0, sizeof(*caps));
 
 	for (i = 0; i < INTEL_PT_SUBLEAF_CNT; i++) {
-		__get_cpuid_count(20, i, &r.eax, &r.ebx, &r.ecx, &r.edx);
+		cpuid(20, i, &r.eax, &r.ebx, &r.ecx, &r.edx);
 		pr_debug("CPU %d CPUID leaf 20 subleaf %d\n", cpu, i);
 		pr_debug("eax = 0x%08x\n", r.eax);
 		pr_debug("ebx = 0x%08x\n", r.ebx);
@@ -380,7 +380,7 @@ static bool is_hybrid(void)
 	unsigned int eax, ebx, ecx, edx = 0;
 	bool result;
 
-	__get_cpuid_count(7, 0, &eax, &ebx, &ecx, &edx);
+	cpuid(7, 0, &eax, &ebx, &ecx, &edx);
 	result = edx & BIT(15);
 	pr_debug("Is %shybrid : CPUID leaf 7 subleaf 0 edx %#x (bit-15 indicates hybrid)\n",
 		 result ? "" : "not ", edx);
tools/perf/arch/x86/util/intel-pt.c +2 -2
index 2d7c0dec86b0..b394ad9cc635 100644
@@ -12,7 +12,6 @@
 #include <linux/log2.h>
 #include <linux/zalloc.h>
 #include <linux/err.h>
-#include <cpuid.h>
 
 #include "../../../util/session.h"
 #include "../../../util/event.h"
@@ -34,6 +33,7 @@
 #include <internal/lib.h> // page_size
 #include "../../../util/intel-pt.h"
 #include <api/fs/fs.h>
+#include "cpuid.h"
 
 #define KiB(x) ((x) * 1024)
 #define MiB(x) ((x) * 1024 * 1024)
@@ -311,7 +311,7 @@ static void intel_pt_tsc_ctc_ratio(u32 *n, u32 *d)
 {
 	unsigned int eax = 0, ebx = 0, ecx = 0, edx = 0;
 
-	__get_cpuid(0x15, &eax, &ebx, &ecx, &edx);
+	cpuid(0x15, 0, &eax, &ebx, &ecx, &edx);
 	*n = ebx;
 	*d = eax;
 }
Signature · 1 line
2.51.2.1041.gc1ab5b90ca-goog
author reviewer
#2 lore raw

PATCH 2/5 perf build: Don't add NO_AUXTRACE if missing feature-get_cpuid

In reply to Ian Rogers

The intel-pt code dependent on __get_cpuid is no longer present so remove the feature test in the Makefile.config.

---
 tools/perf/Makefile.config | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
tools/perf/Makefile.config +2 -10
index 5700516aa84a..5decc3d5fef8 100644
@@ -1114,16 +1114,8 @@ ifndef NO_CAPSTONE
 endif
 
 ifndef NO_AUXTRACE
-  ifeq ($(SRCARCH),x86)
-    ifeq ($(feature-get_cpuid), 0)
-      $(warning Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc)
-      NO_AUXTRACE := 1
-    endif
-  endif
-  ifndef NO_AUXTRACE
-    $(call detected,CONFIG_AUXTRACE)
-    CFLAGS += -DHAVE_AUXTRACE_SUPPORT
-  endif
+  $(call detected,CONFIG_AUXTRACE)
+  CFLAGS += -DHAVE_AUXTRACE_SUPPORT
 endif
 
 ifdef EXTRA_TESTS
Signature · 1 line
2.51.2.1041.gc1ab5b90ca-goog
author reviewer
#3 lore raw

PATCH 3/5 tool build: Remove __get_cpuid feature test

In reply to Ian Rogers

This feature test is no longer used so remove.

The function tested by the feature test is used in:
tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c however, the Makefile just assumes the presence of the function and doesn't perform a build feature test for it.

---
 tools/build/Makefile.feature         | 2 --
 tools/build/feature/Makefile         | 4 ----
 tools/build/feature/test-all.c       | 5 -----
 tools/build/feature/test-get_cpuid.c | 8 --------
 4 files changed, 19 deletions(-)
 delete mode 100644 tools/build/feature/test-get_cpuid.c
tools/build/Makefile.feature +0 -2
index 32bbe29fe5f6..fc6abe369f73 100644
@@ -90,7 +90,6 @@ FEATURE_TESTS_BASIC :=                  \
         timerfd                         \
         zlib                            \
         lzma                            \
-        get_cpuid                       \
         bpf                             \
         scandirat			\
         sched_getcpu			\
@@ -146,7 +145,6 @@ FEATURE_DISPLAY ?=              \
          llvm-perf              \
          zlib                   \
          lzma                   \
-         get_cpuid              \
          bpf			\
          libaio			\
          libzstd
tools/build/feature/Makefile +0 -4
index 49b0add392b1..7c90e0d0157a 100644
@@ -56,7 +56,6 @@ FILES=                                          \
          test-lzma.bin                          \
          test-bpf.bin                           \
          test-libbpf.bin                        \
-         test-get_cpuid.bin                     \
          test-sdt.bin                           \
          test-cxx.bin                           \
          test-gettid.bin			\
@@ -318,9 +317,6 @@ $(OUTPUT)test-zlib.bin:
 $(OUTPUT)test-lzma.bin:
 	$(BUILD) -llzma
 
-$(OUTPUT)test-get_cpuid.bin:
-	$(BUILD)
-
 $(OUTPUT)test-bpf.bin:
 	$(BUILD)
 
tools/build/feature/test-all.c +0 -5
index 8a354b81417c..eb346160d0ba 100644
@@ -114,10 +114,6 @@
 # include "test-lzma.c"
 #undef main
 
-#define main main_test_get_cpuid
-# include "test-get_cpuid.c"
-#undef main
-
 #define main main_test_bpf
 # include "test-bpf.c"
 #undef main
@@ -168,7 +164,6 @@ int main(int argc, char *argv[])
 	main_test_pthread_attr_setaffinity_np();
 	main_test_pthread_barrier();
 	main_test_lzma();
-	main_test_get_cpuid();
 	main_test_bpf();
 	main_test_scandirat();
 	main_test_sched_getcpu();
tools/build/feature/test-get_cpuid.c deleted +0 -8
deleted file mode 100644
index bb4f065f28a6..000000000000
@@ -1,8 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include <cpuid.h>
-
-int main(void)
-{
-	unsigned int eax = 0, ebx = 0, ecx = 0, edx = 0;
-	return __get_cpuid(0x15, &eax, &ebx, &ecx, &edx);
-}
Signature · 1 line
2.51.2.1041.gc1ab5b90ca-goog
author reviewer
#4 lore raw

PATCH 4/5 perf build: Remove NO_AUXTRACE build option

In reply to Ian Rogers

The NO_AUXTRACE build option was used when the __get_cpuid feature test failed or if it was provided on the command line. The option no longer avoids a dependency on a library and so having the option is just adding complexity to the code base. Remove the option CONFIG_AUXTRACE from Build files and HAVE_AUXTRACE_SUPPORT by assuming it is always defined.

---
 tools/perf/Documentation/perf-check.txt |   1 -
 tools/perf/Makefile.config              |   5 -
 tools/perf/Makefile.perf                |   2 -
 tools/perf/arch/arm/util/Build          |   2 +-
 tools/perf/arch/arm/util/pmu.c          |   2 -
 tools/perf/arch/arm64/util/Build        |  19 +-
 tools/perf/arch/powerpc/util/Build      |   2 +-
 tools/perf/arch/s390/util/Build         |   2 +-
 tools/perf/arch/x86/tests/Build         |   4 +-
 tools/perf/arch/x86/tests/arch-tests.c  |   4 -
 tools/perf/arch/x86/util/Build          |   6 +-
 tools/perf/arch/x86/util/pmu.c          |   2 -
 tools/perf/builtin-check.c              |   1 -
 tools/perf/builtin-inject.c             |  15 --
 tools/perf/builtin-record.c             |  36 ----
 tools/perf/builtin-script.c             |  12 --
 tools/perf/tests/make                   |   4 +-
 tools/perf/util/Build                   |  24 +--
 tools/perf/util/arm-spe-decoder/Build   |   2 +-
 tools/perf/util/auxtrace.h              | 220 +-----------------------
 tools/perf/util/cs-etm-decoder/Build    |   2 +-
 tools/perf/util/hisi-ptt-decoder/Build  |   2 +-
 tools/perf/util/intel-pt-decoder/Build  |   8 +-
 tools/perf/util/synthetic-events.h      |  15 --
 24 files changed, 37 insertions(+), 355 deletions(-)
tools/perf/Documentation/perf-check.txt +0 -1
index 4c9ccda6ce91..09e1d35677f5 100644
@@ -50,7 +50,6 @@ feature::
                 dwarf                   /  HAVE_LIBDW_SUPPORT
                 dwarf_getlocations      /  HAVE_LIBDW_SUPPORT
                 dwarf-unwind            /  HAVE_DWARF_UNWIND_SUPPORT
-                auxtrace                /  HAVE_AUXTRACE_SUPPORT
                 libbfd                  /  HAVE_LIBBFD_SUPPORT
                 libbpf-strings          /  HAVE_LIBBPF_STRINGS_SUPPORT
                 libcapstone             /  HAVE_LIBCAPSTONE_SUPPORT
tools/perf/Makefile.config +0 -5
index 5decc3d5fef8..6b62fea21a0a 100644
@@ -1113,11 +1113,6 @@ ifndef NO_CAPSTONE
   endif
 endif
 
-ifndef NO_AUXTRACE
-  $(call detected,CONFIG_AUXTRACE)
-  CFLAGS += -DHAVE_AUXTRACE_SUPPORT
-endif
-
 ifdef EXTRA_TESTS
     $(call detected,CONFIG_EXTRA_TESTS)
     CFLAGS += -DHAVE_EXTRA_TESTS
tools/perf/Makefile.perf +0 -2
index afeb4e4a8a31..80decc7ce13c 100644
@@ -84,8 +84,6 @@ include ../scripts/utilities.mak
 #
 # Define NO_LZMA if you do not want to support compressed (xz) kernel modules
 #
-# Define NO_AUXTRACE if you do not want AUX area tracing support
-#
 # Define NO_LIBBPF if you do not want BPF support
 #
 # Define NO_LIBCAP if you do not want process capabilities considered by perf
tools/perf/arch/arm/util/Build +1 -1
index f7a8b37d1c68..fd695e1fdaee 100644
@@ -3,4 +3,4 @@ perf-util-y += perf_regs.o
 perf-util-$(CONFIG_LOCAL_LIBUNWIND)    += unwind-libunwind.o
 perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
 
-perf-util-$(CONFIG_AUXTRACE) += pmu.o auxtrace.o cs-etm.o
+perf-util-y += pmu.o auxtrace.o cs-etm.o
tools/perf/arch/arm/util/pmu.c +0 -2
index f70075c89aa0..9be8da5207f5 100644
@@ -20,7 +20,6 @@ void perf_pmu__arch_init(struct perf_pmu *pmu)
 {
 	struct perf_cpu_map *intersect, *online = cpu_map__online();
 
-#ifdef HAVE_AUXTRACE_SUPPORT
 	if (!strcmp(pmu->name, CORESIGHT_ETM_PMU_NAME)) {
 		/* add ETM default config here */
 		pmu->auxtrace = true;
@@ -39,7 +38,6 @@ void perf_pmu__arch_init(struct perf_pmu *pmu)
 		pmu->selectable = true;
 #endif
 	}
-#endif
 	/* Workaround some ARM PMU's failing to correctly set CPU maps for online processors. */
 	intersect = perf_cpu_map__intersect(online, pmu->cpus);
 	perf_cpu_map__put(online);
tools/perf/arch/arm64/util/Build +10 -9
index a74521b79eaa..d63881081d2e 100644
@@ -1,13 +1,14 @@
+perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
+perf-util-$(CONFIG_LIBTRACEEVENT) += kvm-stat.o
+perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o
+perf-util-y += ../../arm/util/auxtrace.o
+perf-util-y += ../../arm/util/cs-etm.o
+perf-util-y += ../../arm/util/pmu.o
+perf-util-y += arm-spe.o
 perf-util-y += header.o
+perf-util-y += hisi-ptt.o
 perf-util-y += machine.o
+perf-util-y += mem-events.o
 perf-util-y += perf_regs.o
-perf-util-y += tsc.o
 perf-util-y += pmu.o
-perf-util-$(CONFIG_LIBTRACEEVENT) += kvm-stat.o
-perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o
-perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
-
-perf-util-$(CONFIG_AUXTRACE) += ../../arm/util/pmu.o \
-			      ../../arm/util/auxtrace.o \
-			      ../../arm/util/cs-etm.o \
-			      arm-spe.o mem-events.o hisi-ptt.o
+perf-util-y += tsc.o
tools/perf/arch/powerpc/util/Build +1 -1
index a5b0babd307e..3d0d5427aef7 100644
@@ -10,4 +10,4 @@ perf-util-$(CONFIG_LIBDW) += skip-callchain-idx.o
 
 perf-util-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
 perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
-perf-util-$(CONFIG_AUXTRACE) += auxtrace.o
+perf-util-y += auxtrace.o
tools/perf/arch/s390/util/Build +1 -1
index 736c0ad09194..c64eb18dbdae 100644
@@ -7,4 +7,4 @@ perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
 perf-util-y += machine.o
 perf-util-y += pmu.o
 
-perf-util-$(CONFIG_AUXTRACE) += auxtrace.o
+perf-util-y += auxtrace.o
tools/perf/arch/x86/tests/Build +2 -2
index 7790b3e20f4e..b017d1ca6e3c 100644
@@ -3,9 +3,9 @@ perf-test-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
 
 perf-test-y += arch-tests.o
 perf-test-y += hybrid.o
-perf-test-$(CONFIG_AUXTRACE) += intel-pt-test.o
+perf-test-y += intel-pt-test.o
 ifeq ($(CONFIG_EXTRA_TESTS),y)
-perf-test-$(CONFIG_AUXTRACE) += insn-x86.o
+perf-test-y += insn-x86.o
 endif
 perf-test-$(CONFIG_X86_64) += bp-modify.o
 perf-test-y += amd-ibs-via-core-pmu.o
tools/perf/arch/x86/tests/arch-tests.c +0 -4
index 8f9cfeaa170f..c3e1619c5e79 100644
@@ -3,7 +3,6 @@
 #include "tests/tests.h"
 #include "arch-tests.h"
 
-#ifdef HAVE_AUXTRACE_SUPPORT
 #ifdef HAVE_EXTRA_TESTS
 DEFINE_SUITE("x86 instruction decoder - new instructions", insn_x86);
 #endif
@@ -19,7 +18,6 @@ struct test_suite suite__intel_pt = {
 	.test_cases = intel_pt_tests,
 };
 
-#endif
 #if defined(__x86_64__)
 DEFINE_SUITE("x86 bp modify", bp_modify);
 #endif
@@ -39,12 +37,10 @@ struct test_suite *arch_tests[] = {
 #ifdef HAVE_DWARF_UNWIND_SUPPORT
 	&suite__dwarf_unwind,
 #endif
-#ifdef HAVE_AUXTRACE_SUPPORT
 #ifdef HAVE_EXTRA_TESTS
 	&suite__insn_x86,
 #endif
 	&suite__intel_pt,
-#endif
 #if defined(__x86_64__)
 	&suite__bp_modify,
 #endif
tools/perf/arch/x86/util/Build +3 -3
index 06d7c0205b3d..c0dc5965f362 100644
@@ -14,7 +14,7 @@ perf-util-y += iostat.o
 perf-util-$(CONFIG_LOCAL_LIBUNWIND)    += unwind-libunwind.o
 perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
 
-perf-util-$(CONFIG_AUXTRACE) += auxtrace.o
+perf-util-y += auxtrace.o
 perf-util-y += archinsn.o
-perf-util-$(CONFIG_AUXTRACE) += intel-pt.o
-perf-util-$(CONFIG_AUXTRACE) += intel-bts.o
+perf-util-y += intel-pt.o
+perf-util-y += intel-bts.o
tools/perf/arch/x86/util/pmu.c +0 -2
index 58113482654b..a3f96221758d 100644
@@ -273,7 +273,6 @@ void perf_pmu__arch_init(struct perf_pmu *pmu)
 {
 	struct perf_pmu_caps *ldlat_cap;
 
-#ifdef HAVE_AUXTRACE_SUPPORT
 	if (!strcmp(pmu->name, INTEL_PT_PMU_NAME)) {
 		pmu->auxtrace = true;
 		pmu->selectable = true;
@@ -283,7 +282,6 @@ void perf_pmu__arch_init(struct perf_pmu *pmu)
 		pmu->auxtrace = true;
 		pmu->selectable = true;
 	}
-#endif
 
 	if (x86__is_amd_cpu()) {
 		if (strcmp(pmu->name, "ibs_op"))
tools/perf/builtin-check.c +0 -1
index 9ce2e71999df..d19769a8f689 100644
@@ -42,7 +42,6 @@ struct feature_status supported_features[] = {
 	FEATURE_STATUS("dwarf", HAVE_LIBDW_SUPPORT),
 	FEATURE_STATUS("dwarf_getlocations", HAVE_LIBDW_SUPPORT),
 	FEATURE_STATUS("dwarf-unwind", HAVE_DWARF_UNWIND_SUPPORT),
-	FEATURE_STATUS("auxtrace", HAVE_AUXTRACE_SUPPORT),
 	FEATURE_STATUS_TIP("libbfd", HAVE_LIBBFD_SUPPORT, "Deprecated, license incompatibility, use BUILD_NONDISTRO=1 and install binutils-dev[el]"),
 	FEATURE_STATUS("libbpf-strings", HAVE_LIBBPF_STRINGS_SUPPORT),
 	FEATURE_STATUS("libcapstone", HAVE_LIBCAPSTONE_SUPPORT),
tools/perf/builtin-inject.c +0 -15
index 044074080aa5..bd9245d2dd41 100644
@@ -239,8 +239,6 @@ static int perf_event__repipe_event_update(const struct perf_tool *tool,
 	return perf_event__repipe_synth(tool, event);
 }
 
-#ifdef HAVE_AUXTRACE_SUPPORT
-
 static int copy_bytes(struct perf_inject *inject, struct perf_data *data, off_t size)
 {
 	char buf[4096];
@@ -297,19 +295,6 @@ static s64 perf_event__repipe_auxtrace(const struct perf_tool *tool,
 	return event->auxtrace.size;
 }
 
-#else
-
-static s64
-perf_event__repipe_auxtrace(const struct perf_tool *tool __maybe_unused,
-			    struct perf_session *session __maybe_unused,
-			    union perf_event *event __maybe_unused)
-{
-	pr_err("AUX area tracing not supported\n");
-	return -EINVAL;
-}
-
-#endif
-
 static int perf_event__repipe(const struct perf_tool *tool,
 			      union perf_event *event,
 			      struct perf_sample *sample __maybe_unused,
tools/perf/builtin-record.c +0 -36
index fe10bb7f35cb..2584d0d8bc82 100644
@@ -730,8 +730,6 @@ static void record__sig_exit(void)
 	raise(signr);
 }
 
-#ifdef HAVE_AUXTRACE_SUPPORT
-
 static int record__process_auxtrace(const struct perf_tool *tool,
 				    struct mmap *map,
 				    union perf_event *event, void *data1,
@@ -889,40 +887,6 @@ static int record__auxtrace_init(struct record *rec)
 	return auxtrace_parse_filters(rec->evlist);
 }
 
-#else
-
-static inline
-int record__auxtrace_mmap_read(struct record *rec __maybe_unused,
-			       struct mmap *map __maybe_unused)
-{
-	return 0;
-}
-
-static inline
-void record__read_auxtrace_snapshot(struct record *rec __maybe_unused,
-				    bool on_exit __maybe_unused)
-{
-}
-
-static inline
-int auxtrace_record__snapshot_start(struct auxtrace_record *itr __maybe_unused)
-{
-	return 0;
-}
-
-static inline
-int record__auxtrace_snapshot_exit(struct record *rec __maybe_unused)
-{
-	return 0;
-}
-
-static int record__auxtrace_init(struct record *rec __maybe_unused)
-{
-	return 0;
-}
-
-#endif
-
 static int record__config_text_poke(struct evlist *evlist)
 {
 	struct evsel *evsel;
tools/perf/builtin-script.c +0 -12
index d813adbf9889..bd82315bdf8e 100644
@@ -2002,7 +2002,6 @@ static int perf_sample__fprintf_synth_iflag_chg(struct perf_sample *sample, FILE
 	return len + perf_sample__fprintf_pt_spacing(len, fp);
 }
 
-#ifdef HAVE_AUXTRACE_SUPPORT
 static int perf_sample__fprintf_synth_vpadtl(struct perf_sample *data, FILE *fp)
 {
 	struct powerpc_vpadtl_entry *dtl = (struct powerpc_vpadtl_entry *)data->raw_data;
@@ -2021,13 +2020,6 @@ static int perf_sample__fprintf_synth_vpadtl(struct perf_sample *data, FILE *fp)
 
 	return len;
 }
-#else
-static int perf_sample__fprintf_synth_vpadtl(struct perf_sample *data __maybe_unused,
-		FILE *fp __maybe_unused)
-{
-	return 0;
-}
-#endif
 
 static int perf_sample__fprintf_synth(struct perf_sample *sample,
 				      struct evsel *evsel, FILE *fp)
@@ -3649,7 +3641,6 @@ static int process_feature_event(const struct perf_tool *tool __maybe_unused,
 	return 0;
 }
 
-#ifdef HAVE_AUXTRACE_SUPPORT
 static int perf_script__process_auxtrace_info(const struct perf_tool *tool,
 					      struct perf_session *session,
 					      union perf_event *event)
@@ -3664,9 +3655,6 @@ static int perf_script__process_auxtrace_info(const struct perf_tool *tool,
 
 	return ret;
 }
-#else
-#define perf_script__process_auxtrace_info 0
-#endif
 
 static int parse_insn_trace(const struct option *opt __maybe_unused,
 			    const char *str, int unset __maybe_unused)
tools/perf/tests/make +1 -3
index b650ce8864ed..6641701e4828 100644
@@ -88,7 +88,6 @@ make_no_backtrace   := NO_BACKTRACE=1
 make_no_libcapstone := NO_CAPSTONE=1
 make_no_libnuma     := NO_LIBNUMA=1
 make_no_libbionic   := NO_LIBBIONIC=1
-make_no_auxtrace    := NO_AUXTRACE=1
 make_no_libbpf	    := NO_LIBBPF=1
 make_libbpf_dynamic := LIBBPF_DYNAMIC=1
 make_no_libbpf_DEBUG := NO_LIBBPF=1 DEBUG=1
@@ -121,7 +120,7 @@ make_static         := LDFLAGS=-static NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX3
 make_minimal        := NO_LIBPYTHON=1 NO_GTK2=1
 make_minimal        += NO_DEMANGLE=1 NO_LIBELF=1 NO_BACKTRACE=1
 make_minimal        += NO_LIBNUMA=1 NO_LIBBIONIC=1 NO_LIBDW=1
-make_minimal        += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1
+make_minimal        += NO_LIBDW_DWARF_UNWIND=1 NO_LIBBPF=1
 make_minimal        += NO_SDT=1 NO_JVMTI=1 NO_LIBZSTD=1
 make_minimal        += NO_LIBCAP=1 NO_CAPSTONE=1
 
@@ -158,7 +157,6 @@ run += make_no_backtrace
 run += make_no_libcapstone
 run += make_no_libnuma
 run += make_no_libbionic
-run += make_no_auxtrace
 run += make_no_libbpf
 run += make_no_libbpf_DEBUG
 run += make_no_libllvm
tools/perf/util/Build +12 -12
index 4be313cd115a..1c2a43e1dc68 100644
@@ -129,22 +129,22 @@ perf-util-y += iostat.o
 perf-util-y += stream.o
 perf-util-y += kvm-stat.o
 perf-util-y += lock-contention.o
-perf-util-$(CONFIG_AUXTRACE) += auxtrace.o
+perf-util-y += auxtrace.o
 perf-util-y += intel-pt-decoder/
-perf-util-$(CONFIG_AUXTRACE) += intel-pt.o
-perf-util-$(CONFIG_AUXTRACE) += intel-bts.o
-perf-util-$(CONFIG_AUXTRACE) += arm-spe.o
-perf-util-$(CONFIG_AUXTRACE) += arm-spe-decoder/
-perf-util-$(CONFIG_AUXTRACE) += hisi-ptt.o
-perf-util-$(CONFIG_AUXTRACE) += hisi-ptt-decoder/
-perf-util-$(CONFIG_AUXTRACE) += s390-cpumsf.o
-perf-util-$(CONFIG_AUXTRACE) += powerpc-vpadtl.o
+perf-util-y += intel-pt.o
+perf-util-y += intel-bts.o
+perf-util-y += arm-spe.o
+perf-util-y += arm-spe-decoder/
+perf-util-y += hisi-ptt.o
+perf-util-y += hisi-ptt-decoder/
+perf-util-y += s390-cpumsf.o
+perf-util-y += powerpc-vpadtl.o
 
 ifdef CONFIG_LIBOPENCSD
-perf-util-$(CONFIG_AUXTRACE) += cs-etm.o
-perf-util-$(CONFIG_AUXTRACE) += cs-etm-decoder/
+perf-util-y += cs-etm.o
+perf-util-y += cs-etm-decoder/
 endif
-perf-util-$(CONFIG_AUXTRACE) += cs-etm-base.o
+perf-util-y += cs-etm-base.o
 
 perf-util-y += parse-branch-options.o
 perf-util-y += dump-insn.o
tools/perf/util/arm-spe-decoder/Build +1 -1
index 960062b3cb9e..ab500e0efe24 100644
@@ -1 +1 @@
-perf-util-$(CONFIG_AUXTRACE) += arm-spe-pkt-decoder.o arm-spe-decoder.o
+perf-util-y += arm-spe-pkt-decoder.o arm-spe-decoder.o
tools/perf/util/auxtrace.h +1 -219

241 lines not on this page · raw message

tools/perf/util/cs-etm-decoder/Build +1 -1
index 056d665f7f88..27550db2aa4c 100644
@@ -1 +1 @@
-perf-util-$(CONFIG_AUXTRACE) += cs-etm-decoder.o
+perf-util-y += cs-etm-decoder.o
tools/perf/util/hisi-ptt-decoder/Build +1 -1
index 3298f7b7e308..2ee0eb731656 100644
@@ -1 +1 @@
-perf-util-$(CONFIG_AUXTRACE) += hisi-ptt-pkt-decoder.o
+perf-util-y += hisi-ptt-pkt-decoder.o
tools/perf/util/intel-pt-decoder/Build +2 -6
index 5b8f0149167d..8fd7e4330044 100644
@@ -1,4 +1,4 @@
-perf-util-$(CONFIG_AUXTRACE) += intel-pt-pkt-decoder.o intel-pt-insn-decoder.o intel-pt-log.o intel-pt-decoder.o
+perf-util-y += intel-pt-pkt-decoder.o intel-pt-insn-decoder.o intel-pt-log.o intel-pt-decoder.o
 
 inat_tables_script = $(srctree)/tools/arch/x86/tools/gen-insn-attr-x86.awk
 inat_tables_maps = $(srctree)/tools/arch/x86/lib/x86-opcode-map.txt
@@ -7,11 +7,7 @@ $(OUTPUT)util/intel-pt-decoder/inat-tables.c: $(inat_tables_script) $(inat_table
 	$(call rule_mkdir)
 	@$(call echo-cmd,gen)$(AWK) -f $(inat_tables_script) $(inat_tables_maps) > $@ || rm -f $@
 
-ifeq ($(SRCARCH),x86)
-  perf-util-y += inat.o insn.o
-else
-  perf-util-$(CONFIG_AUXTRACE) += inat.o insn.o
-endif
+perf-util-y += inat.o insn.o
 
 $(OUTPUT)util/intel-pt-decoder/inat.o: $(srctree)/tools/arch/x86/lib/inat.c $(OUTPUT)util/intel-pt-decoder/inat-tables.c
 	$(call rule_mkdir)
tools/perf/util/synthetic-events.h +0 -15
index ee29615d68e5..f8588b6cf11a 100644
@@ -107,24 +107,9 @@ int machine__synthesize_threads(struct machine *machine, struct target *target,
 				struct perf_thread_map *threads, bool needs_mmap, bool data_mmap,
 				unsigned int nr_threads_synthesize);
 
-#ifdef HAVE_AUXTRACE_SUPPORT
 int perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr, const struct perf_tool *tool,
 					 struct perf_session *session, perf_event__handler_t process);
 
-#else // HAVE_AUXTRACE_SUPPORT
-
-#include <errno.h>
-
-static inline int
-perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr __maybe_unused,
-				     const struct perf_tool *tool __maybe_unused,
-				     struct perf_session *session __maybe_unused,
-				     perf_event__handler_t process __maybe_unused)
-{
-	return -EINVAL;
-}
-#endif // HAVE_AUXTRACE_SUPPORT
-
 #ifdef HAVE_LIBBPF_SUPPORT
 int perf_event__synthesize_bpf_events(struct perf_session *session, perf_event__handler_t process,
 				      struct machine *machine, struct record_opts *opts);
Signature · 1 line
2.51.2.1041.gc1ab5b90ca-goog
author reviewer
#5 lore raw

PATCH 5/5 perf auxtrace: Remove errno.h from auxtrace.h and fix transitive dependencies

In reply to Ian Rogers

errno.h isn't used in auxtrace.h so remove it and fix build failures caused by transitive dependencies through auxtrace.h on errno.h.

---
 tools/perf/arch/arm/annotate/instructions.c   | 1 +
 tools/perf/arch/arm/util/auxtrace.c           | 1 +
 tools/perf/arch/arm64/annotate/instructions.c | 1 +
 tools/perf/arch/arm64/util/arm-spe.c          | 1 +
 tools/perf/arch/arm64/util/hisi-ptt.c         | 1 +
 tools/perf/arch/powerpc/util/auxtrace.c       | 2 +-
 tools/perf/arch/s390/util/auxtrace.c          | 1 +
 tools/perf/arch/x86/tests/topdown.c           | 1 +
 tools/perf/arch/x86/util/topdown.c            | 1 +
 tools/perf/bench/evlist-open-close.c          | 1 +
 tools/perf/bench/futex.c                      | 1 +
 tools/perf/bench/pmu-scan.c                   | 1 +
 tools/perf/bench/synthesize.c                 | 1 +
 tools/perf/builtin-mem.c                      | 1 +
 tools/perf/tests/hwmon_pmu.c                  | 1 +
 tools/perf/tests/parse-metric.c               | 1 +
 tools/perf/tests/pfm.c                        | 1 +
 tools/perf/ui/hist.c                          | 1 +
 tools/perf/util/annotate-data.c               | 2 +-
 tools/perf/util/auxtrace.h                    | 1 -
 tools/perf/util/bpf-filter.h                  | 2 ++
 tools/perf/util/bpf-trace-summary.c           | 1 +
 tools/perf/util/bpf_counter_cgroup.c          | 1 +
 tools/perf/util/bpf_ftrace.c                  | 3 ++-
 tools/perf/util/bpf_map.c                     | 1 +
 tools/perf/util/cgroup.c                      | 1 +
 tools/perf/util/drm_pmu.c                     | 1 +
 tools/perf/util/evswitch.c                    | 1 +
 tools/perf/util/intel-tpebs.c                 | 1 +
 tools/perf/util/kvm-stat.h                    | 1 +
 tools/perf/util/mmap.c                        | 1 +
 tools/perf/util/pfm.c                         | 1 +
 tools/perf/util/powerpc-vpadtl.c              | 1 +
 tools/perf/util/stat-shadow.c                 | 1 +
 34 files changed, 35 insertions(+), 4 deletions(-)
tools/perf/arch/arm/annotate/instructions.c +1 -0
index cf91a43362b0..5e667b0f5512 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/compiler.h>
 #include <linux/zalloc.h>
+#include <errno.h>
 #include <sys/types.h>
 #include <regex.h>
 #include <stdlib.h>
tools/perf/arch/arm/util/auxtrace.c +1 -0
index 3b8eca0ffb17..eb6404267f17 100644
@@ -5,6 +5,7 @@
  */
 
 #include <dirent.h>
+#include <errno.h>
 #include <stdbool.h>
 #include <linux/coresight-pmu.h>
 #include <linux/zalloc.h>
tools/perf/arch/arm64/annotate/instructions.c +1 -0
index d465d093e7eb..16cb62d40bd9 100644
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/compiler.h>
+#include <errno.h>
 #include <sys/types.h>
 #include <regex.h>
 #include <stdlib.h>
tools/perf/arch/arm64/util/arm-spe.c +1 -0
index cac43cde7dbe..d5ec1408d0ae 100644
@@ -10,6 +10,7 @@
 #include <linux/log2.h>
 #include <linux/string.h>
 #include <linux/zalloc.h>
+#include <errno.h>
 #include <time.h>
 
 #include "../../../util/cpumap.h"
tools/perf/arch/arm64/util/hisi-ptt.c +1 -0
index eac9739c87e6..fe457fd58c9e 100644
@@ -9,6 +9,7 @@
 #include <linux/bitops.h>
 #include <linux/log2.h>
 #include <linux/zalloc.h>
+#include <errno.h>
 #include <time.h>
 
 #include <internal/lib.h> // page_size
tools/perf/arch/powerpc/util/auxtrace.c +1 -1
index 62c6f67f1bbe..292ea335e4ff 100644
@@ -2,7 +2,7 @@
 /*
  * VPA support
  */
-
+#include <errno.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/string.h>
tools/perf/arch/s390/util/auxtrace.c +1 -0
index 5068baa3e092..1a3676145066 100644
@@ -1,3 +1,4 @@
+#include <errno.h>
 #include <stdbool.h>
 #include <stdlib.h>
 #include <linux/kernel.h>
tools/perf/arch/x86/tests/topdown.c +1 -0
index 1eba3b4594ef..3ee4e5e71be3 100644
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#include <errno.h>
 #include "arch-tests.h"
 #include "../util/topdown.h"
 #include "debug.h"
tools/perf/arch/x86/util/topdown.c +1 -0
index 0d01b662627a..bafd285119d7 100644
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#include <errno.h>
 #include "util/evlist.h"
 #include "util/pmu.h"
 #include "util/pmus.h"
tools/perf/bench/evlist-open-close.c +1 -0
index bfaf50e4e519..faf9c34b4a5d 100644
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#include <errno.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
tools/perf/bench/futex.c +1 -0
index 1481196a22f0..1968c9d00b5b 100644
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <err.h>
+#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/prctl.h>
tools/perf/bench/pmu-scan.c +1 -0
index 9e4d36486f62..14a464ad8cea 100644
@@ -4,6 +4,7 @@
  *
  * Copyright 2023 Google LLC.
  */
+#include <errno.h>
 #include <stdio.h>
 #include "bench.h"
 #include "util/debug.h"
tools/perf/bench/synthesize.c +1 -0
index b3d493697675..265d49a913d9 100644
@@ -6,6 +6,7 @@
  *
  * Copyright 2019 Google LLC.
  */
+#include <errno.h>
 #include <stdio.h>
 #include "bench.h"
 #include "../util/debug.h"
tools/perf/builtin-mem.c +1 -0
index c6496adff3fe..d43500b92a7b 100644
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#include <errno.h>
 #include <inttypes.h>
 #include <sys/types.h>
 #include <sys/stat.h>
tools/perf/tests/hwmon_pmu.c +1 -0
index 151f02701c8c..4aa4aac94f09 100644
@@ -4,6 +4,7 @@
 #include "hwmon_pmu.h"
 #include "parse-events.h"
 #include "tests.h"
+#include <errno.h>
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <linux/compiler.h>
tools/perf/tests/parse-metric.c +1 -0
index 66a5275917e2..9b1df1eb455a 100644
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/compiler.h>
+#include <errno.h>
 #include <string.h>
 #include <perf/cpumap.h>
 #include <perf/evlist.h>
tools/perf/tests/pfm.c +1 -0
index 2e38dfa34b6c..fca4a86452df 100644
@@ -4,6 +4,7 @@
  *
  * Copyright 2020 Google LLC.
  */
+#include <errno.h>
 #include "tests.h"
 #include "util/debug.h"
 #include "util/evlist.h"
tools/perf/ui/hist.c +1 -0
index b085eb0de849..e58327595d37 100644
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#include <errno.h>
 #include <inttypes.h>
 #include <math.h>
 #include <stdlib.h>
tools/perf/util/annotate-data.c +1 -1
index e183c6104d59..07cf9c334be0 100644
@@ -4,7 +4,7 @@
  *
  * Written by Namhyung Kim <[email protected]>
  */
-
+#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <inttypes.h>
tools/perf/util/auxtrace.h +0 -1
index 59cf72b935ff..eee2c11f7666 100644
@@ -7,7 +7,6 @@
 #ifndef __PERF_AUXTRACE_H
 #define __PERF_AUXTRACE_H
 
-#include <errno.h>
 #include <stdio.h> // FILE
 #include <linux/perf_event.h>
 #include <linux/types.h>
tools/perf/util/bpf-filter.h +2 -0
index 122477f2de44..818c554b91b2 100644
@@ -36,6 +36,8 @@ int perf_bpf_filter__unpin(void);
 
 #else /* !HAVE_BPF_SKEL */
 
+#include <errno.h>
+
 static inline int perf_bpf_filter__parse(struct list_head *expr_head __maybe_unused,
 					 const char *str __maybe_unused)
 {
tools/perf/util/bpf-trace-summary.c +1 -0
index 8dfe7e678941..cf6e1e4402d5 100644
@@ -1,4 +1,5 @@
 /* SPDX-License-Identifier: GPL-2.0 */
+#include <errno.h>
 #include <inttypes.h>
 #include <math.h>
 #include <stdio.h>
tools/perf/util/bpf_counter_cgroup.c +1 -0
index 68bd994c8880..17d7196c6589 100644
@@ -4,6 +4,7 @@
 /* Copyright (c) 2021 Google */
 
 #include <assert.h>
+#include <errno.h>
 #include <limits.h>
 #include <unistd.h>
 #include <sys/file.h>
tools/perf/util/bpf_ftrace.c +2 -1
index e61a3b20be0a..c456d24efa30 100644
@@ -1,6 +1,7 @@
-#include <stdio.h>
+#include <errno.h>
 #include <fcntl.h>
 #include <stdint.h>
+#include <stdio.h>
 #include <stdlib.h>
 
 #include <bpf/bpf.h>
tools/perf/util/bpf_map.c +1 -0
index 578f27d2d6b4..442f91b4e8e1 100644
@@ -5,6 +5,7 @@
 #include <bpf/libbpf.h>
 #include <linux/err.h>
 #include <linux/kernel.h>
+#include <errno.h>
 #include <stdbool.h>
 #include <stdlib.h>
 #include <unistd.h>
tools/perf/util/cgroup.c +1 -0
index 25e2769b5e74..040eb75f0804 100644
@@ -10,6 +10,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/statfs.h>
+#include <errno.h>
 #include <fcntl.h>
 #include <stdlib.h>
 #include <string.h>
tools/perf/util/drm_pmu.c +1 -0
index 98d4d2b556d4..b3052266d599 100644
@@ -10,6 +10,7 @@
 #include <api/io.h>
 #include <ctype.h>
 #include <dirent.h>
+#include <errno.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <linux/unistd.h>
tools/perf/util/evswitch.c +1 -0
index 40cb56a9347d..d4c06a3f825a 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 // Copyright (C) 2019, Red Hat Inc, Arnaldo Carvalho de Melo <[email protected]>
 
+#include <errno.h>
 #include "evswitch.h"
 #include "evlist.h"
 
tools/perf/util/intel-tpebs.c +1 -0
index 21359155f2a0..3c958d738ca6 100644
@@ -25,6 +25,7 @@
 #include "stat.h"
 #include <sys/stat.h>
 #include <sys/file.h>
+#include <errno.h>
 #include <poll.h>
 #include <math.h>
 
tools/perf/util/kvm-stat.h +1 -0
index 53db3d56108b..a356b839c2ee 100644
@@ -10,6 +10,7 @@
 #include "symbol.h"
 #include "record.h"
 
+#include <errno.h>
 #include <stdlib.h>
 #include <linux/zalloc.h>
 
tools/perf/util/mmap.c +1 -0
index a34726219af3..b69f926d314b 100644
@@ -7,6 +7,7 @@
  */
 
 #include <sys/mman.h>
+#include <errno.h>
 #include <inttypes.h>
 #include <asm/bug.h>
 #include <linux/zalloc.h>
tools/perf/util/pfm.c +1 -0
index e5b3a2a5ddef..d9043f4afbe7 100644
@@ -15,6 +15,7 @@
 #include "util/strbuf.h"
 #include "util/thread_map.h"
 
+#include <errno.h>
 #include <string.h>
 #include <linux/kernel.h>
 #include <perfmon/pfmlib_perf_event.h>
tools/perf/util/powerpc-vpadtl.c +1 -0
index bfa4156d7a97..d1c3396f182f 100644
@@ -4,6 +4,7 @@
  */
 
 #include <linux/string.h>
+#include <errno.h>
 #include <inttypes.h>
 #include "color.h"
 #include "evlist.h"
tools/perf/util/stat-shadow.c +1 -0
index abaf6b579bfc..0002e51194c2 100644
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#include <errno.h>
 #include <math.h>
 #include <stdio.h>
 #include "evsel.h"
Signature · 1 line
2.51.2.1041.gc1ab5b90ca-goog
maintainer
#6 lore raw
In reply to Ian Rogers

Hi Ian,

Quoted 4 lines · Ian Rogers

Switch the __get_cpuid feature for intel-pt to use the provided cpuid function in perf, this removes the need for NO_AUXTRACE when the feature detection fails. Remove the now unnecessary feature detection. Remove NO_AUXTRACE as it just builds a more broken version

Can you please elaborate what the broken part is?

Thanks,
Namhyung

Quoted 84 lines

of perf and isn't guarding dependencies on any libraries, etc. Clean up headers files for auxtrace.h.

This was prompted by needing to make a v2 patch set of:
https://lore.kernel.org/lkml/[email protected]/
due to a broken NO_AUXTRACE configuration.

Ian Rogers (5):
perf intel-pt: Use the perf provided "cpuid.h"
perf build: Don't add NO_AUXTRACE if missing feature-get_cpuid tool build: Remove __get_cpuid feature test
perf build: Remove NO_AUXTRACE build option
perf auxtrace: Remove errno.h from auxtrace.h and fix transitive
dependencies

 tools/build/Makefile.feature                  |   2 -
 tools/build/feature/Makefile                  |   4 -
 tools/build/feature/test-all.c                |   5 -
 tools/build/feature/test-get_cpuid.c          |   8 -
 tools/perf/Documentation/perf-check.txt       |   1 -
 tools/perf/Makefile.config                    |  13 --
 tools/perf/Makefile.perf                      |   2 -
 tools/perf/arch/arm/annotate/instructions.c   |   1 +
 tools/perf/arch/arm/util/Build                |   2 +-
 tools/perf/arch/arm/util/auxtrace.c           |   1 +
 tools/perf/arch/arm/util/pmu.c                |   2 -
 tools/perf/arch/arm64/annotate/instructions.c |   1 +
 tools/perf/arch/arm64/util/Build              |  19 +-
 tools/perf/arch/arm64/util/arm-spe.c          |   1 +
 tools/perf/arch/arm64/util/hisi-ptt.c         |   1 +
 tools/perf/arch/powerpc/util/Build            |   2 +-
 tools/perf/arch/powerpc/util/auxtrace.c       |   2 +-
 tools/perf/arch/s390/util/Build               |   2 +-
 tools/perf/arch/s390/util/auxtrace.c          |   1 +
 tools/perf/arch/x86/tests/Build               |   4 +-
 tools/perf/arch/x86/tests/arch-tests.c        |   4 -
 tools/perf/arch/x86/tests/intel-pt-test.c     |   6 +-
 tools/perf/arch/x86/tests/topdown.c           |   1 +
 tools/perf/arch/x86/util/Build                |   6 +-
 tools/perf/arch/x86/util/intel-pt.c           |   4 +-
 tools/perf/arch/x86/util/pmu.c                |   2 -
 tools/perf/arch/x86/util/topdown.c            |   1 +
 tools/perf/bench/evlist-open-close.c          |   1 +
 tools/perf/bench/futex.c                      |   1 +
 tools/perf/bench/pmu-scan.c                   |   1 +
 tools/perf/bench/synthesize.c                 |   1 +
 tools/perf/builtin-check.c                    |   1 -
 tools/perf/builtin-inject.c                   |  15 --
 tools/perf/builtin-mem.c                      |   1 +
 tools/perf/builtin-record.c                   |  36 ---
 tools/perf/builtin-script.c                   |  12 -
 tools/perf/tests/hwmon_pmu.c                  |   1 +
 tools/perf/tests/make                         |   4 +-
 tools/perf/tests/parse-metric.c               |   1 +
 tools/perf/tests/pfm.c                        |   1 +
 tools/perf/ui/hist.c                          |   1 +
 tools/perf/util/Build                         |  24 +-
 tools/perf/util/annotate-data.c               |   2 +-
 tools/perf/util/arm-spe-decoder/Build         |   2 +-
 tools/perf/util/auxtrace.h                    | 221 +-----------------
 tools/perf/util/bpf-filter.h                  |   2 +
 tools/perf/util/bpf-trace-summary.c           |   1 +
 tools/perf/util/bpf_counter_cgroup.c          |   1 +
 tools/perf/util/bpf_ftrace.c                  |   3 +-
 tools/perf/util/bpf_map.c                     |   1 +
 tools/perf/util/cgroup.c                      |   1 +
 tools/perf/util/cs-etm-decoder/Build          |   2 +-
 tools/perf/util/drm_pmu.c                     |   1 +
 tools/perf/util/evswitch.c                    |   1 +
 tools/perf/util/hisi-ptt-decoder/Build        |   2 +-
 tools/perf/util/intel-pt-decoder/Build        |   8 +-
 tools/perf/util/intel-tpebs.c                 |   1 +
 tools/perf/util/kvm-stat.h                    |   1 +
 tools/perf/util/mmap.c                        |   1 +
 tools/perf/util/pfm.c                         |   1 +
 tools/perf/util/powerpc-vpadtl.c              |   1 +
 tools/perf/util/stat-shadow.c                 |   1 +
 tools/perf/util/synthetic-events.h            |  15 --
 63 files changed, 77 insertions(+), 391 deletions(-)
 delete mode 100644 tools/build/feature/test-get_cpuid.c
Signature · 1 line
2.51.2.1041.gc1ab5b90ca-goog
author reviewer
#7 lore raw
Quoted 10 lines · Namhyung Kim

Hi Ian,

Quoted 4 lines · Ian Rogers

Switch the __get_cpuid feature for intel-pt to use the provided cpuid function in perf, this removes the need for NO_AUXTRACE when the feature detection fails. Remove the now unnecessary feature detection. Remove NO_AUXTRACE as it just builds a more broken version

Can you please elaborate what the broken part is?

Sure. I'll summarize what alters in patch 4. NO_AUXTRACE is controlling 3 main things:
* set up of aux options for PMUs (code in the arch directory)
* ARM: coresight and SPE
* Intel: BTS and PT
* PowerPC: VPA DTL
* S390: cpumsf
* support for decoding aux events (common code that can be
cross-compiled assuming other library dependencies are available)
* ARM: coresight
* HiSi: PTT decoder
* Intel: BTS and PT
* PowerPC: VPA DTL
* S390: cpumsf
* Tool support for aux buffers (common shared builtin code):
* perf record: aux options for events, snapshot, aux-sample
* perf inject: aux events will fail the entire perf inject command

So somebody with a NO_AUXTRACE build would generally experience a very sad perf command. Having the option made sense when there were feature tests that could fail, but possibly that should have just controlled not compiling intel-pt. Having the option is extra burden on developers/maintainers, as shown in my comment:

Quoted 3 lines

This was prompted by needing to make a v2 patch set of:
https://lore.kernel.org/lkml/[email protected]/
due to a broken NO_AUXTRACE configuration.

Somebody may have been using NO_AUXTRACE as a proxy for not having some library, but I don't see that in the code. If this is the case we should add the appropriate feature test, ..
Not having NO_AUXTRACE may have been a bug work around for someone, in which case we should work to fix the bug. Again, I don't know of this case and don't see it in the code.

Thanks,
Ian

Quoted 2 lines

Thanks,
Namhyung

reviewer Reviewed-by
#8 lore raw
Quoted 47 lines · Ian Rogers
Quoted 10 lines · Namhyung Kim

Hi Ian,

Quoted 4 lines · Ian Rogers

Switch the __get_cpuid feature for intel-pt to use the provided cpuid function in perf, this removes the need for NO_AUXTRACE when the feature detection fails. Remove the now unnecessary feature detection. Remove NO_AUXTRACE as it just builds a more broken version

Can you please elaborate what the broken part is?

Sure. I'll summarize what alters in patch 4. NO_AUXTRACE is controlling 3 main things:
* set up of aux options for PMUs (code in the arch directory)
* ARM: coresight and SPE
* Intel: BTS and PT
* PowerPC: VPA DTL
* S390: cpumsf
* support for decoding aux events (common code that can be
cross-compiled assuming other library dependencies are available)
* ARM: coresight
* HiSi: PTT decoder
* Intel: BTS and PT
* PowerPC: VPA DTL
* S390: cpumsf
* Tool support for aux buffers (common shared builtin code):
* perf record: aux options for events, snapshot, aux-sample
* perf inject: aux events will fail the entire perf inject command

So somebody with a NO_AUXTRACE build would generally experience a very sad perf command. Having the option made sense when there were feature tests that could fail, but possibly that should have just controlled not compiling intel-pt. Having the option is extra burden on developers/maintainers, as shown in my comment:

Quoted 3 lines

This was prompted by needing to make a v2 patch set of:
https://lore.kernel.org/lkml/[email protected]/
due to a broken NO_AUXTRACE configuration.

Somebody may have been using NO_AUXTRACE as a proxy for not having some library, but I don't see that in the code. If this is the case we should add the appropriate feature test, ..
Not having NO_AUXTRACE may have been a bug work around for someone, in which case we should work to fix the bug. Again, I don't know of this case and don't see it in the code.

Quoted 5 lines

Thanks,
Ian

Quoted 2 lines

Thanks,
Namhyung

Seems like a nice simplification even if nothing was badly broken.

maintainer Applied
#9 lore raw
In reply to Ian Rogers
Quoted 8 lines · Ian Rogers

Switch the __get_cpuid feature for intel-pt to use the provided cpuid function in perf, this removes the need for NO_AUXTRACE when the feature detection fails. Remove the now unnecessary feature detection. Remove NO_AUXTRACE as it just builds a more broken version of perf and isn't guarding dependencies on any libraries, etc. Clean up headers files for auxtrace.h.

[...]

Applied to perf-tools-next, thanks!

Best regards,
Namhyung