diff options
Diffstat (limited to 'tools/perf/arch')
| -rw-r--r-- | tools/perf/arch/arm/annotate/instructions.c | 1 | ||||
| -rw-r--r-- | tools/perf/arch/arm/util/Build | 2 | ||||
| -rw-r--r-- | tools/perf/arch/arm/util/auxtrace.c | 1 | ||||
| -rw-r--r-- | tools/perf/arch/arm/util/pmu.c | 2 | ||||
| -rw-r--r-- | tools/perf/arch/arm64/annotate/instructions.c | 1 | ||||
| -rw-r--r-- | tools/perf/arch/arm64/util/Build | 19 | ||||
| -rw-r--r-- | tools/perf/arch/arm64/util/arm-spe.c | 1 | ||||
| -rw-r--r-- | tools/perf/arch/arm64/util/hisi-ptt.c | 1 | ||||
| -rw-r--r-- | tools/perf/arch/powerpc/util/Build | 2 | ||||
| -rw-r--r-- | tools/perf/arch/powerpc/util/auxtrace.c | 2 | ||||
| -rw-r--r-- | tools/perf/arch/s390/util/Build | 2 | ||||
| -rw-r--r-- | tools/perf/arch/s390/util/auxtrace.c | 1 | ||||
| -rw-r--r-- | tools/perf/arch/x86/annotate/instructions.c | 183 | ||||
| -rw-r--r-- | tools/perf/arch/x86/tests/Build | 4 | ||||
| -rw-r--r-- | tools/perf/arch/x86/tests/arch-tests.c | 4 | ||||
| -rw-r--r-- | tools/perf/arch/x86/tests/intel-pt-test.c | 6 | ||||
| -rw-r--r-- | tools/perf/arch/x86/tests/topdown.c | 1 | ||||
| -rw-r--r-- | tools/perf/arch/x86/util/Build | 6 | ||||
| -rw-r--r-- | tools/perf/arch/x86/util/intel-pt.c | 6 | ||||
| -rw-r--r-- | tools/perf/arch/x86/util/pmu.c | 2 | ||||
| -rw-r--r-- | tools/perf/arch/x86/util/topdown.c | 1 |
21 files changed, 212 insertions, 36 deletions
diff --git a/tools/perf/arch/arm/annotate/instructions.c b/tools/perf/arch/arm/annotate/instructions.c index cf91a43362b0..5e667b0f5512 100644 --- a/tools/perf/arch/arm/annotate/instructions.c +++ b/tools/perf/arch/arm/annotate/instructions.c @@ -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> diff --git a/tools/perf/arch/arm/util/Build b/tools/perf/arch/arm/util/Build index f7a8b37d1c68..fd695e1fdaee 100644 --- a/tools/perf/arch/arm/util/Build +++ b/tools/perf/arch/arm/util/Build @@ -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 diff --git a/tools/perf/arch/arm/util/auxtrace.c b/tools/perf/arch/arm/util/auxtrace.c index 3b8eca0ffb17..eb6404267f17 100644 --- a/tools/perf/arch/arm/util/auxtrace.c +++ b/tools/perf/arch/arm/util/auxtrace.c @@ -5,6 +5,7 @@ */ #include <dirent.h> +#include <errno.h> #include <stdbool.h> #include <linux/coresight-pmu.h> #include <linux/zalloc.h> diff --git a/tools/perf/arch/arm/util/pmu.c b/tools/perf/arch/arm/util/pmu.c index f70075c89aa0..9be8da5207f5 100644 --- a/tools/perf/arch/arm/util/pmu.c +++ b/tools/perf/arch/arm/util/pmu.c @@ -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); diff --git a/tools/perf/arch/arm64/annotate/instructions.c b/tools/perf/arch/arm64/annotate/instructions.c index d465d093e7eb..16cb62d40bd9 100644 --- a/tools/perf/arch/arm64/annotate/instructions.c +++ b/tools/perf/arch/arm64/annotate/instructions.c @@ -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> diff --git a/tools/perf/arch/arm64/util/Build b/tools/perf/arch/arm64/util/Build index a74521b79eaa..d63881081d2e 100644 --- a/tools/perf/arch/arm64/util/Build +++ b/tools/perf/arch/arm64/util/Build @@ -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 diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c index cac43cde7dbe..d5ec1408d0ae 100644 --- a/tools/perf/arch/arm64/util/arm-spe.c +++ b/tools/perf/arch/arm64/util/arm-spe.c @@ -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" diff --git a/tools/perf/arch/arm64/util/hisi-ptt.c b/tools/perf/arch/arm64/util/hisi-ptt.c index eac9739c87e6..fe457fd58c9e 100644 --- a/tools/perf/arch/arm64/util/hisi-ptt.c +++ b/tools/perf/arch/arm64/util/hisi-ptt.c @@ -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 diff --git a/tools/perf/arch/powerpc/util/Build b/tools/perf/arch/powerpc/util/Build index a5b0babd307e..3d0d5427aef7 100644 --- a/tools/perf/arch/powerpc/util/Build +++ b/tools/perf/arch/powerpc/util/Build @@ -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 diff --git a/tools/perf/arch/powerpc/util/auxtrace.c b/tools/perf/arch/powerpc/util/auxtrace.c index 62c6f67f1bbe..292ea335e4ff 100644 --- a/tools/perf/arch/powerpc/util/auxtrace.c +++ b/tools/perf/arch/powerpc/util/auxtrace.c @@ -2,7 +2,7 @@ /* * VPA support */ - +#include <errno.h> #include <linux/kernel.h> #include <linux/types.h> #include <linux/string.h> diff --git a/tools/perf/arch/s390/util/Build b/tools/perf/arch/s390/util/Build index 736c0ad09194..c64eb18dbdae 100644 --- a/tools/perf/arch/s390/util/Build +++ b/tools/perf/arch/s390/util/Build @@ -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 diff --git a/tools/perf/arch/s390/util/auxtrace.c b/tools/perf/arch/s390/util/auxtrace.c index 5068baa3e092..1a3676145066 100644 --- a/tools/perf/arch/s390/util/auxtrace.c +++ b/tools/perf/arch/s390/util/auxtrace.c @@ -1,3 +1,4 @@ +#include <errno.h> #include <stdbool.h> #include <stdlib.h> #include <linux/kernel.h> diff --git a/tools/perf/arch/x86/annotate/instructions.c b/tools/perf/arch/x86/annotate/instructions.c index da98a4e3c52c..803f9351a3fb 100644 --- a/tools/perf/arch/x86/annotate/instructions.c +++ b/tools/perf/arch/x86/annotate/instructions.c @@ -248,6 +248,7 @@ static void update_insn_state_x86(struct type_state *state, tsr = &state->regs[state->ret_reg]; tsr->type = type_die; tsr->kind = TSR_KIND_TYPE; + tsr->offset = 0; tsr->ok = true; pr_debug_dtp("call [%x] return -> reg%d", @@ -284,6 +285,7 @@ static void update_insn_state_x86(struct type_state *state, !strcmp(var_name, "this_cpu_off") && tsr->kind == TSR_KIND_CONST) { tsr->kind = TSR_KIND_PERCPU_BASE; + tsr->offset = 0; tsr->ok = true; imm_value = tsr->imm_value; } @@ -291,6 +293,19 @@ static void update_insn_state_x86(struct type_state *state, else return; + /* Ignore add to non-pointer or non-const types */ + if (tsr->kind == TSR_KIND_POINTER || + (dwarf_tag(&tsr->type) == DW_TAG_pointer_type && + src->reg1 != DWARF_REG_PC && tsr->kind == TSR_KIND_TYPE && !dst->mem_ref)) { + tsr->offset += imm_value; + pr_debug_dtp("add [%x] offset %#"PRIx64" to reg%d", + insn_offset, imm_value, dst->reg1); + pr_debug_type_name(&tsr->type, tsr->kind); + } + + if (tsr->kind == TSR_KIND_CONST) + tsr->imm_value += imm_value; + if (tsr->kind != TSR_KIND_PERCPU_BASE) return; @@ -302,6 +317,7 @@ static void update_insn_state_x86(struct type_state *state, */ tsr->type = type_die; tsr->kind = TSR_KIND_PERCPU_POINTER; + tsr->offset = 0; tsr->ok = true; pr_debug_dtp("add [%x] percpu %#"PRIx64" -> reg%d", @@ -311,6 +327,135 @@ static void update_insn_state_x86(struct type_state *state, return; } + if (!strncmp(dl->ins.name, "sub", 3)) { + u64 imm_value = -1ULL; + + if (!has_reg_type(state, dst->reg1)) + return; + + tsr = &state->regs[dst->reg1]; + tsr->copied_from = -1; + + if (src->imm) + imm_value = src->offset; + else if (has_reg_type(state, src->reg1) && + state->regs[src->reg1].kind == TSR_KIND_CONST) + imm_value = state->regs[src->reg1].imm_value; + + if (tsr->kind == TSR_KIND_POINTER || + (dwarf_tag(&tsr->type) == DW_TAG_pointer_type && + src->reg1 != DWARF_REG_PC && tsr->kind == TSR_KIND_TYPE && !dst->mem_ref)) { + tsr->offset -= imm_value; + pr_debug_dtp("sub [%x] offset %#"PRIx64" to reg%d", + insn_offset, imm_value, dst->reg1); + pr_debug_type_name(&tsr->type, tsr->kind); + } + + if (tsr->kind == TSR_KIND_CONST) + tsr->imm_value -= imm_value; + + return; + } + + if (!strncmp(dl->ins.name, "lea", 3)) { + int sreg = src->reg1; + struct type_state_reg src_tsr; + + if (!has_reg_type(state, sreg) || + !has_reg_type(state, dst->reg1) || + !src->mem_ref) + return; + + src_tsr = state->regs[sreg]; + tsr = &state->regs[dst->reg1]; + + tsr->copied_from = -1; + tsr->ok = false; + + /* Case 1: Based on stack pointer or frame pointer */ + if (sreg == fbreg || sreg == state->stack_reg) { + struct type_state_stack *stack; + int offset = src->offset - fboff; + + stack = find_stack_state(state, offset); + if (!stack) + return; + + tsr->type = stack->type; + tsr->kind = TSR_KIND_POINTER; + tsr->offset = offset - stack->offset; + tsr->ok = true; + + if (sreg == fbreg) { + pr_debug_dtp("lea [%x] address of -%#x(stack) -> reg%d", + insn_offset, -src->offset, dst->reg1); + } else { + pr_debug_dtp("lea [%x] address of %#x(reg%d) -> reg%d", + insn_offset, src->offset, sreg, dst->reg1); + } + + pr_debug_type_name(&tsr->type, tsr->kind); + } + /* Case 2: Based on a register holding a typed pointer */ + else if (src_tsr.ok && (src_tsr.kind == TSR_KIND_POINTER || + (dwarf_tag(&src_tsr.type) == DW_TAG_pointer_type && + src_tsr.kind == TSR_KIND_TYPE))) { + + if (src_tsr.kind == TSR_KIND_TYPE && + __die_get_real_type(&state->regs[sreg].type, &type_die) == NULL) + return; + + if (src_tsr.kind == TSR_KIND_POINTER) + type_die = state->regs[sreg].type; + + /* Check if the target type has a member at the new offset */ + if (die_get_member_type(&type_die, + src->offset + src_tsr.offset, &type_die) == NULL) + return; + + tsr->type = src_tsr.type; + tsr->kind = src_tsr.kind; + tsr->offset = src->offset + src_tsr.offset; + tsr->ok = true; + + pr_debug_dtp("lea [%x] address of %s%#x(reg%d) -> reg%d", + insn_offset, src->offset < 0 ? "-" : "", + abs(src->offset), sreg, dst->reg1); + + pr_debug_type_name(&tsr->type, tsr->kind); + } + return; + } + + /* Invalidate register states for other ops which may change pointers */ + if (has_reg_type(state, dst->reg1) && !dst->mem_ref && + dwarf_tag(&state->regs[dst->reg1].type) == DW_TAG_pointer_type) { + if (!strncmp(dl->ins.name, "imul", 4) || !strncmp(dl->ins.name, "mul", 3) || + !strncmp(dl->ins.name, "idiv", 4) || !strncmp(dl->ins.name, "div", 3) || + !strncmp(dl->ins.name, "shl", 3) || !strncmp(dl->ins.name, "shr", 3) || + !strncmp(dl->ins.name, "sar", 3) || !strncmp(dl->ins.name, "and", 3) || + !strncmp(dl->ins.name, "or", 2) || !strncmp(dl->ins.name, "neg", 3) || + !strncmp(dl->ins.name, "inc", 3) || !strncmp(dl->ins.name, "dec", 3)) { + pr_debug_dtp("%s [%x] invalidate reg%d\n", + dl->ins.name, insn_offset, dst->reg1); + state->regs[dst->reg1].ok = false; + state->regs[dst->reg1].copied_from = -1; + return; + } + + if (!strncmp(dl->ins.name, "xor", 3) && dst->reg1 == src->reg1) { + /* xor reg, reg clears the register */ + pr_debug_dtp("xor [%x] clear reg%d\n", + insn_offset, dst->reg1); + + state->regs[dst->reg1].kind = TSR_KIND_CONST; + state->regs[dst->reg1].imm_value = 0; + state->regs[dst->reg1].ok = true; + state->regs[dst->reg1].copied_from = -1; + return; + } + } + if (strncmp(dl->ins.name, "mov", 3)) return; @@ -345,6 +490,7 @@ static void update_insn_state_x86(struct type_state *state, if (var_addr == 40) { tsr->kind = TSR_KIND_CANARY; + tsr->offset = 0; tsr->ok = true; pr_debug_dtp("mov [%x] stack canary -> reg%d\n", @@ -361,6 +507,7 @@ static void update_insn_state_x86(struct type_state *state, tsr->type = type_die; tsr->kind = TSR_KIND_TYPE; + tsr->offset = 0; tsr->ok = true; pr_debug_dtp("mov [%x] this-cpu addr=%#"PRIx64" -> reg%d", @@ -372,6 +519,7 @@ static void update_insn_state_x86(struct type_state *state, if (src->imm) { tsr->kind = TSR_KIND_CONST; tsr->imm_value = src->offset; + tsr->offset = 0; tsr->ok = true; pr_debug_dtp("mov [%x] imm=%#x -> reg%d\n", @@ -388,10 +536,11 @@ static void update_insn_state_x86(struct type_state *state, tsr->type = state->regs[src->reg1].type; tsr->kind = state->regs[src->reg1].kind; tsr->imm_value = state->regs[src->reg1].imm_value; + tsr->offset = state->regs[src->reg1].offset; tsr->ok = true; /* To copy back the variable type later (hopefully) */ - if (tsr->kind == TSR_KIND_TYPE) + if (tsr->kind == TSR_KIND_TYPE || tsr->kind == TSR_KIND_POINTER) tsr->copied_from = src->reg1; pr_debug_dtp("mov [%x] reg%d -> reg%d", @@ -421,12 +570,14 @@ retry: } else if (!stack->compound) { tsr->type = stack->type; tsr->kind = stack->kind; + tsr->offset = stack->ptr_offset; tsr->ok = true; } else if (die_get_member_type(&stack->type, offset - stack->offset, &type_die)) { tsr->type = type_die; tsr->kind = TSR_KIND_TYPE; + tsr->offset = 0; tsr->ok = true; } else { tsr->ok = false; @@ -446,15 +597,30 @@ retry: else if (has_reg_type(state, sreg) && state->regs[sreg].ok && state->regs[sreg].kind == TSR_KIND_TYPE && die_deref_ptr_type(&state->regs[sreg].type, - src->offset, &type_die)) { + src->offset + state->regs[sreg].offset, &type_die)) { tsr->type = type_die; tsr->kind = TSR_KIND_TYPE; + tsr->offset = 0; tsr->ok = true; pr_debug_dtp("mov [%x] %#x(reg%d) -> reg%d", insn_offset, src->offset, sreg, dst->reg1); pr_debug_type_name(&tsr->type, tsr->kind); } + /* Handle dereference of TSR_KIND_POINTER registers */ + else if (has_reg_type(state, sreg) && state->regs[sreg].ok && + state->regs[sreg].kind == TSR_KIND_POINTER && + die_get_member_type(&state->regs[sreg].type, + src->offset + state->regs[sreg].offset, &type_die)) { + tsr->type = state->regs[sreg].type; + tsr->kind = TSR_KIND_TYPE; + tsr->offset = src->offset + state->regs[sreg].offset; + tsr->ok = true; + + pr_debug_dtp("mov [%x] addr %#x(reg%d) -> reg%d", + insn_offset, src->offset, sreg, dst->reg1); + pr_debug_type_name(&tsr->type, tsr->kind); + } /* Or check if it's a global variable */ else if (sreg == DWARF_REG_PC) { struct map_symbol *ms = dloc->ms; @@ -473,6 +639,7 @@ retry: tsr->type = type_die; tsr->kind = TSR_KIND_TYPE; + tsr->offset = 0; tsr->ok = true; pr_debug_dtp("mov [%x] global addr=%"PRIx64" -> reg%d", @@ -504,6 +671,7 @@ retry: die_get_member_type(&type_die, offset, &type_die)) { tsr->type = type_die; tsr->kind = TSR_KIND_TYPE; + tsr->offset = 0; tsr->ok = true; if (src->multi_regs) { @@ -526,6 +694,7 @@ retry: src->offset, &type_die)) { tsr->type = type_die; tsr->kind = TSR_KIND_TYPE; + tsr->offset = 0; tsr->ok = true; pr_debug_dtp("mov [%x] pointer %#x(reg%d) -> reg%d", @@ -548,6 +717,7 @@ retry: &var_name, &offset) && !strcmp(var_name, "__per_cpu_offset")) { tsr->kind = TSR_KIND_PERCPU_BASE; + tsr->offset = 0; tsr->ok = true; pr_debug_dtp("mov [%x] percpu base reg%d\n", @@ -583,10 +753,10 @@ retry: */ if (!stack->compound) set_stack_state(stack, offset, tsr->kind, - &tsr->type); + &tsr->type, tsr->offset); } else { findnew_stack_state(state, offset, tsr->kind, - &tsr->type); + &tsr->type, tsr->offset); } if (dst->reg1 == fbreg) { @@ -596,6 +766,11 @@ retry: pr_debug_dtp("mov [%x] reg%d -> %#x(reg%d)", insn_offset, src->reg1, offset, dst->reg1); } + if (tsr->offset != 0) { + pr_debug_dtp(" reg%d offset %#x ->", + src->reg1, tsr->offset); + } + pr_debug_type_name(&tsr->type, tsr->kind); } /* diff --git a/tools/perf/arch/x86/tests/Build b/tools/perf/arch/x86/tests/Build index 7790b3e20f4e..b017d1ca6e3c 100644 --- a/tools/perf/arch/x86/tests/Build +++ b/tools/perf/arch/x86/tests/Build @@ -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 diff --git a/tools/perf/arch/x86/tests/arch-tests.c b/tools/perf/arch/x86/tests/arch-tests.c index 8f9cfeaa170f..c3e1619c5e79 100644 --- a/tools/perf/arch/x86/tests/arch-tests.c +++ b/tools/perf/arch/x86/tests/arch-tests.c @@ -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 diff --git a/tools/perf/arch/x86/tests/intel-pt-test.c b/tools/perf/arch/x86/tests/intel-pt-test.c index b217ed67cd4e..970997759ec2 100644 --- a/tools/perf/arch/x86/tests/intel-pt-test.c +++ b/tools/perf/arch/x86/tests/intel-pt-test.c @@ -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); diff --git a/tools/perf/arch/x86/tests/topdown.c b/tools/perf/arch/x86/tests/topdown.c index 1eba3b4594ef..3ee4e5e71be3 100644 --- a/tools/perf/arch/x86/tests/topdown.c +++ b/tools/perf/arch/x86/tests/topdown.c @@ -1,4 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 +#include <errno.h> #include "arch-tests.h" #include "../util/topdown.h" #include "debug.h" diff --git a/tools/perf/arch/x86/util/Build b/tools/perf/arch/x86/util/Build index 06d7c0205b3d..c0dc5965f362 100644 --- a/tools/perf/arch/x86/util/Build +++ b/tools/perf/arch/x86/util/Build @@ -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 diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c index add33cb5d1da..b394ad9cc635 100644 --- a/tools/perf/arch/x86/util/intel-pt.c +++ b/tools/perf/arch/x86/util/intel-pt.c @@ -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) @@ -72,7 +72,7 @@ static int intel_pt_parse_terms_with_default(const struct perf_pmu *pmu, int err; parse_events_terms__init(&terms); - err = parse_events_terms(&terms, str, /*input=*/ NULL); + err = parse_events_terms(&terms, str); if (err) goto out_free; @@ -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; } diff --git a/tools/perf/arch/x86/util/pmu.c b/tools/perf/arch/x86/util/pmu.c index 58113482654b..a3f96221758d 100644 --- a/tools/perf/arch/x86/util/pmu.c +++ b/tools/perf/arch/x86/util/pmu.c @@ -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")) diff --git a/tools/perf/arch/x86/util/topdown.c b/tools/perf/arch/x86/util/topdown.c index 0d01b662627a..bafd285119d7 100644 --- a/tools/perf/arch/x86/util/topdown.c +++ b/tools/perf/arch/x86/util/topdown.c @@ -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" |
