Re: [GIT PULL] perf fixes
The pull request you sent on Sun, 21 Mar 2021 11:56:36 +0100: > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-2021-03-21 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/1c74516c2da40ead2c22c4ac07c117c20f9c31ec Thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html
[GIT PULL] perf fixes
Linus, Please pull the latest perf/urgent git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-2021-03-21 # HEAD: 2dc0572f2cef87425147658698dce2600b799bd3 perf/x86/intel: Fix unchecked MSR access error caused by VLBR_EVENT Boundary condition fixes for bugs unearthed by the perf fuzzer. Thanks, Ingo --> Kan Liang (2): perf/x86/intel: Fix a crash caused by zero PEBS status perf/x86/intel: Fix unchecked MSR access error caused by VLBR_EVENT arch/x86/events/intel/core.c | 3 +++ arch/x86/events/intel/ds.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 7bbb5bb98d8c..37ce38403cb8 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -3659,6 +3659,9 @@ static int intel_pmu_hw_config(struct perf_event *event) return ret; if (event->attr.precise_ip) { + if ((event->attr.config & INTEL_ARCH_EVENT_MASK) == INTEL_FIXED_VLBR_EVENT) + return -EINVAL; + if (!(event->attr.freq || (event->attr.wakeup_events && !event->attr.watermark))) { event->hw.flags |= PERF_X86_EVENT_AUTO_RELOAD; if (!(event->attr.sample_type & diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c index 7ebae1826403..d32b302719fe 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -2010,7 +2010,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs, struct perf_sample_d */ if (!pebs_status && cpuc->pebs_enabled && !(cpuc->pebs_enabled & (cpuc->pebs_enabled-1))) - pebs_status = cpuc->pebs_enabled; + pebs_status = p->status = cpuc->pebs_enabled; bit = find_first_bit((unsigned long *)_status, x86_pmu.max_pebs_events);
Re: [GIT PULL] perf fixes
The pull request you sent on Sat, 15 Aug 2020 13:21:33 +0200: > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-2020-08-15 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/7f5f5909bb0b26dcd309424da14bdf0c7e93 Thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html
[GIT PULL] perf fixes
Linus, Please pull the latest perf/urgent git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-2020-08-15 # HEAD: bcfd218b66790243ef303c1b35ce59f786ded225 perf/x86/rapl: Add support for Intel SPR platform Misc fixes, an expansion of perf syscall access to CAP_PERFMON privileged tools, plus a RAPL HW-enablement for Intel SPR platforms. Thanks, Ingo --> Alexey Budankov (1): perf/core: Take over CAP_SYS_PTRACE creds to CAP_PERFMON capability Bhupesh Sharma (1): hw_breakpoint: Remove unused __register_perf_hw_breakpoint() declaration Masami Hiramatsu (1): kprobes: Remove show_registers() function prototype Zhang Rui (3): perf/x86/rapl: Fix missing psys sysfs attributes perf/x86/rapl: Support multiple RAPL unit quirks perf/x86/rapl: Add support for Intel SPR platform arch/x86/events/rapl.c| 46 +-- include/linux/hw_breakpoint.h | 3 --- include/linux/kprobes.h | 1 - kernel/events/core.c | 4 ++-- 4 files changed, 38 insertions(+), 16 deletions(-) diff --git a/arch/x86/events/rapl.c b/arch/x86/events/rapl.c index 68b38820b10e..67b411f7e8c4 100644 --- a/arch/x86/events/rapl.c +++ b/arch/x86/events/rapl.c @@ -130,11 +130,17 @@ struct rapl_pmus { struct rapl_pmu *pmus[]; }; +enum rapl_unit_quirk { + RAPL_UNIT_QUIRK_NONE, + RAPL_UNIT_QUIRK_INTEL_HSW, + RAPL_UNIT_QUIRK_INTEL_SPR, +}; + struct rapl_model { struct perf_msr *rapl_msrs; unsigned long events; unsigned intmsr_power_unit; - boolapply_quirk; + enum rapl_unit_quirkunit_quirk; }; /* 1/2^hw_unit Joule */ @@ -612,14 +618,28 @@ static int rapl_check_hw_unit(struct rapl_model *rm) for (i = 0; i < NR_RAPL_DOMAINS; i++) rapl_hw_unit[i] = (msr_rapl_power_unit_bits >> 8) & 0x1FULL; + switch (rm->unit_quirk) { /* * DRAM domain on HSW server and KNL has fixed energy unit which can be * different than the unit from power unit MSR. See * "Intel Xeon Processor E5-1600 and E5-2600 v3 Product Families, V2 * of 2. Datasheet, September 2014, Reference Number: 330784-001 " */ - if (rm->apply_quirk) + case RAPL_UNIT_QUIRK_INTEL_HSW: + rapl_hw_unit[PERF_RAPL_RAM] = 16; + break; + /* +* SPR shares the same DRAM domain energy unit as HSW, plus it +* also has a fixed energy unit for Psys domain. +*/ + case RAPL_UNIT_QUIRK_INTEL_SPR: rapl_hw_unit[PERF_RAPL_RAM] = 16; + rapl_hw_unit[PERF_RAPL_PSYS] = 0; + break; + default: + break; + } + /* * Calculate the timer rate: @@ -665,7 +685,7 @@ static const struct attribute_group *rapl_attr_update[] = { _events_pkg_group, _events_ram_group, _events_gpu_group, - _events_gpu_group, + _events_psys_group, NULL, }; @@ -698,7 +718,6 @@ static struct rapl_model model_snb = { .events = BIT(PERF_RAPL_PP0) | BIT(PERF_RAPL_PKG) | BIT(PERF_RAPL_PP1), - .apply_quirk= false, .msr_power_unit = MSR_RAPL_POWER_UNIT, .rapl_msrs = intel_rapl_msrs, }; @@ -707,7 +726,6 @@ static struct rapl_model model_snbep = { .events = BIT(PERF_RAPL_PP0) | BIT(PERF_RAPL_PKG) | BIT(PERF_RAPL_RAM), - .apply_quirk= false, .msr_power_unit = MSR_RAPL_POWER_UNIT, .rapl_msrs = intel_rapl_msrs, }; @@ -717,7 +735,6 @@ static struct rapl_model model_hsw = { BIT(PERF_RAPL_PKG) | BIT(PERF_RAPL_RAM) | BIT(PERF_RAPL_PP1), - .apply_quirk= false, .msr_power_unit = MSR_RAPL_POWER_UNIT, .rapl_msrs = intel_rapl_msrs, }; @@ -726,7 +743,7 @@ static struct rapl_model model_hsx = { .events = BIT(PERF_RAPL_PP0) | BIT(PERF_RAPL_PKG) | BIT(PERF_RAPL_RAM), - .apply_quirk= true, + .unit_quirk = RAPL_UNIT_QUIRK_INTEL_HSW, .msr_power_unit = MSR_RAPL_POWER_UNIT, .rapl_msrs = intel_rapl_msrs, }; @@ -734,7 +751,7 @@ static struct rapl_model model_hsx = { static struct rapl_model model_knl = { .events = BIT(PERF_RAPL_PKG) | BIT(PERF_RAPL_RAM), - .apply_quirk= true, + .unit_quirk = RAPL_UNIT_QUIRK_INTEL_HSW, .msr_power_unit = MSR_RAPL_POWER_UNIT, .rapl_msrs = intel_rapl_msrs, }; @@ -745,14 +762,22 @@ static struct rapl_model model_skl = { BIT(PERF_RAPL_RAM) | BIT(PERF_RAPL_PP1) |
Re: [GIT PULL] perf fixes
The pull request you sent on Sat, 12 Oct 2019 15:31:34 +0200: > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/465a7e291fd4f056d81baf5d5ed557bdb44c5457 Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 52e92f409dede388b7dc3ee13491fbf7a80db935 perf/x86/cstate: Add Tiger Lake CPU support Mostly tooling fixes, but also a couple of updates for new Intel models (which are technically hw-enablement, but to users it's a fix to perf behavior on those new CPUs - hope this is fine), an AUX inheritance fix, event time-sharing fix, and a fix for lost non-perf NMI events on AMD systems. Thanks, Ingo --> Alexander Shishkin (1): perf/core: Fix inheritance of aux_output groups Andi Kleen (2): perf script brstackinsn: Fix recovery from LBR/binary mismatch perf jevents: Fix period for Intel fixed counters Arnaldo Carvalho de Melo (13): tools headers uapi: Sync drm/i915_drm.h with the kernel sources tools headers uapi: Sync asm-generic/mman-common.h with the kernel tools headers uapi: Sync linux/usbdevice_fs.h with the kernel sources tools headers uapi: Sync linux/fs.h with the kernel sources tools headers kvm: Sync kvm headers with the kernel sources perf tools: Propagate get_cpuid() error perf evsel: Fall back to global 'perf_env' in perf_evsel__env() perf annotate: Propagate perf_env__arch() error perf annotate: Fix the signedness of failure returns perf annotate: Propagate the symbol__annotate() error return perf annotate: Fix arch specific ->init() failure errors perf annotate: Return appropriate error code for allocation failures perf annotate: Don't return -1 for error when doing BPF disassembly Ian Rogers (4): libsubcmd: Make _FORTIFY_SOURCE defines dependent on the feature perf tests: Avoid raising SEGV using an obvious NULL dereference perf docs: Allow man page date to be specified perf llvm: Don't access out-of-scope array Kan Liang (8): perf/x86/intel: Add Comet Lake CPU support perf/x86/msr: Add Comet Lake CPU support perf/x86/cstate: Add Comet Lake CPU support perf/x86/msr: Add new CPU model numbers for Ice Lake perf/x86/cstate: Update C-state counters for Ice Lake perf/x86/intel: Add Tiger Lake CPU support perf/x86/msr: Add Tiger Lake CPU support perf/x86/cstate: Add Tiger Lake CPU support Song Liu (2): perf/core: Rework memory accounting in perf_mmap() perf/core: Fix corner case in perf_rotate_context() Steve MacLean (3): perf map: Fix overlapped map handling perf inject jit: Fix JIT_CODE_MOVE filename perf docs: Correct and clarify jitdump spec Thomas Richter (2): perf vendor events s390: Add JSON transaction for machine type 8561 perf vendor events s390: Use s390 machine name instead of type 8561 Tom Lendacky (1): perf/x86/amd: Change/fix NMI latency mitigation to use a timestamp arch/x86/events/amd/core.c | 30 ++-- arch/x86/events/intel/core.c | 4 + arch/x86/events/intel/cstate.c | 44 +++-- arch/x86/events/msr.c | 7 + kernel/events/core.c | 43 - tools/arch/arm/include/uapi/asm/kvm.h | 4 +- tools/arch/arm64/include/uapi/asm/kvm.h| 4 +- tools/arch/s390/include/uapi/asm/kvm.h | 6 + tools/arch/x86/include/uapi/asm/vmx.h | 2 + tools/include/uapi/asm-generic/mman-common.h | 3 + tools/include/uapi/drm/i915_drm.h | 1 + tools/include/uapi/linux/fs.h | 55 +-- tools/include/uapi/linux/fscrypt.h | 181 + tools/include/uapi/linux/kvm.h | 3 + tools/include/uapi/linux/usbdevice_fs.h| 4 + tools/lib/subcmd/Makefile | 8 +- tools/perf/Documentation/asciidoc.conf | 3 + tools/perf/Documentation/jitdump-specification.txt | 4 +- tools/perf/arch/arm/annotate/instructions.c| 4 +- tools/perf/arch/arm64/annotate/instructions.c | 4 +- tools/perf/arch/powerpc/util/header.c | 3 +- tools/perf/arch/s390/annotate/instructions.c | 6 +- tools/perf/arch/s390/util/header.c | 9 +- tools/perf/arch/x86/annotate/instructions.c| 6 +- tools/perf/arch/x86/util/header.c | 3 +- tools/perf/builtin-kvm.c | 7 +- tools/perf/builtin-script.c| 6 +- tools/perf/check-headers.sh| 1 + .../arch/s390/{cf_m8561 => cf_z15}/basic.json | 0 .../arch/s390/{cf_m8561 => cf_z15}/crypto.json | 0 .../arch/s390/{cf_m8561 => cf_z15}/crypto6.json| 0 .../arch/s390/{cf_m8561 => cf_z15}/extended.json | 0 .../pmu-events/arch/s390/cf_z15/transaction.json | 7 +
Re: [GIT PULL] perf fixes
The pull request you sent on Sun, 14 Jul 2019 14:01:02 +0200: > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/1d039859330b874d48080885eb31f4f129c246f1 Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: e4557c1a46b0d32746bd309e1941914b5a6912b4 perf/x86/intel: Fix spurious NMI on fixed counter A number of PMU driver corner case fixes, a race fix, an event grouping fix, plus a bunch of tooling fixes/updates. Thanks, Ingo --> Adrian Hunter (2): perf scripts python: export-to-postgresql.py: Fix DROP VIEW power_events_view perf scripts python: export-to-sqlite.py: Fix DROP VIEW power_events_view Alexander Shishkin (1): perf/core: Fix exclusive events' grouping Arnaldo Carvalho de Melo (9): perf inject: The tool->read() call may pass a NULL evsel, handle it perf evsel: perf_evsel__name(NULL) is valid, no need to check evsel perf tools: Add missing headers, mostly stdlib.h perf namespaces: Move the conditional setns() prototype to namespaces.h perf tools: Move get_current_dir_name() cond prototype out of util.h tools lib: Adopt zalloc()/zfree() from tools/perf perf tools: Use zfree() where applicable perf tools: Use list_del_init() more thorougly perf metricgroup: Add missing list_del_init() when flushing egroups list Kan Liang (1): perf/x86/intel: Fix spurious NMI on fixed counter Kim Phillips (2): perf/x86/amd/uncore: Do not set 'ThreadMask' and 'SliceMask' for non-L3 PMCs perf/x86/amd/uncore: Set the thread mask for F17h L3 PMCs Leo Yan (10): perf stat: Fix use-after-freed pointer detected by the smatch tool perf top: Fix potential NULL pointer dereference detected by the smatch tool perf annotate: Fix dereferencing freed memory found by the smatch tool perf trace: Fix potential NULL pointer dereference found by the smatch tool perf map: Fix potential NULL pointer dereference found by smatch tool perf session: Fix potential NULL pointer dereference found by the smatch tool perf cs-etm: Fix potential NULL pointer dereference found by the smatch tool perf hists browser: Fix potential NULL pointer dereference found by the smatch tool perf intel-bts: Fix potential NULL pointer dereference found by the smatch tool perf intel-pt: Fix potential NULL pointer dereference found by the smatch tool Luke Mujica (2): perf parse-events: Remove unused variable 'i' perf parse-events: Remove unused variable: error Numfor Mbiziwo-Tiapo (1): perf test mmap-thread-lookup: Initialize variable to suppress memory sanitizer warning Peter Zijlstra (1): perf/core: Fix race between close() and fork() Song Liu (1): perf script: Assume native_arch for pipe mode arch/x86/events/amd/uncore.c | 15 ++-- arch/x86/events/intel/core.c | 8 +-- include/linux/perf_event.h | 5 ++ kernel/events/core.c | 83 -- tools/include/linux/zalloc.h | 12 tools/lib/zalloc.c | 15 tools/perf/MANIFEST| 1 + tools/perf/arch/arm/annotate/instructions.c| 1 + tools/perf/arch/arm/util/auxtrace.c| 1 + tools/perf/arch/arm/util/cs-etm.c | 1 + tools/perf/arch/arm64/util/arm-spe.c | 1 + tools/perf/arch/common.c | 3 +- tools/perf/arch/powerpc/util/perf_regs.c | 4 +- tools/perf/arch/s390/util/auxtrace.c | 1 + tools/perf/arch/s390/util/header.c | 3 +- tools/perf/arch/x86/util/event.c | 2 +- tools/perf/arch/x86/util/intel-bts.c | 2 +- tools/perf/arch/x86/util/intel-pt.c| 2 +- tools/perf/arch/x86/util/perf_regs.c | 2 +- tools/perf/bench/futex-hash.c | 3 +- tools/perf/bench/futex-lock-pi.c | 3 +- tools/perf/bench/mem-functions.c | 2 +- tools/perf/bench/numa.c| 2 +- tools/perf/builtin-annotate.c | 2 +- tools/perf/builtin-bench.c | 2 +- tools/perf/builtin-c2c.c | 2 +- tools/perf/builtin-config.c| 1 + tools/perf/builtin-diff.c | 2 +- tools/perf/builtin-ftrace.c| 2 +- tools/perf/builtin-help.c | 2 + tools/perf/builtin-inject.c| 2 +- tools/perf/builtin-kmem.c | 2 +- tools/perf/builtin-kvm.c | 2 +- tools/perf/builtin-lock.c | 10 +-- tools/perf/builtin-probe.c | 2 +- tools/perf/builtin-record.c| 4 +- tools/perf/builtin-report.c
Re: [GIT PULL] perf fixes
The pull request you sent on Sat, 29 Jun 2019 10:54:39 +0200: > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/57103eb7c6cad04c0611b7a5767a381b34b8b0ab Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 8b12b812f5367c2469fb937da7e28dd321ad8d7b perf/x86/regs: Use PERF_REG_EXTENDED_MASK Various fixes, most of them related to bugs perf fuzzing found in the x86 code. Thanks, Ingo --> Kan Liang (5): perf/x86: Disable extended registers for non-supported PMUs perf/x86/regs: Check reserved bits perf/x86: Clean up PEBS_XMM_REGS perf/x86: Remove pmu->pebs_no_xmm_regs perf/x86/regs: Use PERF_REG_EXTENDED_MASK Peter Zijlstra (1): perf/core: Fix perf_sample_regs_user() mm check Ravi Bangoria (1): perf/ioctl: Add check for the sample_period value arch/x86/events/core.c | 6 +++--- arch/x86/events/intel/ds.c | 9 - arch/x86/events/perf_event.h| 21 + arch/x86/include/uapi/asm/perf_regs.h | 3 +++ arch/x86/kernel/perf_regs.c | 7 +-- include/linux/perf_event.h | 1 + include/linux/perf_regs.h | 8 kernel/events/core.c| 23 ++- tools/arch/x86/include/uapi/asm/perf_regs.h | 3 +++ tools/perf/arch/x86/include/perf_regs.h | 1 - tools/perf/arch/x86/util/perf_regs.c| 4 ++-- 11 files changed, 48 insertions(+), 38 deletions(-) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index f315425d8468..52a97463cb24 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -561,14 +561,14 @@ int x86_pmu_hw_config(struct perf_event *event) } /* sample_regs_user never support XMM registers */ - if (unlikely(event->attr.sample_regs_user & PEBS_XMM_REGS)) + if (unlikely(event->attr.sample_regs_user & PERF_REG_EXTENDED_MASK)) return -EINVAL; /* * Besides the general purpose registers, XMM registers may * be collected in PEBS on some platforms, e.g. Icelake */ - if (unlikely(event->attr.sample_regs_intr & PEBS_XMM_REGS)) { - if (x86_pmu.pebs_no_xmm_regs) + if (unlikely(event->attr.sample_regs_intr & PERF_REG_EXTENDED_MASK)) { + if (!(event->pmu->capabilities & PERF_PMU_CAP_EXTENDED_REGS)) return -EINVAL; if (!event->attr.precise_ip) diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c index 7acc526b4ad2..505c73dc6a73 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -987,7 +987,7 @@ static u64 pebs_update_adaptive_cfg(struct perf_event *event) pebs_data_cfg |= PEBS_DATACFG_GP; if ((sample_type & PERF_SAMPLE_REGS_INTR) && - (attr->sample_regs_intr & PEBS_XMM_REGS)) + (attr->sample_regs_intr & PERF_REG_EXTENDED_MASK)) pebs_data_cfg |= PEBS_DATACFG_XMMS; if (sample_type & PERF_SAMPLE_BRANCH_STACK) { @@ -1964,10 +1964,9 @@ void __init intel_ds_init(void) x86_pmu.bts = boot_cpu_has(X86_FEATURE_BTS); x86_pmu.pebs = boot_cpu_has(X86_FEATURE_PEBS); x86_pmu.pebs_buffer_size = PEBS_BUFFER_SIZE; - if (x86_pmu.version <= 4) { + if (x86_pmu.version <= 4) x86_pmu.pebs_no_isolation = 1; - x86_pmu.pebs_no_xmm_regs = 1; - } + if (x86_pmu.pebs) { char pebs_type = x86_pmu.intel_cap.pebs_trap ? '+' : '-'; char *pebs_qual = ""; @@ -2020,9 +2019,9 @@ void __init intel_ds_init(void) PERF_SAMPLE_TIME; x86_pmu.flags |= PMU_FL_PEBS_ALL; pebs_qual = "-baseline"; + x86_get_pmu()->capabilities |= PERF_PMU_CAP_EXTENDED_REGS; } else { /* Only basic record supported */ - x86_pmu.pebs_no_xmm_regs = 1; x86_pmu.large_pebs_flags &= ~(PERF_SAMPLE_ADDR | PERF_SAMPLE_TIME | diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h index a6ac2f4f76fc..4e346856ee19 100644 --- a/arch/x86/events/perf_event.h +++ b/arch/x86/events/perf_event.h @@ -121,24 +121,6 @@ struct amd_nb { (1ULL << PERF_REG_X86_R14) | \ (1ULL << PERF_REG_X86_R15)) -#define PEBS_XMM_REGS \ - ((1ULL << PERF_REG_X86_XMM0) | \ -(1ULL << PERF_REG_X86_XMM1) | \ -(1ULL << PERF_REG_X86_XMM2) | \ -(1ULL << PERF_REG_X86_XMM3) | \ -(1ULL << PERF_REG_X86_XMM4) | \ -(1ULL << PERF_REG_X86_XMM5) | \ -(1ULL << PERF_REG_X86_XMM6) | \ -(1ULL << PERF_REG_X86_XMM7) | \ -(1ULL << PERF_REG_X86_XMM8) | \ -
Re: [GIT PULL] perf fixes
The pull request you sent on Sun, 2 Jun 2019 19:39:53 +0200: > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/6751b8d91af515a5dc5196fe305eee0a635e2ea2 Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 849e96f30068d4f6f8352715e02a10533a46deba Merge tag 'perf-urgent-for-mingo-5.2-20190528' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent On the kernel side there's a bunch of ring-buffer ordering fixes for a reproducible bug, plus a PEBS constraints regression fix - plus tooling fixes. Thanks, Ingo --> Arnaldo Carvalho de Melo (8): tools include UAPI: Update copy of files related to new fspick, fsmount, fsconfig, fsopen, move_mount and open_tree syscalls tools arch x86: Sync asm/cpufeatures.h with the with the kernel tools headers UAPI: Sync linux/sched.h with the kernel tools headers UAPI: Sync linux/fs.h with the kernel tools headers UAPI: Sync drm/i915_drm.h with the kernel tools headers UAPI: Sync drm/drm.h with the kernel perf test vmlinux-kallsyms: Ignore aliases to _etext when searching on kallsyms tools headers UAPI: Sync kvm.h headers with the kernel sources Jiri Olsa (1): perf machine: Read also the end of the kernel Namhyung Kim (2): perf namespace: Protect reading thread's namespace perf session: Add missing swap ops for namespace events Peter Zijlstra (3): perf/ring_buffer: Add ordering to rb->nest increment perf/ring-buffer: Always use {READ,WRITE}_ONCE() for rb->user_page data perf/ring-buffer: Use regular variables for nesting Shawn Landden (1): perf data: Fix 'strncat may truncate' build failure with recent gcc Stephane Eranian (1): perf/x86/intel/ds: Fix EVENT vs. UEVENT PEBS constraints Thomas Richter (1): perf record: Fix s390 missing module symbol and warning for non-root users Vitaly Chikunov (1): perf arm64: Fix mksyscalltbl when system kernel headers are ahead of the kernel Yabin Cui (1): perf/ring_buffer: Fix exposing a temporarily decreased data_head arch/x86/events/intel/ds.c| 28 +-- kernel/events/internal.h | 4 +- kernel/events/ring_buffer.c | 64 -- tools/arch/arm64/include/uapi/asm/kvm.h | 43 tools/arch/powerpc/include/uapi/asm/kvm.h | 46 tools/arch/s390/include/uapi/asm/kvm.h| 4 +- tools/arch/x86/include/asm/cpufeatures.h | 3 + tools/include/uapi/asm-generic/unistd.h | 14 +- tools/include/uapi/drm/drm.h | 37 tools/include/uapi/drm/i915_drm.h | 254 +++--- tools/include/uapi/linux/fcntl.h | 2 + tools/include/uapi/linux/fs.h | 3 + tools/include/uapi/linux/kvm.h| 15 +- tools/include/uapi/linux/mount.h | 62 ++ tools/include/uapi/linux/sched.h | 1 + tools/perf/arch/arm64/entry/syscalls/mksyscalltbl | 2 +- tools/perf/arch/s390/util/machine.c | 9 +- tools/perf/arch/x86/entry/syscalls/syscall_64.tbl | 6 + tools/perf/tests/vmlinux-kallsyms.c | 9 +- tools/perf/util/data-convert-bt.c | 2 +- tools/perf/util/machine.c | 27 ++- tools/perf/util/session.c | 21 ++ tools/perf/util/thread.c | 15 +- 23 files changed, 547 insertions(+), 124 deletions(-)
Re: [GIT PULL] perf fixes
The pull request you sent on Thu, 16 May 2019 18:05:18 +0200: > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/c77ee64f8a0416623dfd540ff684d2daa1c0 Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: c7a286577d7592720c2f179aadfb325a1ff48c95 perf/x86/intel: Allow PEBS multi-entry in watermark mode An x86 PMU constraint fix, an interface fix, and a Sparse fix. Thanks, Ingo --> Stephane Eranian (2): perf/x86/intel: Fix INTEL_FLAGS_EVENT_CONSTRAINT* masking perf/x86/intel: Allow PEBS multi-entry in watermark mode Wang Hai (1): perf/x86/amd/iommu: Make the 'amd_iommu_attr_groups' symbol static arch/x86/events/amd/iommu.c | 2 +- arch/x86/events/intel/core.c | 2 +- arch/x86/events/perf_event.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/events/amd/iommu.c b/arch/x86/events/amd/iommu.c index 7635c23f7d82..58a6993d7eb3 100644 --- a/arch/x86/events/amd/iommu.c +++ b/arch/x86/events/amd/iommu.c @@ -393,7 +393,7 @@ static __init int _init_events_attrs(void) return 0; } -const struct attribute_group *amd_iommu_attr_groups[] = { +static const struct attribute_group *amd_iommu_attr_groups[] = { _iommu_format_group, _iommu_cpumask_group, _iommu_events_group, diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index ef763f535e3a..12ec402f4114 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -3265,7 +3265,7 @@ static int intel_pmu_hw_config(struct perf_event *event) return ret; if (event->attr.precise_ip) { - if (!(event->attr.freq || event->attr.wakeup_events)) { + if (!(event->attr.freq || (event->attr.wakeup_events && !event->attr.watermark))) { event->hw.flags |= PERF_X86_EVENT_AUTO_RELOAD; if (!(event->attr.sample_type & ~intel_pmu_large_pebs_flags(event))) diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h index 07fc84bb85c1..a6ac2f4f76fc 100644 --- a/arch/x86/events/perf_event.h +++ b/arch/x86/events/perf_event.h @@ -394,10 +394,10 @@ struct cpu_hw_events { /* Event constraint, but match on all event flags too. */ #define INTEL_FLAGS_EVENT_CONSTRAINT(c, n) \ - EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK|X86_ALL_EVENT_FLAGS) + EVENT_CONSTRAINT(c, n, ARCH_PERFMON_EVENTSEL_EVENT|X86_ALL_EVENT_FLAGS) #define INTEL_FLAGS_EVENT_CONSTRAINT_RANGE(c, e, n)\ - EVENT_CONSTRAINT_RANGE(c, e, n, INTEL_ARCH_EVENT_MASK|X86_ALL_EVENT_FLAGS) + EVENT_CONSTRAINT_RANGE(c, e, n, ARCH_PERFMON_EVENTSEL_EVENT|X86_ALL_EVENT_FLAGS) /* Check only flags, but allow all event/umask */ #define INTEL_ALL_EVENT_CONSTRAINT(code, n)\
Re: [GIT PULL] perf fixes
The pull request you sent on Sun, 5 May 2019 14:47:46 +0200: > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/7178fb0b239d1c037876301c116fc9a6c1bd2ac0 Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 6f55967ad9d9752813e36de6d5fdbd19741adfc7 perf/x86/intel: Fix race in intel_pmu_disable_event() I'd like to apologize for this very late pull request: I was dithering through the week whether to send the fixes, and then yesterday Jiri's crash fix for a regression introduced in this cycle clearly marked perf/urgent as 'must merge now'. Most of the commits are tooling fixes, plus there's three kernel fixes via four commits: - race fix in the Intel PEBS code - fix an AUX bug and roll back a previous attempt - fix AMD family 17h generic HW cache-event perf counters The largest diffstat contribution comes from the AMD fix - a new event table is introduced, which is a fairly low risk change but has a large linecount. Thanks, Ingo --> Alexander Shishkin (2): perf/ring_buffer: Fix AUX software double buffering perf/x86/intel/pt: Remove software double buffering PMU capability Arnaldo Carvalho de Melo (5): tools uapi x86: Sync vmx.h with the kernel perf bench numa: Add define for RUSAGE_THREAD if not present tools build: Add -ldl to the disassembler-four-args feature test tools arch uapi: Copy missing unistd.h headers for arc, hexagon and riscv perf tools: Remove needless asm/unistd.h include fixing build in some places Bo YU (1): perf bpf: Return value with unlocking in perf_env__find_btf() Jiri Olsa (1): perf/x86/intel: Fix race in intel_pmu_disable_event() Kim Phillips (2): perf/x86/amd: Update generic hardware cache events for Family 17h MAINTAINERS: Include vendor specific files under arch/*/events/* Leo Yan (3): tools lib traceevent: Change tag string for error perf cs-etm: Don't check cs_etm_queue::prev_packet validity perf cs-etm: Always allocate memory for cs_etm_queue::prev_packet Thadeu Lima de Souza Cascardo (1): perf annotate: Fix build on 32 bit for BPF annotation Thomas Richter (1): perf report: Report OOM in status line in the GTK UI MAINTAINERS | 1 + arch/x86/events/amd/core.c | 111 ++- arch/x86/events/intel/core.c | 10 ++- arch/x86/events/intel/pt.c | 3 +- include/linux/perf_event.h | 1 - kernel/events/ring_buffer.c | 3 +- tools/arch/arc/include/uapi/asm/unistd.h | 51 tools/arch/hexagon/include/uapi/asm/unistd.h | 40 ++ tools/arch/riscv/include/uapi/asm/unistd.h | 42 ++ tools/arch/x86/include/uapi/asm/vmx.h| 1 + tools/lib/traceevent/parse-utils.c | 2 +- tools/perf/Makefile.config | 2 +- tools/perf/bench/numa.c | 4 + tools/perf/util/annotate.c | 8 +- tools/perf/util/cloexec.c| 1 - tools/perf/util/cs-etm.c | 14 +--- tools/perf/util/env.c| 2 +- tools/perf/util/session.c| 8 +- 18 files changed, 272 insertions(+), 32 deletions(-) create mode 100644 tools/arch/arc/include/uapi/asm/unistd.h create mode 100644 tools/arch/hexagon/include/uapi/asm/unistd.h create mode 100644 tools/arch/riscv/include/uapi/asm/unistd.h diff --git a/MAINTAINERS b/MAINTAINERS index 5c38f21aee78..3a15b6d7584e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -12176,6 +12176,7 @@ F: arch/*/kernel/*/*/perf_event*.c F: arch/*/include/asm/perf_event.h F: arch/*/kernel/perf_callchain.c F: arch/*/events/* +F: arch/*/events/*/* F: tools/perf/ PERSONALITY HANDLING diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c index d45f3fbd232e..f15441b07dad 100644 --- a/arch/x86/events/amd/core.c +++ b/arch/x86/events/amd/core.c @@ -116,6 +116,110 @@ static __initconst const u64 amd_hw_cache_event_ids }, }; +static __initconst const u64 amd_hw_cache_event_ids_f17h + [PERF_COUNT_HW_CACHE_MAX] + [PERF_COUNT_HW_CACHE_OP_MAX] + [PERF_COUNT_HW_CACHE_RESULT_MAX] = { +[C(L1D)] = { + [C(OP_READ)] = { + [C(RESULT_ACCESS)] = 0x0040, /* Data Cache Accesses */ + [C(RESULT_MISS)] = 0xc860, /* L2$ access from DC Miss */ + }, + [C(OP_WRITE)] = { + [C(RESULT_ACCESS)] = 0, + [C(RESULT_MISS)] = 0, + }, + [C(OP_PREFETCH)] = { + [C(RESULT_ACCESS)] = 0xff5a, /* h/w prefetch DC Fills */ + [C(RESULT_MISS)] = 0, + }, +}, +[C(L1I)] = { + [C(OP_READ)] = { + [C(RESULT_ACCESS)] = 0x0080, /* Instruction cache fetches */ + [C(RESULT_MISS)] = 0x0081, /* Instruction cache misses */ +
Re: [GIT PULL] perf fixes
The pull request you sent on Sat, 20 Apr 2019 09:43:53 +0200: > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/b25c69b9d5e41159b54ad7cb33f7d9ead8523d33 Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 7579dfc42d2e3bef901991803efc81dc1ac65f2b Merge tag 'perf-urgent-for-mingo-5.1-20190419' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent Misc fixes: - various tooling fixes - kretprobe fixes - kprobes annotation fixes - kprobes error checking fix - fix the default events for AMD Family 17h CPUs - PEBS fix - AUX record fix - address filtering fix Thanks, Ingo --> Adrian Hunter (1): perf scripts python: export-to-sqlite.py: Fix use of parent_id in calls_view Alexander Shishkin (2): perf/core: Fix the address filtering fix perf/ring_buffer: Fix AUX record suppression Arnaldo Carvalho de Melo (1): tools include uapi: Sync sound/asound.h copy Gustavo A. R. Silva (1): perf header: Fix lock/unlock imbalances when processing BPF/BTF info Jiri Olsa (6): perf stat: Disable DIR_FORMAT feature for 'perf stat record' perf top: Always sample time to satisfy needs of use of ordered queuing perf bpf: Return NULL when RB tree lookup fails in perf_env__find_bpf_prog_info() perf evlist: Fix side band thread draining perf tools: Fix map reference counting perf bpf: Return NULL when RB tree lookup fails in perf_env__find_btf() Kan Liang (1): perf/x86: Fix incorrect PEBS_REGS Kim Phillips (1): perf/x86/amd: Add event map for AMD Family 17h Mao Han (1): perf evsel: Use hweight64() instead of hweight_long(attr.sample_regs_user) Masami Hiramatsu (4): kprobes: Fix error check when reusing optimized probes x86/kprobes: Verify stack frame on kretprobe kprobes: Mark ftrace mcount handler functions nokprobe x86/kprobes: Avoid kretprobe recursion bug Rikard Falkeborn (1): tools lib traceevent: Fix missing equality check for strcmp Song Liu (1): perf tools: Check maps for bpf programs arch/x86/events/amd/core.c| 35 ++- arch/x86/events/intel/core.c | 2 +- arch/x86/events/perf_event.h | 38 ++--- arch/x86/kernel/kprobes/core.c| 48 +-- include/linux/kprobes.h | 1 + kernel/events/core.c | 37 - kernel/events/ring_buffer.c | 33 +- kernel/kprobes.c | 6 ++-- kernel/trace/ftrace.c | 6 +++- tools/include/uapi/sound/asound.h | 1 + tools/lib/traceevent/event-parse.c| 2 +- tools/perf/builtin-stat.c | 1 + tools/perf/builtin-top.c | 1 + tools/perf/scripts/python/export-to-sqlite.py | 2 +- tools/perf/util/env.c | 8 +++-- tools/perf/util/evlist.c | 14 +--- tools/perf/util/evsel.c | 12 +++ tools/perf/util/header.c | 22 +++- tools/perf/util/map.c | 20 +-- tools/perf/util/map.h | 4 ++- 20 files changed, 195 insertions(+), 98 deletions(-) diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c index 0ecfac84ba91..d45f3fbd232e 100644 --- a/arch/x86/events/amd/core.c +++ b/arch/x86/events/amd/core.c @@ -117,22 +117,39 @@ static __initconst const u64 amd_hw_cache_event_ids }; /* - * AMD Performance Monitor K7 and later. + * AMD Performance Monitor K7 and later, up to and including Family 16h: */ static const u64 amd_perfmon_event_map[PERF_COUNT_HW_MAX] = { - [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, - [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, - [PERF_COUNT_HW_CACHE_REFERENCES] = 0x077d, - [PERF_COUNT_HW_CACHE_MISSES] = 0x077e, - [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, - [PERF_COUNT_HW_BRANCH_MISSES]= 0x00c3, - [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x00d0, /* "Decoder empty" event */ - [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = 0x00d1, /* "Dispatch stalls" event */ + [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, + [PERF_COUNT_HW_INSTRUCTIONS]= 0x00c0, + [PERF_COUNT_HW_CACHE_REFERENCES]= 0x077d, + [PERF_COUNT_HW_CACHE_MISSES]= 0x077e, + [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, + [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, + [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x00d0, /* "Decoder empty" event */ + [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = 0x00d1, /* "Dispatch stalls" event */ +}; + +/* + * AMD Performance Monitor Family 17h and later: + */ +static const u64 amd_f17h_perfmon_event_map[PERF_COUNT_HW_MAX] = +{ +
Re: [GIT PULL] perf fixes
The pull request you sent on Fri, 12 Apr 2019 15:06:42 +0200: > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/73fdb2c908c64a32e11c72c029d636f556859c0d Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 1d54ad944074010609562da5c89e4f5df2f4e5db perf/core: Fix perf_event_disable_inatomic() race Six kernel side fixes: three related to NMI handling on AMD systems, a race fix, a kexec initialization fix and a PEBS sampling fix. Thanks, Ingo --> Lendacky, Thomas (3): x86/perf/amd: Resolve race condition when disabling PMC x86/perf/amd: Resolve NMI latency issues for active PMCs x86/perf/amd: Remove need to check "running" bit in NMI handler Peter Zijlstra (2): perf/x86/intel: Initialize TFA MSR perf/core: Fix perf_event_disable_inatomic() race Stephane Eranian (1): perf/x86/intel: Fix handling of wakeup_events for multi-entry PEBS arch/x86/events/amd/core.c | 140 +-- arch/x86/events/core.c | 13 +--- arch/x86/events/intel/core.c | 8 ++- kernel/events/core.c | 52 +--- kernel/events/ring_buffer.c | 4 +- 5 files changed, 190 insertions(+), 27 deletions(-) diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c index 7d2d7c801dba..0ecfac84ba91 100644 --- a/arch/x86/events/amd/core.c +++ b/arch/x86/events/amd/core.c @@ -3,10 +3,14 @@ #include #include #include +#include #include +#include #include "../perf_event.h" +static DEFINE_PER_CPU(unsigned int, perf_nmi_counter); + static __initconst const u64 amd_hw_cache_event_ids [PERF_COUNT_HW_CACHE_MAX] [PERF_COUNT_HW_CACHE_OP_MAX] @@ -429,6 +433,132 @@ static void amd_pmu_cpu_dead(int cpu) } } +/* + * When a PMC counter overflows, an NMI is used to process the event and + * reset the counter. NMI latency can result in the counter being updated + * before the NMI can run, which can result in what appear to be spurious + * NMIs. This function is intended to wait for the NMI to run and reset + * the counter to avoid possible unhandled NMI messages. + */ +#define OVERFLOW_WAIT_COUNT50 + +static void amd_pmu_wait_on_overflow(int idx) +{ + unsigned int i; + u64 counter; + + /* +* Wait for the counter to be reset if it has overflowed. This loop +* should exit very, very quickly, but just in case, don't wait +* forever... +*/ + for (i = 0; i < OVERFLOW_WAIT_COUNT; i++) { + rdmsrl(x86_pmu_event_addr(idx), counter); + if (counter & (1ULL << (x86_pmu.cntval_bits - 1))) + break; + + /* Might be in IRQ context, so can't sleep */ + udelay(1); + } +} + +static void amd_pmu_disable_all(void) +{ + struct cpu_hw_events *cpuc = this_cpu_ptr(_hw_events); + int idx; + + x86_pmu_disable_all(); + + /* +* This shouldn't be called from NMI context, but add a safeguard here +* to return, since if we're in NMI context we can't wait for an NMI +* to reset an overflowed counter value. +*/ + if (in_nmi()) + return; + + /* +* Check each counter for overflow and wait for it to be reset by the +* NMI if it has overflowed. This relies on the fact that all active +* counters are always enabled when this function is caled and +* ARCH_PERFMON_EVENTSEL_INT is always set. +*/ + for (idx = 0; idx < x86_pmu.num_counters; idx++) { + if (!test_bit(idx, cpuc->active_mask)) + continue; + + amd_pmu_wait_on_overflow(idx); + } +} + +static void amd_pmu_disable_event(struct perf_event *event) +{ + x86_pmu_disable_event(event); + + /* +* This can be called from NMI context (via x86_pmu_stop). The counter +* may have overflowed, but either way, we'll never see it get reset +* by the NMI if we're already in the NMI. And the NMI latency support +* below will take care of any pending NMI that might have been +* generated by the overflow. +*/ + if (in_nmi()) + return; + + amd_pmu_wait_on_overflow(event->hw.idx); +} + +/* + * Because of NMI latency, if multiple PMC counters are active or other sources + * of NMIs are received, the perf NMI handler can handle one or more overflowed + * PMC counters outside of the NMI associated with the PMC overflow. If the NMI + * doesn't arrive at the LAPIC in time to become a pending NMI, then the kernel + * back-to-back NMI support won't be active. This PMC handler needs to take into + * account that this can occur, otherwise this could result in unknown NMI + * messages being issued. Examples of this is PMC overflow while in the NMI + * handler when multiple PMCs are active or PMC overflow while handling some + * other source of an NMI. + * + * Attempt to mitigate
Re: [GIT pull] perf fixes for 5.1-rc1
The pull request you sent on Sun, 17 Mar 2019 15:26:44 +0100 (CET): > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/69ebf9a16a74cf05359b851a5dc614a63f075d1a Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
[GIT pull] perf fixes for 5.1-rc1
Linus, please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus Three fixes for the fallout from the TSX errata workaround: - Prevent memory corruption caused by a unchecked out of bound array index. - Two trivial fixes to address compiler warnings. Thanks, tglx --> Peter Zijlstra (2): perf/x86/intel: Fix memory corruption perf/x86: Fixup typo in stub functions kbuild test robot (1): perf/x86/intel: Make dev_attr_allow_tsx_force_abort static arch/x86/events/intel/core.c | 4 ++-- arch/x86/events/perf_event.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 35102ecdfc8d..8baa441d8000 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -3410,7 +3410,7 @@ tfa_get_event_constraints(struct cpu_hw_events *cpuc, int idx, /* * Without TFA we must not use PMC3. */ - if (!allow_tsx_force_abort && test_bit(3, c->idxmsk)) { + if (!allow_tsx_force_abort && test_bit(3, c->idxmsk) && idx >= 0) { c = dyn_constraint(cpuc, c, idx); c->idxmsk64 &= ~(1ULL << 3); c->weight--; @@ -4179,7 +4179,7 @@ static struct attribute *intel_pmu_caps_attrs[] = { NULL }; -DEVICE_BOOL_ATTR(allow_tsx_force_abort, 0644, allow_tsx_force_abort); +static DEVICE_BOOL_ATTR(allow_tsx_force_abort, 0644, allow_tsx_force_abort); static struct attribute *intel_pmu_attrs[] = { _attr_freeze_on_smi.attr, diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h index b04ae6c8775e..a75955741c50 100644 --- a/arch/x86/events/perf_event.h +++ b/arch/x86/events/perf_event.h @@ -1033,12 +1033,12 @@ static inline int intel_pmu_init(void) return 0; } -static inline int intel_cpuc_prepare(struct cpu_hw_event *cpuc, int cpu) +static inline int intel_cpuc_prepare(struct cpu_hw_events *cpuc, int cpu) { return 0; } -static inline void intel_cpuc_finish(struct cpu_hw_event *cpuc) +static inline void intel_cpuc_finish(struct cpu_hw_events *cpuc) { }
Re: [GIT PULL] perf fixes
The pull request you sent on Sun, 17 Feb 2019 11:10:51 +0100: > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/dd6f29da695dbfe5a8ff84ebfdd2110d68e8f511 Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 528871b456026e6127d95b1b2bd8e3a003dc1614 perf/core: Fix impossible ring-buffer sizes warning Two fixes on the kernel side: fix an over-eager condition that failed larger perf ring-buffer sizes, plus fix crashes in the Intel BTS code for a corner case, found by fuzzing. Thanks, Ingo --> Ingo Molnar (1): perf/core: Fix impossible ring-buffer sizes warning Jiri Olsa (1): perf/x86: Add check_period PMU callback arch/x86/events/core.c | 14 ++ arch/x86/events/intel/core.c | 9 + arch/x86/events/perf_event.h | 16 ++-- include/linux/perf_event.h | 5 + kernel/events/core.c | 16 kernel/events/ring_buffer.c | 2 +- 6 files changed, 59 insertions(+), 3 deletions(-) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 374a19712e20..b684f0294f35 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -2278,6 +2278,19 @@ void perf_check_microcode(void) x86_pmu.check_microcode(); } +static int x86_pmu_check_period(struct perf_event *event, u64 value) +{ + if (x86_pmu.check_period && x86_pmu.check_period(event, value)) + return -EINVAL; + + if (value && x86_pmu.limit_period) { + if (x86_pmu.limit_period(event, value) > value) + return -EINVAL; + } + + return 0; +} + static struct pmu pmu = { .pmu_enable = x86_pmu_enable, .pmu_disable= x86_pmu_disable, @@ -2302,6 +2315,7 @@ static struct pmu pmu = { .event_idx = x86_pmu_event_idx, .sched_task = x86_pmu_sched_task, .task_ctx_size = sizeof(struct x86_perf_task_context), + .check_period = x86_pmu_check_period, }; void arch_perf_update_userpage(struct perf_event *event, diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index daafb893449b..730978dff63f 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -3587,6 +3587,11 @@ static void intel_pmu_sched_task(struct perf_event_context *ctx, intel_pmu_lbr_sched_task(ctx, sched_in); } +static int intel_pmu_check_period(struct perf_event *event, u64 value) +{ + return intel_pmu_has_bts_period(event, value) ? -EINVAL : 0; +} + PMU_FORMAT_ATTR(offcore_rsp, "config1:0-63"); PMU_FORMAT_ATTR(ldlat, "config1:0-15"); @@ -3667,6 +3672,8 @@ static __initconst const struct x86_pmu core_pmu = { .cpu_starting = intel_pmu_cpu_starting, .cpu_dying = intel_pmu_cpu_dying, .cpu_dead = intel_pmu_cpu_dead, + + .check_period = intel_pmu_check_period, }; static struct attribute *intel_pmu_attrs[]; @@ -3711,6 +3718,8 @@ static __initconst const struct x86_pmu intel_pmu = { .guest_get_msrs = intel_guest_get_msrs, .sched_task = intel_pmu_sched_task, + + .check_period = intel_pmu_check_period, }; static __init void intel_clovertown_quirk(void) diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h index 78d7b7031bfc..d46fd6754d92 100644 --- a/arch/x86/events/perf_event.h +++ b/arch/x86/events/perf_event.h @@ -646,6 +646,11 @@ struct x86_pmu { * Intel host/guest support (KVM) */ struct perf_guest_switch_msr *(*guest_get_msrs)(int *nr); + + /* +* Check period value for PERF_EVENT_IOC_PERIOD ioctl. +*/ + int (*check_period) (struct perf_event *event, u64 period); }; struct x86_perf_task_context { @@ -857,7 +862,7 @@ static inline int amd_pmu_init(void) #ifdef CONFIG_CPU_SUP_INTEL -static inline bool intel_pmu_has_bts(struct perf_event *event) +static inline bool intel_pmu_has_bts_period(struct perf_event *event, u64 period) { struct hw_perf_event *hwc = >hw; unsigned int hw_event, bts_event; @@ -868,7 +873,14 @@ static inline bool intel_pmu_has_bts(struct perf_event *event) hw_event = hwc->config & INTEL_ARCH_EVENT_MASK; bts_event = x86_pmu.event_map(PERF_COUNT_HW_BRANCH_INSTRUCTIONS); - return hw_event == bts_event && hwc->sample_period == 1; + return hw_event == bts_event && period == 1; +} + +static inline bool intel_pmu_has_bts(struct perf_event *event) +{ + struct hw_perf_event *hwc = >hw; + + return intel_pmu_has_bts_period(event, hwc->sample_period); } int intel_pmu_save_and_restart(struct perf_event *event); diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 1d5c551a5add..e1a051724f7e 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -447,6 +447,11 @@ struct pmu { * Filter events for PMU-specific reasons. */
Re: [GIT PULL] perf fixes
The pull request you sent on Sun, 10 Feb 2019 10:01:09 +0100: > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/212146f0800e151bd61b98fb6fe4b8b6778a649a Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 3bb2600657dac78580e5b8fecc202eaaff5d4ced Merge tag 'perf-urgent-for-mingo-5.0-20190205' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent A couple of kernel side fixes: - Fix the Intel uncore driver on certain hardware configurations - Fix a CPU hotplug related memory allocation bug - Remove a spurious WARN() Plus also a handful of perf tooling fixes. Thanks, Ingo --> Arnaldo Carvalho de Melo (4): perf clang: Do not use 'return std::move(something)' tools headers uapi: Sync linux/in.h copy from the kernel sources perf symbols: Add fallback definitions for GELF_ST_VISIBILITY() perf trace: Support multiple "vfs_getname" probes Gustavo A. R. Silva (1): perf tests evsel-tp-sched: Fix bitwise operator Jiri Olsa (1): perf symbols: Filter out hidden symbols from labels Kan Liang (1): perf/x86/intel/uncore: Add Node ID mask Mark Rutland (1): perf/core: Don't WARN() for impossible ring-buffer sizes Peter Zijlstra (1): perf/x86/intel: Delay memory deallocation until x86_pmu_dead_cpu() Ravi Bangoria (1): perf mem/c2c: Fix perf_mem_events to support powerpc Tony Jones (1): perf script python: Add Python3 support to tests/attr.py arch/x86/events/intel/core.c | 16 +++- arch/x86/events/intel/uncore_snbep.c | 4 +++- kernel/events/ring_buffer.c | 3 +++ tools/include/uapi/linux/in.h | 2 +- tools/perf/Documentation/perf-c2c.txt | 16 tools/perf/Documentation/perf-mem.txt | 2 +- tools/perf/arch/powerpc/util/Build| 1 + tools/perf/arch/powerpc/util/mem-events.c | 11 +++ tools/perf/builtin-trace.c| 25 +--- tools/perf/tests/attr.py | 32 ++- tools/perf/tests/evsel-tp-sched.c | 2 +- tools/perf/util/c++/clang.cpp | 2 +- tools/perf/util/mem-events.c | 2 +- tools/perf/util/symbol-elf.c | 23 +- 14 files changed, 105 insertions(+), 36 deletions(-) create mode 100644 tools/perf/arch/powerpc/util/mem-events.c diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 40e12cfc87f6..daafb893449b 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -3558,6 +3558,14 @@ static void free_excl_cntrs(int cpu) } static void intel_pmu_cpu_dying(int cpu) +{ + fini_debug_store_on_cpu(cpu); + + if (x86_pmu.counter_freezing) + disable_counter_freeze(); +} + +static void intel_pmu_cpu_dead(int cpu) { struct cpu_hw_events *cpuc = _cpu(cpu_hw_events, cpu); struct intel_shared_regs *pc; @@ -3570,11 +3578,6 @@ static void intel_pmu_cpu_dying(int cpu) } free_excl_cntrs(cpu); - - fini_debug_store_on_cpu(cpu); - - if (x86_pmu.counter_freezing) - disable_counter_freeze(); } static void intel_pmu_sched_task(struct perf_event_context *ctx, @@ -3663,6 +3666,7 @@ static __initconst const struct x86_pmu core_pmu = { .cpu_prepare= intel_pmu_cpu_prepare, .cpu_starting = intel_pmu_cpu_starting, .cpu_dying = intel_pmu_cpu_dying, + .cpu_dead = intel_pmu_cpu_dead, }; static struct attribute *intel_pmu_attrs[]; @@ -3703,6 +3707,8 @@ static __initconst const struct x86_pmu intel_pmu = { .cpu_prepare= intel_pmu_cpu_prepare, .cpu_starting = intel_pmu_cpu_starting, .cpu_dying = intel_pmu_cpu_dying, + .cpu_dead = intel_pmu_cpu_dead, + .guest_get_msrs = intel_guest_get_msrs, .sched_task = intel_pmu_sched_task, }; diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c index c07bee31abe8..b10e04387f38 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c @@ -1222,6 +1222,8 @@ static struct pci_driver snbep_uncore_pci_driver = { .id_table = snbep_uncore_pci_ids, }; +#define NODE_ID_MASK 0x7 + /* * build pci bus to socket mapping */ @@ -1243,7 +1245,7 @@ static int snbep_pci2phy_map_init(int devid, int nodeid_loc, int idmap_loc, bool err = pci_read_config_dword(ubox_dev, nodeid_loc, ); if (err) break; - nodeid = config; + nodeid = config & NODE_ID_MASK; /* get the Node ID mapping */ err = pci_read_config_dword(ubox_dev, idmap_loc, ); if (err) diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index 4a9937076331..309ef5a64af5 100644 ---
Re: [GIT PULL] perf fixes
The pull request you sent on Fri, 11 Jan 2019 08:44:18 +0100: > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/40a31da414c39e3cd8c4137c1ceedf59b7ffd4ce Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 4e72ee8872279a70ebe973172133b98e8acbf54e Merge tag 'perf-core-for-mingo-5.0-20190110' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent Tooling changes only: fixes and a few stray improvements. Most of the diffstat is dominated by a PowerPC related fix of system call trace output beautification that allows us to (again) use the UAPI header version and sync up with the kernel's version of PowerPC system call names in the arch/powerpc/kernel/syscalls/syscall.tbl header. Thanks, Ingo --> Arnaldo Carvalho de Melo (19): tools headers x86: Sync disabled-features.h tools headers uapi: Sync prctl.h with the kernel sources tools beauty: Make the prctl option table generator catch all PR_ options tools headers uapi: Update i915_drm.h tools headers uapi: Sync linux/in.h copy from the kernel sources tools headers uapi: Sync linux/kvm.h with the kernel sources tools headers uapi: Sync copy of asm-generic/unistd.h with the kernel sources tools headers x86: Sync asm/cpufeatures.h copy with the kernel sources perf python: Make sure the python binding output directory is in place perf test shell: Use a fallback to get the pathname in vfs_getname perf trace: Fix ')' placement in "interrupted" syscall lines perf trace: Fix alignment for [continued] lines perf top: Lift restriction on using callchains without "sym" in --sort tools include uapi: Grab a copy of linux/mount.h perf beauty: Switch from using uapi/linux/fs.h to uapi/linux/mount.h tools include uapi: Sync linux/fs.h copy with the kernel sources tools include uapi: Sync linux/vhost.h with the kernel sources tools include uapi: Sync linux/if_link.h copy with the kernel sources perf symbols: Add 'arch_cpu_idle' to the list of kernel idle symbols Florian Fainelli (2): perf tools: Make find_vdso_map() more modular perf tests: Add a test for the ARM 32-bit [vectors] page Ivan Krylov (1): perf annotate: Pass filename to objdump via execl Jin Yao (2): perf stat: Fix endless wait for child process perf report: Fix wrong iteration count in --branch-history Jiri Olsa (2): tools thermal tmon: Use -O3 instead of -O1 if available tools iio: Override CFLAGS assignments Mattias Jacobsson (1): perf strbuf: Remove redundant va_end() in strbuf_addv() Ravi Bangoria (2): perf powerpc: Rework syscall table generation tools headers powerpc: Remove unistd.h Tzvetomir Stoyanov (7): tools lib traceevent: Introduce new libtracevent API: tep_override_comm() tools lib traceevent: Initialize host_bigendian at tep_handle allocation tools lib traceevent: Rename struct cmdline to struct tep_cmdline tools lib traceevent: Changed return logic of trace_seq_printf() and trace_seq_vprintf() APIs tools lib traceevent: Changed return logic of tep_register_event_handler() API tools lib traceevent: Rename tep_is_file_bigendian() to tep_file_bigendian() tools lib traceevent: Remove tep_data_event_from_type() API tools/arch/powerpc/include/uapi/asm/unistd.h | 404 --- tools/arch/x86/include/asm/cpufeatures.h | 2 + tools/arch/x86/include/asm/disabled-features.h | 8 +- tools/include/uapi/asm-generic/unistd.h| 4 +- tools/include/uapi/drm/i915_drm.h | 8 + tools/include/uapi/linux/fs.h | 60 +-- tools/include/uapi/linux/if_link.h | 19 + tools/include/uapi/linux/in.h | 10 +- tools/include/uapi/linux/kvm.h | 19 + tools/include/uapi/linux/mount.h | 58 +++ tools/include/uapi/linux/prctl.h | 8 + tools/include/uapi/linux/vhost.h | 113 +- tools/lib/traceevent/event-parse-api.c | 4 +- tools/lib/traceevent/event-parse-local.h | 4 +- tools/lib/traceevent/event-parse.c | 129 --- tools/lib/traceevent/event-parse.h | 17 +- tools/lib/traceevent/plugin_kvm.c | 2 +- tools/lib/traceevent/trace-seq.c | 17 +- tools/perf/Makefile.perf | 8 +- tools/perf/arch/arm/tests/Build| 1 + tools/perf/arch/arm/tests/arch-tests.c | 4 + tools/perf/arch/arm/tests/vectors-page.c | 24 ++ tools/perf/arch/powerpc/Makefile | 15 +- .../perf/arch/powerpc/entry/syscalls/mksyscalltbl | 22 +- tools/perf/arch/powerpc/entry/syscalls/syscall.tbl | 427 + tools/perf/builtin-stat.c | 3 +- tools/perf/builtin-top.c |
Re: [GIT PULL] perf fixes
The pull request you sent on Fri, 30 Nov 2018 07:25:07 +0100: > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/a1b3cf6d943800059adc262c4d839524c529db2d Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
Re: [GIT PULL] perf fixes
The pull request you sent on Fri, 30 Nov 2018 07:25:07 +0100: > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/a1b3cf6d943800059adc262c4d839524c529db2d Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 09d3f015d1e1b4fee7e9bbdcf54201d239393391 uprobes: Fix handle_swbp() vs. unregister() + register() race once more Misc fixes: - a counter freezing related regression fix, - an uprobes race fix, - an Intel PMU unusual event combination fix, - and diverse tooling fixes. Thanks, Ingo --> Andrea Parri (1): uprobes: Fix handle_swbp() vs. unregister() + register() race once more Arnaldo Carvalho de Melo (5): tools build feature: Check if get_current_dir_name() is available tools headers uapi: Synchronize i915_drm.h tools arch x86: Update tools's copy of cpufeatures.h tools uapi asm-generic: Synchronize ioctls.h perf tools beauty ioctl: Support new ISO7816 commands Jiri Olsa (5): perf tools: Fix crash on synthesizing the unit perf tools: Restore proper cwd on return from mnt namespace perf/x86/intel: Move branch tracing setup to the Intel-specific source file perf/x86/intel: Add generic branch tracing check to intel_pmu_has_bts() perf/x86/intel: Disallow precise_ip on BTS events Peter Zijlstra (1): perf/x86/intel: Fix regression by default disabling perfmon v4 interrupt handling Documentation/admin-guide/kernel-parameters.txt | 3 +- arch/x86/events/core.c | 20 arch/x86/events/intel/core.c| 68 +++-- arch/x86/events/perf_event.h| 13 +++-- kernel/events/uprobes.c | 12 - tools/arch/x86/include/asm/cpufeatures.h| 2 + tools/build/Makefile.feature| 1 + tools/build/feature/Makefile| 4 ++ tools/build/feature/test-all.c | 5 ++ tools/build/feature/test-get_current_dir_name.c | 10 tools/include/uapi/asm-generic/ioctls.h | 2 + tools/include/uapi/drm/i915_drm.h | 22 tools/perf/Makefile.config | 5 ++ tools/perf/tests/attr/base-record | 2 +- tools/perf/trace/beauty/ioctl.c | 1 + tools/perf/util/Build | 1 + tools/perf/util/evsel.c | 2 +- tools/perf/util/get_current_dir_name.c | 18 +++ tools/perf/util/namespaces.c| 17 ++- tools/perf/util/namespaces.h| 1 + tools/perf/util/util.h | 4 ++ 21 files changed, 166 insertions(+), 47 deletions(-) create mode 100644 tools/build/feature/test-get_current_dir_name.c create mode 100644 tools/perf/util/get_current_dir_name.c diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 81d1d5a74728..5463d5a4d85c 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -856,7 +856,8 @@ causing system reset or hang due to sending INIT from AP to BSP. - disable_counter_freezing [HW] + perf_v4_pmi=[X86,INTEL] + Format: Disable Intel PMU counter freezing feature. The feature only exists starting from Arch Perfmon v4 (Skylake and newer). diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 106911b603bd..374a19712e20 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -438,26 +438,6 @@ int x86_setup_perfctr(struct perf_event *event) if (config == -1LL) return -EINVAL; - /* -* Branch tracing: -*/ - if (attr->config == PERF_COUNT_HW_BRANCH_INSTRUCTIONS && - !attr->freq && hwc->sample_period == 1) { - /* BTS is not supported by this architecture. */ - if (!x86_pmu.bts_active) - return -EOPNOTSUPP; - - /* BTS is currently only allowed for user-mode. */ - if (!attr->exclude_kernel) - return -EOPNOTSUPP; - - /* disallow bts if conflicting events are present */ - if (x86_add_exclusive(x86_lbr_exclusive_lbr)) - return -EBUSY; - - event->destroy = hw_perf_lbr_event_destroy; - } - hwc->config |= config; return 0; diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 273c62e81546..ecc3e34ca955 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -2306,14 +2306,18 @@ static int handle_pmi_common(struct pt_regs *regs, u64 status) return handled; } -static bool disable_counter_freezing; +static bool disable_counter_freezing = true; static int __init intel_perf_counter_freezing_setup(char *s) {
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 09d3f015d1e1b4fee7e9bbdcf54201d239393391 uprobes: Fix handle_swbp() vs. unregister() + register() race once more Misc fixes: - a counter freezing related regression fix, - an uprobes race fix, - an Intel PMU unusual event combination fix, - and diverse tooling fixes. Thanks, Ingo --> Andrea Parri (1): uprobes: Fix handle_swbp() vs. unregister() + register() race once more Arnaldo Carvalho de Melo (5): tools build feature: Check if get_current_dir_name() is available tools headers uapi: Synchronize i915_drm.h tools arch x86: Update tools's copy of cpufeatures.h tools uapi asm-generic: Synchronize ioctls.h perf tools beauty ioctl: Support new ISO7816 commands Jiri Olsa (5): perf tools: Fix crash on synthesizing the unit perf tools: Restore proper cwd on return from mnt namespace perf/x86/intel: Move branch tracing setup to the Intel-specific source file perf/x86/intel: Add generic branch tracing check to intel_pmu_has_bts() perf/x86/intel: Disallow precise_ip on BTS events Peter Zijlstra (1): perf/x86/intel: Fix regression by default disabling perfmon v4 interrupt handling Documentation/admin-guide/kernel-parameters.txt | 3 +- arch/x86/events/core.c | 20 arch/x86/events/intel/core.c| 68 +++-- arch/x86/events/perf_event.h| 13 +++-- kernel/events/uprobes.c | 12 - tools/arch/x86/include/asm/cpufeatures.h| 2 + tools/build/Makefile.feature| 1 + tools/build/feature/Makefile| 4 ++ tools/build/feature/test-all.c | 5 ++ tools/build/feature/test-get_current_dir_name.c | 10 tools/include/uapi/asm-generic/ioctls.h | 2 + tools/include/uapi/drm/i915_drm.h | 22 tools/perf/Makefile.config | 5 ++ tools/perf/tests/attr/base-record | 2 +- tools/perf/trace/beauty/ioctl.c | 1 + tools/perf/util/Build | 1 + tools/perf/util/evsel.c | 2 +- tools/perf/util/get_current_dir_name.c | 18 +++ tools/perf/util/namespaces.c| 17 ++- tools/perf/util/namespaces.h| 1 + tools/perf/util/util.h | 4 ++ 21 files changed, 166 insertions(+), 47 deletions(-) create mode 100644 tools/build/feature/test-get_current_dir_name.c create mode 100644 tools/perf/util/get_current_dir_name.c diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 81d1d5a74728..5463d5a4d85c 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -856,7 +856,8 @@ causing system reset or hang due to sending INIT from AP to BSP. - disable_counter_freezing [HW] + perf_v4_pmi=[X86,INTEL] + Format: Disable Intel PMU counter freezing feature. The feature only exists starting from Arch Perfmon v4 (Skylake and newer). diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 106911b603bd..374a19712e20 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -438,26 +438,6 @@ int x86_setup_perfctr(struct perf_event *event) if (config == -1LL) return -EINVAL; - /* -* Branch tracing: -*/ - if (attr->config == PERF_COUNT_HW_BRANCH_INSTRUCTIONS && - !attr->freq && hwc->sample_period == 1) { - /* BTS is not supported by this architecture. */ - if (!x86_pmu.bts_active) - return -EOPNOTSUPP; - - /* BTS is currently only allowed for user-mode. */ - if (!attr->exclude_kernel) - return -EOPNOTSUPP; - - /* disallow bts if conflicting events are present */ - if (x86_add_exclusive(x86_lbr_exclusive_lbr)) - return -EBUSY; - - event->destroy = hw_perf_lbr_event_destroy; - } - hwc->config |= config; return 0; diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 273c62e81546..ecc3e34ca955 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -2306,14 +2306,18 @@ static int handle_pmi_common(struct pt_regs *regs, u64 status) return handled; } -static bool disable_counter_freezing; +static bool disable_counter_freezing = true; static int __init intel_perf_counter_freezing_setup(char *s) {
Re: [GIT PULL] perf fixes
The pull request you sent on Sat, 17 Nov 2018 11:55:18 +0100: > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/b53e27f618b58d50db72375eb8e1b6ddcef7cdb5 Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
Re: [GIT PULL] perf fixes
The pull request you sent on Sat, 17 Nov 2018 11:55:18 +0100: > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/b53e27f618b58d50db72375eb8e1b6ddcef7cdb5 Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 4d47d6407ac7b4b442a4e717488a3bb137398b6c perf/x86/intel/uncore: Support CoffeeLake 8th CBOX Fix uncore PMU enumeration for CofeeLake CPUs. Thanks, Ingo --> Kan Liang (2): perf/x86/intel/uncore: Add more IMC PCI IDs for KabyLake and CoffeeLake CPUs perf/x86/intel/uncore: Support CoffeeLake 8th CBOX arch/x86/events/intel/uncore.h | 33 +++--- arch/x86/events/intel/uncore_snb.c | 121 - 2 files changed, 144 insertions(+), 10 deletions(-) diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h index e17ab885b1e9..cb46d602a6b8 100644 --- a/arch/x86/events/intel/uncore.h +++ b/arch/x86/events/intel/uncore.h @@ -129,8 +129,15 @@ struct intel_uncore_box { struct intel_uncore_extra_reg shared_regs[0]; }; -#define UNCORE_BOX_FLAG_INITIATED 0 -#define UNCORE_BOX_FLAG_CTL_OFFS8 1 /* event config registers are 8-byte apart */ +/* CFL uncore 8th cbox MSRs */ +#define CFL_UNC_CBO_7_PERFEVTSEL0 0xf70 +#define CFL_UNC_CBO_7_PER_CTR0 0xf76 + +#define UNCORE_BOX_FLAG_INITIATED 0 +/* event config registers are 8-byte apart */ +#define UNCORE_BOX_FLAG_CTL_OFFS8 1 +/* CFL 8th CBOX has different MSR space */ +#define UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS 2 struct uncore_event_desc { struct kobj_attribute attr; @@ -297,17 +304,27 @@ unsigned int uncore_freerunning_counter(struct intel_uncore_box *box, static inline unsigned uncore_msr_event_ctl(struct intel_uncore_box *box, int idx) { - return box->pmu->type->event_ctl + - (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) + - uncore_msr_box_offset(box); + if (test_bit(UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS, >flags)) { + return CFL_UNC_CBO_7_PERFEVTSEL0 + + (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx); + } else { + return box->pmu->type->event_ctl + + (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) + + uncore_msr_box_offset(box); + } } static inline unsigned uncore_msr_perf_ctr(struct intel_uncore_box *box, int idx) { - return box->pmu->type->perf_ctr + - (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) + - uncore_msr_box_offset(box); + if (test_bit(UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS, >flags)) { + return CFL_UNC_CBO_7_PER_CTR0 + + (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx); + } else { + return box->pmu->type->perf_ctr + + (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) + + uncore_msr_box_offset(box); + } } static inline diff --git a/arch/x86/events/intel/uncore_snb.c b/arch/x86/events/intel/uncore_snb.c index 8527c3e1038b..2593b0d7aeee 100644 --- a/arch/x86/events/intel/uncore_snb.c +++ b/arch/x86/events/intel/uncore_snb.c @@ -15,6 +15,25 @@ #define PCI_DEVICE_ID_INTEL_SKL_HQ_IMC 0x1910 #define PCI_DEVICE_ID_INTEL_SKL_SD_IMC 0x190f #define PCI_DEVICE_ID_INTEL_SKL_SQ_IMC 0x191f +#define PCI_DEVICE_ID_INTEL_KBL_Y_IMC 0x590c +#define PCI_DEVICE_ID_INTEL_KBL_U_IMC 0x5904 +#define PCI_DEVICE_ID_INTEL_KBL_UQ_IMC 0x5914 +#define PCI_DEVICE_ID_INTEL_KBL_SD_IMC 0x590f +#define PCI_DEVICE_ID_INTEL_KBL_SQ_IMC 0x591f +#define PCI_DEVICE_ID_INTEL_CFL_2U_IMC 0x3ecc +#define PCI_DEVICE_ID_INTEL_CFL_4U_IMC 0x3ed0 +#define PCI_DEVICE_ID_INTEL_CFL_4H_IMC 0x3e10 +#define PCI_DEVICE_ID_INTEL_CFL_6H_IMC 0x3ec4 +#define PCI_DEVICE_ID_INTEL_CFL_2S_D_IMC 0x3e0f +#define PCI_DEVICE_ID_INTEL_CFL_4S_D_IMC 0x3e1f +#define PCI_DEVICE_ID_INTEL_CFL_6S_D_IMC 0x3ec2 +#define PCI_DEVICE_ID_INTEL_CFL_8S_D_IMC 0x3e30 +#define PCI_DEVICE_ID_INTEL_CFL_4S_W_IMC 0x3e18 +#define PCI_DEVICE_ID_INTEL_CFL_6S_W_IMC 0x3ec6 +#define PCI_DEVICE_ID_INTEL_CFL_8S_W_IMC 0x3e31 +#define PCI_DEVICE_ID_INTEL_CFL_4S_S_IMC 0x3e33 +#define PCI_DEVICE_ID_INTEL_CFL_6S_S_IMC 0x3eca +#define PCI_DEVICE_ID_INTEL_CFL_8S_S_IMC 0x3e32 /* SNB event control */ #define SNB_UNC_CTL_EV_SEL_MASK0x00ff @@ -202,6 +221,10 @@ static void skl_uncore_msr_init_box(struct intel_uncore_box *box) wrmsrl(SKL_UNC_PERF_GLOBAL_CTL, SNB_UNC_GLOBAL_CTL_EN | SKL_UNC_GLOBAL_CTL_CORE_ALL); } + + /* The 8th CBOX has different MSR space */ + if (box->pmu->pmu_idx == 7) + __set_bit(UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS, >flags); } static void skl_uncore_msr_enable_box(struct intel_uncore_box *box) @@ -228,7 +251,7 @@ static struct intel_uncore_ops skl_uncore_msr_ops = { static struct intel_uncore_type skl_uncore_cbox = { .name =
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 4d47d6407ac7b4b442a4e717488a3bb137398b6c perf/x86/intel/uncore: Support CoffeeLake 8th CBOX Fix uncore PMU enumeration for CofeeLake CPUs. Thanks, Ingo --> Kan Liang (2): perf/x86/intel/uncore: Add more IMC PCI IDs for KabyLake and CoffeeLake CPUs perf/x86/intel/uncore: Support CoffeeLake 8th CBOX arch/x86/events/intel/uncore.h | 33 +++--- arch/x86/events/intel/uncore_snb.c | 121 - 2 files changed, 144 insertions(+), 10 deletions(-) diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h index e17ab885b1e9..cb46d602a6b8 100644 --- a/arch/x86/events/intel/uncore.h +++ b/arch/x86/events/intel/uncore.h @@ -129,8 +129,15 @@ struct intel_uncore_box { struct intel_uncore_extra_reg shared_regs[0]; }; -#define UNCORE_BOX_FLAG_INITIATED 0 -#define UNCORE_BOX_FLAG_CTL_OFFS8 1 /* event config registers are 8-byte apart */ +/* CFL uncore 8th cbox MSRs */ +#define CFL_UNC_CBO_7_PERFEVTSEL0 0xf70 +#define CFL_UNC_CBO_7_PER_CTR0 0xf76 + +#define UNCORE_BOX_FLAG_INITIATED 0 +/* event config registers are 8-byte apart */ +#define UNCORE_BOX_FLAG_CTL_OFFS8 1 +/* CFL 8th CBOX has different MSR space */ +#define UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS 2 struct uncore_event_desc { struct kobj_attribute attr; @@ -297,17 +304,27 @@ unsigned int uncore_freerunning_counter(struct intel_uncore_box *box, static inline unsigned uncore_msr_event_ctl(struct intel_uncore_box *box, int idx) { - return box->pmu->type->event_ctl + - (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) + - uncore_msr_box_offset(box); + if (test_bit(UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS, >flags)) { + return CFL_UNC_CBO_7_PERFEVTSEL0 + + (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx); + } else { + return box->pmu->type->event_ctl + + (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) + + uncore_msr_box_offset(box); + } } static inline unsigned uncore_msr_perf_ctr(struct intel_uncore_box *box, int idx) { - return box->pmu->type->perf_ctr + - (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) + - uncore_msr_box_offset(box); + if (test_bit(UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS, >flags)) { + return CFL_UNC_CBO_7_PER_CTR0 + + (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx); + } else { + return box->pmu->type->perf_ctr + + (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) + + uncore_msr_box_offset(box); + } } static inline diff --git a/arch/x86/events/intel/uncore_snb.c b/arch/x86/events/intel/uncore_snb.c index 8527c3e1038b..2593b0d7aeee 100644 --- a/arch/x86/events/intel/uncore_snb.c +++ b/arch/x86/events/intel/uncore_snb.c @@ -15,6 +15,25 @@ #define PCI_DEVICE_ID_INTEL_SKL_HQ_IMC 0x1910 #define PCI_DEVICE_ID_INTEL_SKL_SD_IMC 0x190f #define PCI_DEVICE_ID_INTEL_SKL_SQ_IMC 0x191f +#define PCI_DEVICE_ID_INTEL_KBL_Y_IMC 0x590c +#define PCI_DEVICE_ID_INTEL_KBL_U_IMC 0x5904 +#define PCI_DEVICE_ID_INTEL_KBL_UQ_IMC 0x5914 +#define PCI_DEVICE_ID_INTEL_KBL_SD_IMC 0x590f +#define PCI_DEVICE_ID_INTEL_KBL_SQ_IMC 0x591f +#define PCI_DEVICE_ID_INTEL_CFL_2U_IMC 0x3ecc +#define PCI_DEVICE_ID_INTEL_CFL_4U_IMC 0x3ed0 +#define PCI_DEVICE_ID_INTEL_CFL_4H_IMC 0x3e10 +#define PCI_DEVICE_ID_INTEL_CFL_6H_IMC 0x3ec4 +#define PCI_DEVICE_ID_INTEL_CFL_2S_D_IMC 0x3e0f +#define PCI_DEVICE_ID_INTEL_CFL_4S_D_IMC 0x3e1f +#define PCI_DEVICE_ID_INTEL_CFL_6S_D_IMC 0x3ec2 +#define PCI_DEVICE_ID_INTEL_CFL_8S_D_IMC 0x3e30 +#define PCI_DEVICE_ID_INTEL_CFL_4S_W_IMC 0x3e18 +#define PCI_DEVICE_ID_INTEL_CFL_6S_W_IMC 0x3ec6 +#define PCI_DEVICE_ID_INTEL_CFL_8S_W_IMC 0x3e31 +#define PCI_DEVICE_ID_INTEL_CFL_4S_S_IMC 0x3e33 +#define PCI_DEVICE_ID_INTEL_CFL_6S_S_IMC 0x3eca +#define PCI_DEVICE_ID_INTEL_CFL_8S_S_IMC 0x3e32 /* SNB event control */ #define SNB_UNC_CTL_EV_SEL_MASK0x00ff @@ -202,6 +221,10 @@ static void skl_uncore_msr_init_box(struct intel_uncore_box *box) wrmsrl(SKL_UNC_PERF_GLOBAL_CTL, SNB_UNC_GLOBAL_CTL_EN | SKL_UNC_GLOBAL_CTL_CORE_ALL); } + + /* The 8th CBOX has different MSR space */ + if (box->pmu->pmu_idx == 7) + __set_bit(UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS, >flags); } static void skl_uncore_msr_enable_box(struct intel_uncore_box *box) @@ -228,7 +251,7 @@ static struct intel_uncore_ops skl_uncore_msr_ops = { static struct intel_uncore_type skl_uncore_cbox = { .name =
Re: [GIT pull] perf fixes for 4.20
The pull request you sent on Sun, 11 Nov 2018 09:11:07 +0100: > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/655c6b977755594d104d2b87d3e896bd09fd34e8 Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
Re: [GIT pull] perf fixes for 4.20
The pull request you sent on Sun, 11 Nov 2018 09:11:07 +0100: > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/655c6b977755594d104d2b87d3e896bd09fd34e8 Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
[GIT pull] perf fixes for 4.20
Linus, please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus A bunch of perf tooling fixes: - Make the Intel PT SQL viewer more robust - Make the Intel PT debug log more useful - Support weak groups in perf record so it's behaving the same way as perf stat - Display the LBR stats in callchain entries properly in perf top - Handle different PMu names with common prefix properlin in pert stat - Start syscall augmenting in perf trace. Preparation for architecture independent eBPF instrumentation of syscalls. ` - Fix build breakage in JVMTI perf lib - Fix arm64 tools build failure wrt smp_load_{acquire,release}. Thanks, tglx --> Adrian Hunter (6): perf scripts python: exported-sql-viewer.py: Fall back to /usr/local/lib/libxed.so perf scripts python: exported-sql-viewer.py: Add Selected branches report perf scripts python: exported-sql-viewer.py: Add help window perf scripts python: exported-sql-viewer.py: Fix table find when table re-ordered perf intel-pt: Add more event information to debug log perf intel-pt: Add MTC and CYC timestamps to debug log Andi Kleen (2): perf evlist: Move perf_evsel__reset_weak_group into evlist perf record: Support weak groups Arnaldo Carvalho de Melo (5): perf examples bpf: Start augmenting raw_syscalls:sys_{start,exit} perf trace: When augmenting raw_syscalls plug raw_syscalls:sys_exit too perf trace: Fix setting of augmented payload when using eBPF + raw_syscalls perf augmented_syscalls: Start collecting pathnames in the BPF program perf beauty: Use SRCARCH, ARCH=x86_64 must map to "x86" to find the headers Gustavo Romero (1): perf tools: Fix undefined symbol scnprintf in libperf-jvmti.so Jin Yao (1): perf top: Display the LBR stats in callchain entry Jiri Olsa (1): perf tools: Do not zero sample_id_all for group members Martin Schwidefsky (1): compiler: remove __no_sanitize_address_or_inline again Thomas Richter (1): perf stat: Handle different PMU names with common prefix Will Deacon (1): tools headers barrier: Fix arm64 tools build failure wrt smp_load_{acquire,release} arch/s390/include/asm/processor.h | 4 +- include/linux/compiler-gcc.h | 12 - include/linux/compiler.h | 2 +- tools/arch/arm64/include/asm/barrier.h | 133 +++--- tools/perf/Documentation/perf-list.txt | 1 - tools/perf/Makefile.perf | 2 +- tools/perf/builtin-record.c| 7 +- tools/perf/builtin-stat.c | 28 +- tools/perf/builtin-top.c | 3 + tools/perf/builtin-trace.c | 34 +- tools/perf/examples/bpf/augmented_raw_syscalls.c | 131 ++ tools/perf/jvmti/jvmti_agent.c | 49 +- tools/perf/scripts/python/exported-sql-viewer.py | 493 - tools/perf/tests/attr/test-record-group-sampling | 1 - tools/perf/util/evlist.c | 27 ++ tools/perf/util/evlist.h | 3 + tools/perf/util/evsel.c| 1 - .../perf/util/intel-pt-decoder/intel-pt-decoder.c | 4 + tools/perf/util/intel-pt-decoder/intel-pt-log.c| 5 + tools/perf/util/intel-pt-decoder/intel-pt-log.h| 1 + tools/perf/util/intel-pt.c | 16 +- tools/perf/util/pmu.c | 2 +- 22 files changed, 823 insertions(+), 136 deletions(-) create mode 100644 tools/perf/examples/bpf/augmented_raw_syscalls.c diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h index 302795c47c06..81038ab357ce 100644 --- a/arch/s390/include/asm/processor.h +++ b/arch/s390/include/asm/processor.h @@ -236,7 +236,7 @@ static inline unsigned long current_stack_pointer(void) return sp; } -static __no_sanitize_address_or_inline unsigned short stap(void) +static __no_kasan_or_inline unsigned short stap(void) { unsigned short cpu_address; @@ -330,7 +330,7 @@ static inline void __load_psw(psw_t psw) * Set PSW mask to specified value, while leaving the * PSW addr pointing to the next instruction. */ -static __no_sanitize_address_or_inline void __load_psw_mask(unsigned long mask) +static __no_kasan_or_inline void __load_psw_mask(unsigned long mask) { unsigned long addr; psw_t psw; diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index c0f5db3a9621..2010493e1040 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -143,18 +143,6 @@ #define KASAN_ABI_VERSION 3 #endif -/* - * Because __no_sanitize_address conflicts with inlining: - *
[GIT pull] perf fixes for 4.20
Linus, please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus A bunch of perf tooling fixes: - Make the Intel PT SQL viewer more robust - Make the Intel PT debug log more useful - Support weak groups in perf record so it's behaving the same way as perf stat - Display the LBR stats in callchain entries properly in perf top - Handle different PMu names with common prefix properlin in pert stat - Start syscall augmenting in perf trace. Preparation for architecture independent eBPF instrumentation of syscalls. ` - Fix build breakage in JVMTI perf lib - Fix arm64 tools build failure wrt smp_load_{acquire,release}. Thanks, tglx --> Adrian Hunter (6): perf scripts python: exported-sql-viewer.py: Fall back to /usr/local/lib/libxed.so perf scripts python: exported-sql-viewer.py: Add Selected branches report perf scripts python: exported-sql-viewer.py: Add help window perf scripts python: exported-sql-viewer.py: Fix table find when table re-ordered perf intel-pt: Add more event information to debug log perf intel-pt: Add MTC and CYC timestamps to debug log Andi Kleen (2): perf evlist: Move perf_evsel__reset_weak_group into evlist perf record: Support weak groups Arnaldo Carvalho de Melo (5): perf examples bpf: Start augmenting raw_syscalls:sys_{start,exit} perf trace: When augmenting raw_syscalls plug raw_syscalls:sys_exit too perf trace: Fix setting of augmented payload when using eBPF + raw_syscalls perf augmented_syscalls: Start collecting pathnames in the BPF program perf beauty: Use SRCARCH, ARCH=x86_64 must map to "x86" to find the headers Gustavo Romero (1): perf tools: Fix undefined symbol scnprintf in libperf-jvmti.so Jin Yao (1): perf top: Display the LBR stats in callchain entry Jiri Olsa (1): perf tools: Do not zero sample_id_all for group members Martin Schwidefsky (1): compiler: remove __no_sanitize_address_or_inline again Thomas Richter (1): perf stat: Handle different PMU names with common prefix Will Deacon (1): tools headers barrier: Fix arm64 tools build failure wrt smp_load_{acquire,release} arch/s390/include/asm/processor.h | 4 +- include/linux/compiler-gcc.h | 12 - include/linux/compiler.h | 2 +- tools/arch/arm64/include/asm/barrier.h | 133 +++--- tools/perf/Documentation/perf-list.txt | 1 - tools/perf/Makefile.perf | 2 +- tools/perf/builtin-record.c| 7 +- tools/perf/builtin-stat.c | 28 +- tools/perf/builtin-top.c | 3 + tools/perf/builtin-trace.c | 34 +- tools/perf/examples/bpf/augmented_raw_syscalls.c | 131 ++ tools/perf/jvmti/jvmti_agent.c | 49 +- tools/perf/scripts/python/exported-sql-viewer.py | 493 - tools/perf/tests/attr/test-record-group-sampling | 1 - tools/perf/util/evlist.c | 27 ++ tools/perf/util/evlist.h | 3 + tools/perf/util/evsel.c| 1 - .../perf/util/intel-pt-decoder/intel-pt-decoder.c | 4 + tools/perf/util/intel-pt-decoder/intel-pt-log.c| 5 + tools/perf/util/intel-pt-decoder/intel-pt-log.h| 1 + tools/perf/util/intel-pt.c | 16 +- tools/perf/util/pmu.c | 2 +- 22 files changed, 823 insertions(+), 136 deletions(-) create mode 100644 tools/perf/examples/bpf/augmented_raw_syscalls.c diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h index 302795c47c06..81038ab357ce 100644 --- a/arch/s390/include/asm/processor.h +++ b/arch/s390/include/asm/processor.h @@ -236,7 +236,7 @@ static inline unsigned long current_stack_pointer(void) return sp; } -static __no_sanitize_address_or_inline unsigned short stap(void) +static __no_kasan_or_inline unsigned short stap(void) { unsigned short cpu_address; @@ -330,7 +330,7 @@ static inline void __load_psw(psw_t psw) * Set PSW mask to specified value, while leaving the * PSW addr pointing to the next instruction. */ -static __no_sanitize_address_or_inline void __load_psw_mask(unsigned long mask) +static __no_kasan_or_inline void __load_psw_mask(unsigned long mask) { unsigned long addr; psw_t psw; diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index c0f5db3a9621..2010493e1040 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -143,18 +143,6 @@ #define KASAN_ABI_VERSION 3 #endif -/* - * Because __no_sanitize_address conflicts with inlining: - *
Re: [GIT PULL] perf fixes
On Sat, Oct 20, 2018 at 10:10:39AM +0200, Ingo Molnar wrote: > Greg, > > Please pull the latest perf-urgent-for-linus git tree from: > >git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus Now merged, thanks. greg k-h
Re: [GIT PULL] perf fixes
On Sat, Oct 20, 2018 at 10:10:39AM +0200, Ingo Molnar wrote: > Greg, > > Please pull the latest perf-urgent-for-linus git tree from: > >git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus Now merged, thanks. greg k-h
[GIT PULL] perf fixes
Greg, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 20e8e72d0fa8e26202932c30d592bade73fdc701 Merge tag 'perf-urgent-for-mingo-4.19-20181017' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent Misc perf tooling fixes. Thanks, Ingo --> Arnaldo Carvalho de Melo (3): tools arch uapi: Sync the x86 kvm.h copy tools headers uapi: Sync kvm.h copy perf tools: Stop fallbacking to kallsyms for vdso symbols lookup David Miller (1): perf cpu_map: Align cpu map synthesized events properly. Jarod Wilson (1): perf tools: Fix use of alternatives to find JDIR Jiri Olsa (5): Revert "perf tools: Fix PMU term format max value calculation" perf vendor events intel: Fix wrong filter_band* values for uncore events perf evsel: Store ids for events with their own cpus perf_event__synthesize_event_update_cpus perf tools: Fix tracing_path_mount proper path perf tools: Pass build flags to traceevent build Milian Wolff (1): perf report: Don't crash on invalid inline debug information tools/arch/x86/include/uapi/asm/kvm.h | 1 + tools/include/uapi/linux/kvm.h | 1 + tools/lib/api/fs/tracing_path.c| 4 ++-- tools/perf/Makefile.config | 2 +- tools/perf/Makefile.perf | 2 +- tools/perf/builtin-report.c| 1 + .../pmu-events/arch/x86/ivytown/uncore-power.json | 16 .../pmu-events/arch/x86/jaketown/uncore-power.json | 16 tools/perf/util/event.c| 22 +++--- tools/perf/util/evsel.c| 3 +++ tools/perf/util/pmu.c | 13 +++-- tools/perf/util/srcline.c | 3 +++ 12 files changed, 39 insertions(+), 45 deletions(-) diff --git a/tools/arch/x86/include/uapi/asm/kvm.h b/tools/arch/x86/include/uapi/asm/kvm.h index 86299efa804a..fd23d5778ea1 100644 --- a/tools/arch/x86/include/uapi/asm/kvm.h +++ b/tools/arch/x86/include/uapi/asm/kvm.h @@ -377,6 +377,7 @@ struct kvm_sync_regs { #define KVM_X86_QUIRK_LINT0_REENABLED (1 << 0) #define KVM_X86_QUIRK_CD_NW_CLEARED(1 << 1) +#define KVM_X86_QUIRK_LAPIC_MMIO_HOLE (1 << 2) #define KVM_STATE_NESTED_GUEST_MODE0x0001 #define KVM_STATE_NESTED_RUN_PENDING 0x0002 diff --git a/tools/include/uapi/linux/kvm.h b/tools/include/uapi/linux/kvm.h index 07548de5c988..251be353f950 100644 --- a/tools/include/uapi/linux/kvm.h +++ b/tools/include/uapi/linux/kvm.h @@ -952,6 +952,7 @@ struct kvm_ppc_resize_hpt { #define KVM_CAP_S390_HPAGE_1M 156 #define KVM_CAP_NESTED_STATE 157 #define KVM_CAP_ARM_INJECT_SERROR_ESR 158 +#define KVM_CAP_MSR_PLATFORM_INFO 159 #ifdef KVM_CAP_IRQ_ROUTING diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c index 120037496f77..5afb11b30fca 100644 --- a/tools/lib/api/fs/tracing_path.c +++ b/tools/lib/api/fs/tracing_path.c @@ -36,7 +36,7 @@ static const char *tracing_path_tracefs_mount(void) __tracing_path_set("", mnt); - return mnt; + return tracing_path; } static const char *tracing_path_debugfs_mount(void) @@ -49,7 +49,7 @@ static const char *tracing_path_debugfs_mount(void) __tracing_path_set("tracing/", mnt); - return mnt; + return tracing_path; } const char *tracing_path_mount(void) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index f6d1a03c7523..e30d20fb482d 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -833,7 +833,7 @@ ifndef NO_JVMTI JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | awk '{print $$3}') else ifneq (,$(wildcard /usr/sbin/alternatives)) - JDIR=$(shell alternatives --display java | tail -1 | cut -d' ' -f 5 | sed 's%/jre/bin/java.%%g') + JDIR=$(shell /usr/sbin/alternatives --display java | tail -1 | cut -d' ' -f 5 | sed 's%/jre/bin/java.%%g') endif endif ifndef JDIR diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 5224ade3d5af..0be411695379 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -635,7 +635,7 @@ $(LIBPERF_IN): prepare FORCE $(LIB_FILE): $(LIBPERF_IN) $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIBPERF_IN) $(LIB_OBJS) -LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ) +LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ) 'EXTRA_CFLAGS=$(EXTRA_CFLAGS)' 'LDFLAGS=$(LDFLAGS)' $(LIBTRACEEVENT): FORCE $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent.a diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 76e12bcd1765..b2188e623e22 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c
[GIT PULL] perf fixes
Greg, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 20e8e72d0fa8e26202932c30d592bade73fdc701 Merge tag 'perf-urgent-for-mingo-4.19-20181017' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent Misc perf tooling fixes. Thanks, Ingo --> Arnaldo Carvalho de Melo (3): tools arch uapi: Sync the x86 kvm.h copy tools headers uapi: Sync kvm.h copy perf tools: Stop fallbacking to kallsyms for vdso symbols lookup David Miller (1): perf cpu_map: Align cpu map synthesized events properly. Jarod Wilson (1): perf tools: Fix use of alternatives to find JDIR Jiri Olsa (5): Revert "perf tools: Fix PMU term format max value calculation" perf vendor events intel: Fix wrong filter_band* values for uncore events perf evsel: Store ids for events with their own cpus perf_event__synthesize_event_update_cpus perf tools: Fix tracing_path_mount proper path perf tools: Pass build flags to traceevent build Milian Wolff (1): perf report: Don't crash on invalid inline debug information tools/arch/x86/include/uapi/asm/kvm.h | 1 + tools/include/uapi/linux/kvm.h | 1 + tools/lib/api/fs/tracing_path.c| 4 ++-- tools/perf/Makefile.config | 2 +- tools/perf/Makefile.perf | 2 +- tools/perf/builtin-report.c| 1 + .../pmu-events/arch/x86/ivytown/uncore-power.json | 16 .../pmu-events/arch/x86/jaketown/uncore-power.json | 16 tools/perf/util/event.c| 22 +++--- tools/perf/util/evsel.c| 3 +++ tools/perf/util/pmu.c | 13 +++-- tools/perf/util/srcline.c | 3 +++ 12 files changed, 39 insertions(+), 45 deletions(-) diff --git a/tools/arch/x86/include/uapi/asm/kvm.h b/tools/arch/x86/include/uapi/asm/kvm.h index 86299efa804a..fd23d5778ea1 100644 --- a/tools/arch/x86/include/uapi/asm/kvm.h +++ b/tools/arch/x86/include/uapi/asm/kvm.h @@ -377,6 +377,7 @@ struct kvm_sync_regs { #define KVM_X86_QUIRK_LINT0_REENABLED (1 << 0) #define KVM_X86_QUIRK_CD_NW_CLEARED(1 << 1) +#define KVM_X86_QUIRK_LAPIC_MMIO_HOLE (1 << 2) #define KVM_STATE_NESTED_GUEST_MODE0x0001 #define KVM_STATE_NESTED_RUN_PENDING 0x0002 diff --git a/tools/include/uapi/linux/kvm.h b/tools/include/uapi/linux/kvm.h index 07548de5c988..251be353f950 100644 --- a/tools/include/uapi/linux/kvm.h +++ b/tools/include/uapi/linux/kvm.h @@ -952,6 +952,7 @@ struct kvm_ppc_resize_hpt { #define KVM_CAP_S390_HPAGE_1M 156 #define KVM_CAP_NESTED_STATE 157 #define KVM_CAP_ARM_INJECT_SERROR_ESR 158 +#define KVM_CAP_MSR_PLATFORM_INFO 159 #ifdef KVM_CAP_IRQ_ROUTING diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c index 120037496f77..5afb11b30fca 100644 --- a/tools/lib/api/fs/tracing_path.c +++ b/tools/lib/api/fs/tracing_path.c @@ -36,7 +36,7 @@ static const char *tracing_path_tracefs_mount(void) __tracing_path_set("", mnt); - return mnt; + return tracing_path; } static const char *tracing_path_debugfs_mount(void) @@ -49,7 +49,7 @@ static const char *tracing_path_debugfs_mount(void) __tracing_path_set("tracing/", mnt); - return mnt; + return tracing_path; } const char *tracing_path_mount(void) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index f6d1a03c7523..e30d20fb482d 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -833,7 +833,7 @@ ifndef NO_JVMTI JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | awk '{print $$3}') else ifneq (,$(wildcard /usr/sbin/alternatives)) - JDIR=$(shell alternatives --display java | tail -1 | cut -d' ' -f 5 | sed 's%/jre/bin/java.%%g') + JDIR=$(shell /usr/sbin/alternatives --display java | tail -1 | cut -d' ' -f 5 | sed 's%/jre/bin/java.%%g') endif endif ifndef JDIR diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 5224ade3d5af..0be411695379 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -635,7 +635,7 @@ $(LIBPERF_IN): prepare FORCE $(LIB_FILE): $(LIBPERF_IN) $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIBPERF_IN) $(LIB_OBJS) -LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ) +LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ) 'EXTRA_CFLAGS=$(EXTRA_CFLAGS)' 'LDFLAGS=$(LDFLAGS)' $(LIBTRACEEVENT): FORCE $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent.a diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 76e12bcd1765..b2188e623e22 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c
Re: [GIT PULL] perf fixes
On Thu, Oct 11, 2018 at 11:12:02AM +0200, Ingo Molnar wrote: > > Greg, > > Please pull the latest perf-urgent-for-linus git tree from: > >git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus Now merged, thanks. greg k-h
Re: [GIT PULL] perf fixes
On Thu, Oct 11, 2018 at 11:12:02AM +0200, Ingo Molnar wrote: > > Greg, > > Please pull the latest perf-urgent-for-linus git tree from: > >git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus Now merged, thanks. greg k-h
[GIT PULL] perf fixes
Greg, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: c1883f10cfe05c707cce46d6999411c50a2413ca Merge tag 'perf-urgent-for-mingo-4.19-20181005' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent Misc perf tooling fixes. Thanks, Ingo --> Adrian Hunter (2): perf script python: Fix export-to-postgresql.py occasional failure perf script python: Fix export-to-sqlite.py sample columns Arnaldo Carvalho de Melo (1): perf python: Use -Wno-redundant-decls to build with PYTHON=python3 Milian Wolff (2): perf report: Don't try to map ip to invalid map perf record: Use unmapped IP for inline callchain cursors tools/perf/scripts/python/export-to-postgresql.py | 9 + tools/perf/scripts/python/export-to-sqlite.py | 6 +- tools/perf/util/machine.c | 8 +--- tools/perf/util/setup.py | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/tools/perf/scripts/python/export-to-postgresql.py b/tools/perf/scripts/python/export-to-postgresql.py index efcaf6cac2eb..e46f51b17513 100644 --- a/tools/perf/scripts/python/export-to-postgresql.py +++ b/tools/perf/scripts/python/export-to-postgresql.py @@ -204,14 +204,23 @@ from ctypes import * libpq = CDLL("libpq.so.5") PQconnectdb = libpq.PQconnectdb PQconnectdb.restype = c_void_p +PQconnectdb.argtypes = [ c_char_p ] PQfinish = libpq.PQfinish +PQfinish.argtypes = [ c_void_p ] PQstatus = libpq.PQstatus +PQstatus.restype = c_int +PQstatus.argtypes = [ c_void_p ] PQexec = libpq.PQexec PQexec.restype = c_void_p +PQexec.argtypes = [ c_void_p, c_char_p ] PQresultStatus = libpq.PQresultStatus +PQresultStatus.restype = c_int +PQresultStatus.argtypes = [ c_void_p ] PQputCopyData = libpq.PQputCopyData +PQputCopyData.restype = c_int PQputCopyData.argtypes = [ c_void_p, c_void_p, c_int ] PQputCopyEnd = libpq.PQputCopyEnd +PQputCopyEnd.restype = c_int PQputCopyEnd.argtypes = [ c_void_p, c_void_p ] sys.path.append(os.environ['PERF_EXEC_PATH'] + \ diff --git a/tools/perf/scripts/python/export-to-sqlite.py b/tools/perf/scripts/python/export-to-sqlite.py index f827bf77e9d2..e4bb82c8aba9 100644 --- a/tools/perf/scripts/python/export-to-sqlite.py +++ b/tools/perf/scripts/python/export-to-sqlite.py @@ -440,7 +440,11 @@ def branch_type_table(*x): def sample_table(*x): if branches: - bind_exec(sample_query, 18, x) + for xx in x[0:15]: + sample_query.addBindValue(str(xx)) + for xx in x[19:22]: + sample_query.addBindValue(str(xx)) + do_query_(sample_query) else: bind_exec(sample_query, 22, x) diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index c4acd2001db0..111ae858cbcb 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -2286,7 +2286,8 @@ static int append_inlines(struct callchain_cursor *cursor, if (!symbol_conf.inline_name || !map || !sym) return ret; - addr = map__rip_2objdump(map, ip); + addr = map__map_ip(map, ip); + addr = map__rip_2objdump(map, addr); inline_node = inlines__tree_find(>dso->inlined_nodes, addr); if (!inline_node) { @@ -2312,7 +2313,7 @@ static int unwind_entry(struct unwind_entry *entry, void *arg) { struct callchain_cursor *cursor = arg; const char *srcline = NULL; - u64 addr; + u64 addr = entry->ip; if (symbol_conf.hide_unresolved && entry->sym == NULL) return 0; @@ -2324,7 +2325,8 @@ static int unwind_entry(struct unwind_entry *entry, void *arg) * Convert entry->ip from a virtual address to an offset in * its corresponding binary. */ - addr = map__map_ip(entry->map, entry->ip); + if (entry->map) + addr = map__map_ip(entry->map, entry->ip); srcline = callchain_srcline(entry->map, entry->sym, addr); return callchain_cursor_append(cursor, entry->ip, diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py index 97efbcad076e..1942f6dd24f6 100644 --- a/tools/perf/util/setup.py +++ b/tools/perf/util/setup.py @@ -35,7 +35,7 @@ class install_lib(_install_lib): cflags = getenv('CFLAGS', '').split() # switch off several checks (need to be at the end of cflags list) -cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter' ] +cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter', '-Wno-redundant-decls' ] if cc != "clang": cflags += ['-Wno-cast-function-type' ] - End forwarded message -
[GIT PULL] perf fixes
Greg, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: c1883f10cfe05c707cce46d6999411c50a2413ca Merge tag 'perf-urgent-for-mingo-4.19-20181005' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent Misc perf tooling fixes. Thanks, Ingo --> Adrian Hunter (2): perf script python: Fix export-to-postgresql.py occasional failure perf script python: Fix export-to-sqlite.py sample columns Arnaldo Carvalho de Melo (1): perf python: Use -Wno-redundant-decls to build with PYTHON=python3 Milian Wolff (2): perf report: Don't try to map ip to invalid map perf record: Use unmapped IP for inline callchain cursors tools/perf/scripts/python/export-to-postgresql.py | 9 + tools/perf/scripts/python/export-to-sqlite.py | 6 +- tools/perf/util/machine.c | 8 +--- tools/perf/util/setup.py | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/tools/perf/scripts/python/export-to-postgresql.py b/tools/perf/scripts/python/export-to-postgresql.py index efcaf6cac2eb..e46f51b17513 100644 --- a/tools/perf/scripts/python/export-to-postgresql.py +++ b/tools/perf/scripts/python/export-to-postgresql.py @@ -204,14 +204,23 @@ from ctypes import * libpq = CDLL("libpq.so.5") PQconnectdb = libpq.PQconnectdb PQconnectdb.restype = c_void_p +PQconnectdb.argtypes = [ c_char_p ] PQfinish = libpq.PQfinish +PQfinish.argtypes = [ c_void_p ] PQstatus = libpq.PQstatus +PQstatus.restype = c_int +PQstatus.argtypes = [ c_void_p ] PQexec = libpq.PQexec PQexec.restype = c_void_p +PQexec.argtypes = [ c_void_p, c_char_p ] PQresultStatus = libpq.PQresultStatus +PQresultStatus.restype = c_int +PQresultStatus.argtypes = [ c_void_p ] PQputCopyData = libpq.PQputCopyData +PQputCopyData.restype = c_int PQputCopyData.argtypes = [ c_void_p, c_void_p, c_int ] PQputCopyEnd = libpq.PQputCopyEnd +PQputCopyEnd.restype = c_int PQputCopyEnd.argtypes = [ c_void_p, c_void_p ] sys.path.append(os.environ['PERF_EXEC_PATH'] + \ diff --git a/tools/perf/scripts/python/export-to-sqlite.py b/tools/perf/scripts/python/export-to-sqlite.py index f827bf77e9d2..e4bb82c8aba9 100644 --- a/tools/perf/scripts/python/export-to-sqlite.py +++ b/tools/perf/scripts/python/export-to-sqlite.py @@ -440,7 +440,11 @@ def branch_type_table(*x): def sample_table(*x): if branches: - bind_exec(sample_query, 18, x) + for xx in x[0:15]: + sample_query.addBindValue(str(xx)) + for xx in x[19:22]: + sample_query.addBindValue(str(xx)) + do_query_(sample_query) else: bind_exec(sample_query, 22, x) diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index c4acd2001db0..111ae858cbcb 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -2286,7 +2286,8 @@ static int append_inlines(struct callchain_cursor *cursor, if (!symbol_conf.inline_name || !map || !sym) return ret; - addr = map__rip_2objdump(map, ip); + addr = map__map_ip(map, ip); + addr = map__rip_2objdump(map, addr); inline_node = inlines__tree_find(>dso->inlined_nodes, addr); if (!inline_node) { @@ -2312,7 +2313,7 @@ static int unwind_entry(struct unwind_entry *entry, void *arg) { struct callchain_cursor *cursor = arg; const char *srcline = NULL; - u64 addr; + u64 addr = entry->ip; if (symbol_conf.hide_unresolved && entry->sym == NULL) return 0; @@ -2324,7 +2325,8 @@ static int unwind_entry(struct unwind_entry *entry, void *arg) * Convert entry->ip from a virtual address to an offset in * its corresponding binary. */ - addr = map__map_ip(entry->map, entry->ip); + if (entry->map) + addr = map__map_ip(entry->map, entry->ip); srcline = callchain_srcline(entry->map, entry->sym, addr); return callchain_cursor_append(cursor, entry->ip, diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py index 97efbcad076e..1942f6dd24f6 100644 --- a/tools/perf/util/setup.py +++ b/tools/perf/util/setup.py @@ -35,7 +35,7 @@ class install_lib(_install_lib): cflags = getenv('CFLAGS', '').split() # switch off several checks (need to be at the end of cflags list) -cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter' ] +cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter', '-Wno-redundant-decls' ] if cc != "clang": cflags += ['-Wno-cast-function-type' ] - End forwarded message -
[GIT PULL] perf fixes
Greg, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: c1883f10cfe05c707cce46d6999411c50a2413ca Merge tag 'perf-urgent-for-mingo-4.19-20181005' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent Misc perf tooling fixes. Thanks, Ingo --> Adrian Hunter (2): perf script python: Fix export-to-postgresql.py occasional failure perf script python: Fix export-to-sqlite.py sample columns Arnaldo Carvalho de Melo (1): perf python: Use -Wno-redundant-decls to build with PYTHON=python3 Milian Wolff (2): perf report: Don't try to map ip to invalid map perf record: Use unmapped IP for inline callchain cursors tools/perf/scripts/python/export-to-postgresql.py | 9 + tools/perf/scripts/python/export-to-sqlite.py | 6 +- tools/perf/util/machine.c | 8 +--- tools/perf/util/setup.py | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/tools/perf/scripts/python/export-to-postgresql.py b/tools/perf/scripts/python/export-to-postgresql.py index efcaf6cac2eb..e46f51b17513 100644 --- a/tools/perf/scripts/python/export-to-postgresql.py +++ b/tools/perf/scripts/python/export-to-postgresql.py @@ -204,14 +204,23 @@ from ctypes import * libpq = CDLL("libpq.so.5") PQconnectdb = libpq.PQconnectdb PQconnectdb.restype = c_void_p +PQconnectdb.argtypes = [ c_char_p ] PQfinish = libpq.PQfinish +PQfinish.argtypes = [ c_void_p ] PQstatus = libpq.PQstatus +PQstatus.restype = c_int +PQstatus.argtypes = [ c_void_p ] PQexec = libpq.PQexec PQexec.restype = c_void_p +PQexec.argtypes = [ c_void_p, c_char_p ] PQresultStatus = libpq.PQresultStatus +PQresultStatus.restype = c_int +PQresultStatus.argtypes = [ c_void_p ] PQputCopyData = libpq.PQputCopyData +PQputCopyData.restype = c_int PQputCopyData.argtypes = [ c_void_p, c_void_p, c_int ] PQputCopyEnd = libpq.PQputCopyEnd +PQputCopyEnd.restype = c_int PQputCopyEnd.argtypes = [ c_void_p, c_void_p ] sys.path.append(os.environ['PERF_EXEC_PATH'] + \ diff --git a/tools/perf/scripts/python/export-to-sqlite.py b/tools/perf/scripts/python/export-to-sqlite.py index f827bf77e9d2..e4bb82c8aba9 100644 --- a/tools/perf/scripts/python/export-to-sqlite.py +++ b/tools/perf/scripts/python/export-to-sqlite.py @@ -440,7 +440,11 @@ def branch_type_table(*x): def sample_table(*x): if branches: - bind_exec(sample_query, 18, x) + for xx in x[0:15]: + sample_query.addBindValue(str(xx)) + for xx in x[19:22]: + sample_query.addBindValue(str(xx)) + do_query_(sample_query) else: bind_exec(sample_query, 22, x) diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index c4acd2001db0..111ae858cbcb 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -2286,7 +2286,8 @@ static int append_inlines(struct callchain_cursor *cursor, if (!symbol_conf.inline_name || !map || !sym) return ret; - addr = map__rip_2objdump(map, ip); + addr = map__map_ip(map, ip); + addr = map__rip_2objdump(map, addr); inline_node = inlines__tree_find(>dso->inlined_nodes, addr); if (!inline_node) { @@ -2312,7 +2313,7 @@ static int unwind_entry(struct unwind_entry *entry, void *arg) { struct callchain_cursor *cursor = arg; const char *srcline = NULL; - u64 addr; + u64 addr = entry->ip; if (symbol_conf.hide_unresolved && entry->sym == NULL) return 0; @@ -2324,7 +2325,8 @@ static int unwind_entry(struct unwind_entry *entry, void *arg) * Convert entry->ip from a virtual address to an offset in * its corresponding binary. */ - addr = map__map_ip(entry->map, entry->ip); + if (entry->map) + addr = map__map_ip(entry->map, entry->ip); srcline = callchain_srcline(entry->map, entry->sym, addr); return callchain_cursor_append(cursor, entry->ip, diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py index 97efbcad076e..1942f6dd24f6 100644 --- a/tools/perf/util/setup.py +++ b/tools/perf/util/setup.py @@ -35,7 +35,7 @@ class install_lib(_install_lib): cflags = getenv('CFLAGS', '').split() # switch off several checks (need to be at the end of cflags list) -cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter' ] +cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter', '-Wno-redundant-decls' ] if cc != "clang": cflags += ['-Wno-cast-function-type' ]
[GIT PULL] perf fixes
Greg, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: c1883f10cfe05c707cce46d6999411c50a2413ca Merge tag 'perf-urgent-for-mingo-4.19-20181005' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent Misc perf tooling fixes. Thanks, Ingo --> Adrian Hunter (2): perf script python: Fix export-to-postgresql.py occasional failure perf script python: Fix export-to-sqlite.py sample columns Arnaldo Carvalho de Melo (1): perf python: Use -Wno-redundant-decls to build with PYTHON=python3 Milian Wolff (2): perf report: Don't try to map ip to invalid map perf record: Use unmapped IP for inline callchain cursors tools/perf/scripts/python/export-to-postgresql.py | 9 + tools/perf/scripts/python/export-to-sqlite.py | 6 +- tools/perf/util/machine.c | 8 +--- tools/perf/util/setup.py | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/tools/perf/scripts/python/export-to-postgresql.py b/tools/perf/scripts/python/export-to-postgresql.py index efcaf6cac2eb..e46f51b17513 100644 --- a/tools/perf/scripts/python/export-to-postgresql.py +++ b/tools/perf/scripts/python/export-to-postgresql.py @@ -204,14 +204,23 @@ from ctypes import * libpq = CDLL("libpq.so.5") PQconnectdb = libpq.PQconnectdb PQconnectdb.restype = c_void_p +PQconnectdb.argtypes = [ c_char_p ] PQfinish = libpq.PQfinish +PQfinish.argtypes = [ c_void_p ] PQstatus = libpq.PQstatus +PQstatus.restype = c_int +PQstatus.argtypes = [ c_void_p ] PQexec = libpq.PQexec PQexec.restype = c_void_p +PQexec.argtypes = [ c_void_p, c_char_p ] PQresultStatus = libpq.PQresultStatus +PQresultStatus.restype = c_int +PQresultStatus.argtypes = [ c_void_p ] PQputCopyData = libpq.PQputCopyData +PQputCopyData.restype = c_int PQputCopyData.argtypes = [ c_void_p, c_void_p, c_int ] PQputCopyEnd = libpq.PQputCopyEnd +PQputCopyEnd.restype = c_int PQputCopyEnd.argtypes = [ c_void_p, c_void_p ] sys.path.append(os.environ['PERF_EXEC_PATH'] + \ diff --git a/tools/perf/scripts/python/export-to-sqlite.py b/tools/perf/scripts/python/export-to-sqlite.py index f827bf77e9d2..e4bb82c8aba9 100644 --- a/tools/perf/scripts/python/export-to-sqlite.py +++ b/tools/perf/scripts/python/export-to-sqlite.py @@ -440,7 +440,11 @@ def branch_type_table(*x): def sample_table(*x): if branches: - bind_exec(sample_query, 18, x) + for xx in x[0:15]: + sample_query.addBindValue(str(xx)) + for xx in x[19:22]: + sample_query.addBindValue(str(xx)) + do_query_(sample_query) else: bind_exec(sample_query, 22, x) diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index c4acd2001db0..111ae858cbcb 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -2286,7 +2286,8 @@ static int append_inlines(struct callchain_cursor *cursor, if (!symbol_conf.inline_name || !map || !sym) return ret; - addr = map__rip_2objdump(map, ip); + addr = map__map_ip(map, ip); + addr = map__rip_2objdump(map, addr); inline_node = inlines__tree_find(>dso->inlined_nodes, addr); if (!inline_node) { @@ -2312,7 +2313,7 @@ static int unwind_entry(struct unwind_entry *entry, void *arg) { struct callchain_cursor *cursor = arg; const char *srcline = NULL; - u64 addr; + u64 addr = entry->ip; if (symbol_conf.hide_unresolved && entry->sym == NULL) return 0; @@ -2324,7 +2325,8 @@ static int unwind_entry(struct unwind_entry *entry, void *arg) * Convert entry->ip from a virtual address to an offset in * its corresponding binary. */ - addr = map__map_ip(entry->map, entry->ip); + if (entry->map) + addr = map__map_ip(entry->map, entry->ip); srcline = callchain_srcline(entry->map, entry->sym, addr); return callchain_cursor_append(cursor, entry->ip, diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py index 97efbcad076e..1942f6dd24f6 100644 --- a/tools/perf/util/setup.py +++ b/tools/perf/util/setup.py @@ -35,7 +35,7 @@ class install_lib(_install_lib): cflags = getenv('CFLAGS', '').split() # switch off several checks (need to be at the end of cflags list) -cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter' ] +cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter', '-Wno-redundant-decls' ] if cc != "clang": cflags += ['-Wno-cast-function-type' ]
Re: [GIT PULL] perf fixes
On Fri, Oct 05, 2018 at 11:55:24AM +0200, Ingo Molnar wrote: > > * Ingo Molnar wrote: > > > Linus, > > ... and Greg as well!! ;-) Heh, not a big deal :) Now merged, thanks. greg k-h
Re: [GIT PULL] perf fixes
On Fri, Oct 05, 2018 at 11:55:24AM +0200, Ingo Molnar wrote: > > * Ingo Molnar wrote: > > > Linus, > > ... and Greg as well!! ;-) Heh, not a big deal :) Now merged, thanks. greg k-h
Re: [GIT PULL] perf fixes
* Ingo Molnar wrote: > Linus, ... and Greg as well!! ;-) Thanks, Ingo ps. script fixed.
Re: [GIT PULL] perf fixes
* Ingo Molnar wrote: > Linus, ... and Greg as well!! ;-) Thanks, Ingo ps. script fixed.
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: d7cbbe49a9304520181fb8c9272d1327deec8453 perf/x86/amd/uncore: Set ThreadMask and SliceMask for L3 Cache perf events Misc fixes: - fix a CPU#0 hot unplug bug and a PCI enumeration bug in the x86 Intel uncore PMU driver - fix a CPU event enumeration bug in the x86 AMD PMU driver - fix a perf ring-buffer corruption bug when using tracepoints - fix a PMU unregister locking bug Thanks, Ingo --> Jiri Olsa (1): perf/ring_buffer: Prevent concurent ring buffer access Kan Liang (1): perf/x86/intel/uncore: Fix PCI BDF address of M3UPI on SKX Masayoshi Mizuma (1): perf/x86/intel/uncore: Use boot_cpu_data.phys_proc_id instead of hardcorded physical package ID 0 Natarajan, Janakarajan (1): perf/x86/amd/uncore: Set ThreadMask and SliceMask for L3 Cache perf events Peter Zijlstra (1): perf/core: Fix perf_pmu_unregister() locking arch/x86/events/amd/uncore.c | 10 ++ arch/x86/events/intel/uncore_snbep.c | 14 +++--- arch/x86/include/asm/perf_event.h| 8 kernel/events/core.c | 11 --- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c index 981ba5e8241b..8671de126eac 100644 --- a/arch/x86/events/amd/uncore.c +++ b/arch/x86/events/amd/uncore.c @@ -36,6 +36,7 @@ static int num_counters_llc; static int num_counters_nb; +static bool l3_mask; static HLIST_HEAD(uncore_unused_list); @@ -209,6 +210,13 @@ static int amd_uncore_event_init(struct perf_event *event) hwc->config = event->attr.config & AMD64_RAW_EVENT_MASK_NB; hwc->idx = -1; + /* +* SliceMask and ThreadMask need to be set for certain L3 events in +* Family 17h. For other events, the two fields do not affect the count. +*/ + if (l3_mask) + hwc->config |= (AMD64_L3_SLICE_MASK | AMD64_L3_THREAD_MASK); + if (event->cpu < 0) return -EINVAL; @@ -525,6 +533,7 @@ static int __init amd_uncore_init(void) amd_llc_pmu.name = "amd_l3"; format_attr_event_df.show = _show_df; format_attr_event_l3.show = _show_l3; + l3_mask = true; } else { num_counters_nb = NUM_COUNTERS_NB; num_counters_llc = NUM_COUNTERS_L2; @@ -532,6 +541,7 @@ static int __init amd_uncore_init(void) amd_llc_pmu.name = "amd_l2"; format_attr_event_df = format_attr_event; format_attr_event_l3 = format_attr_event; + l3_mask = false; } amd_nb_pmu.attr_groups = amd_uncore_attr_groups_df; diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c index 51d7c117e3c7..c07bee31abe8 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c @@ -3061,7 +3061,7 @@ static struct event_constraint bdx_uncore_pcu_constraints[] = { void bdx_uncore_cpu_init(void) { - int pkg = topology_phys_to_logical_pkg(0); + int pkg = topology_phys_to_logical_pkg(boot_cpu_data.phys_proc_id); if (bdx_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores) bdx_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores; @@ -3931,16 +3931,16 @@ static const struct pci_device_id skx_uncore_pci_ids[] = { .driver_data = UNCORE_PCI_DEV_FULL_DATA(21, 5, SKX_PCI_UNCORE_M2PCIE, 3), }, { /* M3UPI0 Link 0 */ - PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204C), - .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 0, SKX_PCI_UNCORE_M3UPI, 0), + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204D), + .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 1, SKX_PCI_UNCORE_M3UPI, 0), }, { /* M3UPI0 Link 1 */ - PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204D), - .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 1, SKX_PCI_UNCORE_M3UPI, 1), + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204E), + .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 2, SKX_PCI_UNCORE_M3UPI, 1), }, { /* M3UPI1 Link 2 */ - PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204C), - .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 4, SKX_PCI_UNCORE_M3UPI, 2), + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204D), + .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 5, SKX_PCI_UNCORE_M3UPI, 2), }, { /* end: all zeroes */ } }; diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h index 12f54082f4c8..78241b736f2a 100644 --- a/arch/x86/include/asm/perf_event.h +++ b/arch/x86/include/asm/perf_event.h
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: d7cbbe49a9304520181fb8c9272d1327deec8453 perf/x86/amd/uncore: Set ThreadMask and SliceMask for L3 Cache perf events Misc fixes: - fix a CPU#0 hot unplug bug and a PCI enumeration bug in the x86 Intel uncore PMU driver - fix a CPU event enumeration bug in the x86 AMD PMU driver - fix a perf ring-buffer corruption bug when using tracepoints - fix a PMU unregister locking bug Thanks, Ingo --> Jiri Olsa (1): perf/ring_buffer: Prevent concurent ring buffer access Kan Liang (1): perf/x86/intel/uncore: Fix PCI BDF address of M3UPI on SKX Masayoshi Mizuma (1): perf/x86/intel/uncore: Use boot_cpu_data.phys_proc_id instead of hardcorded physical package ID 0 Natarajan, Janakarajan (1): perf/x86/amd/uncore: Set ThreadMask and SliceMask for L3 Cache perf events Peter Zijlstra (1): perf/core: Fix perf_pmu_unregister() locking arch/x86/events/amd/uncore.c | 10 ++ arch/x86/events/intel/uncore_snbep.c | 14 +++--- arch/x86/include/asm/perf_event.h| 8 kernel/events/core.c | 11 --- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c index 981ba5e8241b..8671de126eac 100644 --- a/arch/x86/events/amd/uncore.c +++ b/arch/x86/events/amd/uncore.c @@ -36,6 +36,7 @@ static int num_counters_llc; static int num_counters_nb; +static bool l3_mask; static HLIST_HEAD(uncore_unused_list); @@ -209,6 +210,13 @@ static int amd_uncore_event_init(struct perf_event *event) hwc->config = event->attr.config & AMD64_RAW_EVENT_MASK_NB; hwc->idx = -1; + /* +* SliceMask and ThreadMask need to be set for certain L3 events in +* Family 17h. For other events, the two fields do not affect the count. +*/ + if (l3_mask) + hwc->config |= (AMD64_L3_SLICE_MASK | AMD64_L3_THREAD_MASK); + if (event->cpu < 0) return -EINVAL; @@ -525,6 +533,7 @@ static int __init amd_uncore_init(void) amd_llc_pmu.name = "amd_l3"; format_attr_event_df.show = _show_df; format_attr_event_l3.show = _show_l3; + l3_mask = true; } else { num_counters_nb = NUM_COUNTERS_NB; num_counters_llc = NUM_COUNTERS_L2; @@ -532,6 +541,7 @@ static int __init amd_uncore_init(void) amd_llc_pmu.name = "amd_l2"; format_attr_event_df = format_attr_event; format_attr_event_l3 = format_attr_event; + l3_mask = false; } amd_nb_pmu.attr_groups = amd_uncore_attr_groups_df; diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c index 51d7c117e3c7..c07bee31abe8 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c @@ -3061,7 +3061,7 @@ static struct event_constraint bdx_uncore_pcu_constraints[] = { void bdx_uncore_cpu_init(void) { - int pkg = topology_phys_to_logical_pkg(0); + int pkg = topology_phys_to_logical_pkg(boot_cpu_data.phys_proc_id); if (bdx_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores) bdx_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores; @@ -3931,16 +3931,16 @@ static const struct pci_device_id skx_uncore_pci_ids[] = { .driver_data = UNCORE_PCI_DEV_FULL_DATA(21, 5, SKX_PCI_UNCORE_M2PCIE, 3), }, { /* M3UPI0 Link 0 */ - PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204C), - .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 0, SKX_PCI_UNCORE_M3UPI, 0), + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204D), + .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 1, SKX_PCI_UNCORE_M3UPI, 0), }, { /* M3UPI0 Link 1 */ - PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204D), - .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 1, SKX_PCI_UNCORE_M3UPI, 1), + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204E), + .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 2, SKX_PCI_UNCORE_M3UPI, 1), }, { /* M3UPI1 Link 2 */ - PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204C), - .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 4, SKX_PCI_UNCORE_M3UPI, 2), + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204D), + .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 5, SKX_PCI_UNCORE_M3UPI, 2), }, { /* end: all zeroes */ } }; diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h index 12f54082f4c8..78241b736f2a 100644 --- a/arch/x86/include/asm/perf_event.h +++ b/arch/x86/include/asm/perf_event.h
Re: [GIT pull] perf fixes for 4.19
On Sat, Sep 22, 2018 at 02:34:04PM +0200, Thomas Gleixner wrote: > Greg, > > please pull the latest perf-urgent-for-linus git tree from: > >git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus Now pulled, thanks. greg k-h
Re: [GIT pull] perf fixes for 4.19
On Sat, Sep 22, 2018 at 02:34:04PM +0200, Thomas Gleixner wrote: > Greg, > > please pull the latest perf-urgent-for-linus git tree from: > >git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus Now pulled, thanks. greg k-h
[GIT pull] perf fixes for 4.19
Greg, please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus Two small fixes for perf tools: - Provide a strerror_r wrapper so lib/bpf can be built on systems without _GNU_SOURCE - Unbreak the man page generator when building out of tree Thanks, tglx --> Arnaldo Carvalho de Melo (1): tools lib bpf: Provide wrapper for strerror_r to build in !_GNU_SOURCE systems Ben Hutchings (1): perf Documentation: Fix out-of-tree asciidoctor man page generation tools/lib/bpf/Build | 2 +- tools/lib/bpf/libbpf.c| 20 ++-- tools/lib/bpf/str_error.c | 18 ++ tools/lib/bpf/str_error.h | 6 ++ tools/perf/Documentation/Makefile | 2 +- 5 files changed, 36 insertions(+), 12 deletions(-) create mode 100644 tools/lib/bpf/str_error.c create mode 100644 tools/lib/bpf/str_error.h diff --git a/tools/lib/bpf/Build b/tools/lib/bpf/Build index 13a861135127..6eb9bacd1948 100644 --- a/tools/lib/bpf/Build +++ b/tools/lib/bpf/Build @@ -1 +1 @@ -libbpf-y := libbpf.o bpf.o nlattr.o btf.o libbpf_errno.o +libbpf-y := libbpf.o bpf.o nlattr.o btf.o libbpf_errno.o str_error.o diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 2abd0f112627..bdb94939fd60 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -50,6 +50,7 @@ #include "libbpf.h" #include "bpf.h" #include "btf.h" +#include "str_error.h" #ifndef EM_BPF #define EM_BPF 247 @@ -469,7 +470,7 @@ static int bpf_object__elf_init(struct bpf_object *obj) obj->efile.fd = open(obj->path, O_RDONLY); if (obj->efile.fd < 0) { char errmsg[STRERR_BUFSIZE]; - char *cp = strerror_r(errno, errmsg, sizeof(errmsg)); + char *cp = str_error(errno, errmsg, sizeof(errmsg)); pr_warning("failed to open %s: %s\n", obj->path, cp); return -errno; @@ -810,8 +811,7 @@ static int bpf_object__elf_collect(struct bpf_object *obj) data->d_size, name, idx); if (err) { char errmsg[STRERR_BUFSIZE]; - char *cp = strerror_r(-err, errmsg, - sizeof(errmsg)); + char *cp = str_error(-err, errmsg, sizeof(errmsg)); pr_warning("failed to alloc program %s (%s): %s", name, obj->path, cp); @@ -1140,7 +1140,7 @@ bpf_object__create_maps(struct bpf_object *obj) *pfd = bpf_create_map_xattr(_attr); if (*pfd < 0 && create_attr.btf_key_type_id) { - cp = strerror_r(errno, errmsg, sizeof(errmsg)); + cp = str_error(errno, errmsg, sizeof(errmsg)); pr_warning("Error in bpf_create_map_xattr(%s):%s(%d). Retrying without BTF.\n", map->name, cp, errno); create_attr.btf_fd = 0; @@ -1155,7 +1155,7 @@ bpf_object__create_maps(struct bpf_object *obj) size_t j; err = *pfd; - cp = strerror_r(errno, errmsg, sizeof(errmsg)); + cp = str_error(errno, errmsg, sizeof(errmsg)); pr_warning("failed to create map (name: '%s'): %s\n", map->name, cp); for (j = 0; j < i; j++) @@ -1339,7 +1339,7 @@ load_program(enum bpf_prog_type type, enum bpf_attach_type expected_attach_type, } ret = -LIBBPF_ERRNO__LOAD; - cp = strerror_r(errno, errmsg, sizeof(errmsg)); + cp = str_error(errno, errmsg, sizeof(errmsg)); pr_warning("load bpf program failed: %s\n", cp); if (log_buf && log_buf[0] != '\0') { @@ -1654,7 +1654,7 @@ static int check_path(const char *path) dir = dirname(dname); if (statfs(dir, _fs)) { - cp = strerror_r(errno, errmsg, sizeof(errmsg)); + cp = str_error(errno, errmsg, sizeof(errmsg)); pr_warning("failed to statfs %s: %s\n", dir, cp); err = -errno; } @@ -1690,7 +1690,7 @@ int bpf_program__pin_instance(struct bpf_program *prog, const char *path, } if (bpf_obj_pin(prog->instances.fds[instance], path)) { - cp = strerror_r(errno, errmsg, sizeof(errmsg)); + cp = str_error(errno, errmsg, sizeof(errmsg)); pr_warning("failed to pin program: %s\n", cp); return -errno; } @@ -1708,7 +1708,7 @@ static int make_dir(const char *path) err = -errno; if (err) { - cp = strerror_r(-err, errmsg,
[GIT pull] perf fixes for 4.19
Greg, please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus Two small fixes for perf tools: - Provide a strerror_r wrapper so lib/bpf can be built on systems without _GNU_SOURCE - Unbreak the man page generator when building out of tree Thanks, tglx --> Arnaldo Carvalho de Melo (1): tools lib bpf: Provide wrapper for strerror_r to build in !_GNU_SOURCE systems Ben Hutchings (1): perf Documentation: Fix out-of-tree asciidoctor man page generation tools/lib/bpf/Build | 2 +- tools/lib/bpf/libbpf.c| 20 ++-- tools/lib/bpf/str_error.c | 18 ++ tools/lib/bpf/str_error.h | 6 ++ tools/perf/Documentation/Makefile | 2 +- 5 files changed, 36 insertions(+), 12 deletions(-) create mode 100644 tools/lib/bpf/str_error.c create mode 100644 tools/lib/bpf/str_error.h diff --git a/tools/lib/bpf/Build b/tools/lib/bpf/Build index 13a861135127..6eb9bacd1948 100644 --- a/tools/lib/bpf/Build +++ b/tools/lib/bpf/Build @@ -1 +1 @@ -libbpf-y := libbpf.o bpf.o nlattr.o btf.o libbpf_errno.o +libbpf-y := libbpf.o bpf.o nlattr.o btf.o libbpf_errno.o str_error.o diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 2abd0f112627..bdb94939fd60 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -50,6 +50,7 @@ #include "libbpf.h" #include "bpf.h" #include "btf.h" +#include "str_error.h" #ifndef EM_BPF #define EM_BPF 247 @@ -469,7 +470,7 @@ static int bpf_object__elf_init(struct bpf_object *obj) obj->efile.fd = open(obj->path, O_RDONLY); if (obj->efile.fd < 0) { char errmsg[STRERR_BUFSIZE]; - char *cp = strerror_r(errno, errmsg, sizeof(errmsg)); + char *cp = str_error(errno, errmsg, sizeof(errmsg)); pr_warning("failed to open %s: %s\n", obj->path, cp); return -errno; @@ -810,8 +811,7 @@ static int bpf_object__elf_collect(struct bpf_object *obj) data->d_size, name, idx); if (err) { char errmsg[STRERR_BUFSIZE]; - char *cp = strerror_r(-err, errmsg, - sizeof(errmsg)); + char *cp = str_error(-err, errmsg, sizeof(errmsg)); pr_warning("failed to alloc program %s (%s): %s", name, obj->path, cp); @@ -1140,7 +1140,7 @@ bpf_object__create_maps(struct bpf_object *obj) *pfd = bpf_create_map_xattr(_attr); if (*pfd < 0 && create_attr.btf_key_type_id) { - cp = strerror_r(errno, errmsg, sizeof(errmsg)); + cp = str_error(errno, errmsg, sizeof(errmsg)); pr_warning("Error in bpf_create_map_xattr(%s):%s(%d). Retrying without BTF.\n", map->name, cp, errno); create_attr.btf_fd = 0; @@ -1155,7 +1155,7 @@ bpf_object__create_maps(struct bpf_object *obj) size_t j; err = *pfd; - cp = strerror_r(errno, errmsg, sizeof(errmsg)); + cp = str_error(errno, errmsg, sizeof(errmsg)); pr_warning("failed to create map (name: '%s'): %s\n", map->name, cp); for (j = 0; j < i; j++) @@ -1339,7 +1339,7 @@ load_program(enum bpf_prog_type type, enum bpf_attach_type expected_attach_type, } ret = -LIBBPF_ERRNO__LOAD; - cp = strerror_r(errno, errmsg, sizeof(errmsg)); + cp = str_error(errno, errmsg, sizeof(errmsg)); pr_warning("load bpf program failed: %s\n", cp); if (log_buf && log_buf[0] != '\0') { @@ -1654,7 +1654,7 @@ static int check_path(const char *path) dir = dirname(dname); if (statfs(dir, _fs)) { - cp = strerror_r(errno, errmsg, sizeof(errmsg)); + cp = str_error(errno, errmsg, sizeof(errmsg)); pr_warning("failed to statfs %s: %s\n", dir, cp); err = -errno; } @@ -1690,7 +1690,7 @@ int bpf_program__pin_instance(struct bpf_program *prog, const char *path, } if (bpf_obj_pin(prog->instances.fds[instance], path)) { - cp = strerror_r(errno, errmsg, sizeof(errmsg)); + cp = str_error(errno, errmsg, sizeof(errmsg)); pr_warning("failed to pin program: %s\n", cp); return -errno; } @@ -1708,7 +1708,7 @@ static int make_dir(const char *path) err = -errno; if (err) { - cp = strerror_r(-err, errmsg,
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: cb48b6a26cace226d8b299a48c73e808eb0c4f61 Merge tag 'perf-urgent-for-mingo-4.19-20180912' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent Mostly tooling fixes, but also breakpoint and x86 PMU driver fixes. Thanks, Ingo --> Adrian Hunter (1): perf tools: Fix maps__find_symbol_by_name() Arnaldo Carvalho de Melo (7): perf tools: Streamline bpf examples and headers installation tools headers uapi: Update tools's copy of linux/perf_event.h tools headers uapi: Update tools's copy of asm-generic/unistd.h tools headers uapi: Update tools's copy of drm/drm.h tools headers uapi: Update tools's copies of kvm headers tools headers uapi: Update tools's copy of linux/vhost.h tools headers uapi: Update tools's copy of linux/if_link.h Chris Phlipot (2): perf util: Fix bad memory access in trace info. perf event-parse: Use fixed size string for comms Hisao Tanabe (1): perf evsel: Fix potential null pointer dereference in perf_evsel__new_idx() Jacek Tomaka (1): perf/x86/intel: Add support/quirk for the MISPREDICT bit on Knights Landing CPUs Jiri Olsa (5): perf tests: Add breakpoint modify tests perf/hw_breakpoint: Modify breakpoint even if the new attr has disabled set perf/hw_breakpoint: Remove superfluous bp->attr.disabled = 0 perf/hw_breakpoint: Enable breakpoint in modify_user_hw_breakpoint perf/hw_breakpoint: Simplify breakpoint enable in perf_event_modify_breakpoint Kim Phillips (2): perf arm64: Fix include path for asm-generic/unistd.h perf annotate: Fix parsing aarch64 branch instructions after objdump update Martin Liška (1): perf annotate: Properly interpret indirect call Peter Zijlstra (1): perf/UAPI: Clearly mark __PERF_SAMPLE_CALLCHAIN_EARLY as internal use Sandipan Das (1): perf probe powerpc: Ignore SyS symbols irrespective of endianness Yabin Cui (1): perf/core: Force USER_DS when recording user stack data arch/x86/events/intel/lbr.c | 4 + include/uapi/linux/perf_event.h | 2 +- kernel/events/core.c | 15 +- kernel/events/hw_breakpoint.c | 13 +- tools/arch/arm/include/uapi/asm/kvm.h | 13 ++ tools/arch/arm64/include/uapi/asm/kvm.h | 13 ++ tools/arch/s390/include/uapi/asm/kvm.h| 5 +- tools/arch/x86/include/uapi/asm/kvm.h | 37 tools/include/uapi/asm-generic/unistd.h | 4 +- tools/include/uapi/drm/drm.h | 9 + tools/include/uapi/linux/if_link.h| 17 ++ tools/include/uapi/linux/kvm.h| 6 + tools/include/uapi/linux/perf_event.h | 2 +- tools/include/uapi/linux/vhost.h | 18 ++ tools/perf/Makefile.perf | 14 +- tools/perf/arch/arm64/Makefile| 5 +- tools/perf/arch/arm64/entry/syscalls/mksyscalltbl | 6 +- tools/perf/arch/powerpc/util/sym-handling.c | 4 +- tools/perf/arch/x86/include/arch-tests.h | 1 + tools/perf/arch/x86/tests/Build | 1 + tools/perf/arch/x86/tests/arch-tests.c| 6 + tools/perf/arch/x86/tests/bp-modify.c | 213 ++ tools/perf/util/annotate.c| 32 +++- tools/perf/util/annotate.h| 1 + tools/perf/util/evsel.c | 5 +- tools/perf/util/map.c | 11 ++ tools/perf/util/trace-event-info.c| 2 +- tools/perf/util/trace-event-parse.c | 7 +- 28 files changed, 423 insertions(+), 43 deletions(-) create mode 100644 tools/perf/arch/x86/tests/bp-modify.c diff --git a/arch/x86/events/intel/lbr.c b/arch/x86/events/intel/lbr.c index f3e006bed9a7..c88ed39582a1 100644 --- a/arch/x86/events/intel/lbr.c +++ b/arch/x86/events/intel/lbr.c @@ -1272,4 +1272,8 @@ void intel_pmu_lbr_init_knl(void) x86_pmu.lbr_sel_mask = LBR_SEL_MASK; x86_pmu.lbr_sel_map = snb_lbr_sel_map; + + /* Knights Landing does have MISPREDICT bit */ + if (x86_pmu.intel_cap.lbr_format == LBR_FORMAT_LIP) + x86_pmu.intel_cap.lbr_format = LBR_FORMAT_EIP_FLAGS; } diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h index eeb787b1c53c..f35eb72739c0 100644 --- a/include/uapi/linux/perf_event.h +++ b/include/uapi/linux/perf_event.h @@ -144,7 +144,7 @@ enum perf_event_sample_format { PERF_SAMPLE_MAX = 1U << 20, /* non-ABI */ - __PERF_SAMPLE_CALLCHAIN_EARLY = 1ULL << 63, + __PERF_SAMPLE_CALLCHAIN_EARLY = 1ULL << 63, /* non-ABI;
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: cb48b6a26cace226d8b299a48c73e808eb0c4f61 Merge tag 'perf-urgent-for-mingo-4.19-20180912' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent Mostly tooling fixes, but also breakpoint and x86 PMU driver fixes. Thanks, Ingo --> Adrian Hunter (1): perf tools: Fix maps__find_symbol_by_name() Arnaldo Carvalho de Melo (7): perf tools: Streamline bpf examples and headers installation tools headers uapi: Update tools's copy of linux/perf_event.h tools headers uapi: Update tools's copy of asm-generic/unistd.h tools headers uapi: Update tools's copy of drm/drm.h tools headers uapi: Update tools's copies of kvm headers tools headers uapi: Update tools's copy of linux/vhost.h tools headers uapi: Update tools's copy of linux/if_link.h Chris Phlipot (2): perf util: Fix bad memory access in trace info. perf event-parse: Use fixed size string for comms Hisao Tanabe (1): perf evsel: Fix potential null pointer dereference in perf_evsel__new_idx() Jacek Tomaka (1): perf/x86/intel: Add support/quirk for the MISPREDICT bit on Knights Landing CPUs Jiri Olsa (5): perf tests: Add breakpoint modify tests perf/hw_breakpoint: Modify breakpoint even if the new attr has disabled set perf/hw_breakpoint: Remove superfluous bp->attr.disabled = 0 perf/hw_breakpoint: Enable breakpoint in modify_user_hw_breakpoint perf/hw_breakpoint: Simplify breakpoint enable in perf_event_modify_breakpoint Kim Phillips (2): perf arm64: Fix include path for asm-generic/unistd.h perf annotate: Fix parsing aarch64 branch instructions after objdump update Martin Liška (1): perf annotate: Properly interpret indirect call Peter Zijlstra (1): perf/UAPI: Clearly mark __PERF_SAMPLE_CALLCHAIN_EARLY as internal use Sandipan Das (1): perf probe powerpc: Ignore SyS symbols irrespective of endianness Yabin Cui (1): perf/core: Force USER_DS when recording user stack data arch/x86/events/intel/lbr.c | 4 + include/uapi/linux/perf_event.h | 2 +- kernel/events/core.c | 15 +- kernel/events/hw_breakpoint.c | 13 +- tools/arch/arm/include/uapi/asm/kvm.h | 13 ++ tools/arch/arm64/include/uapi/asm/kvm.h | 13 ++ tools/arch/s390/include/uapi/asm/kvm.h| 5 +- tools/arch/x86/include/uapi/asm/kvm.h | 37 tools/include/uapi/asm-generic/unistd.h | 4 +- tools/include/uapi/drm/drm.h | 9 + tools/include/uapi/linux/if_link.h| 17 ++ tools/include/uapi/linux/kvm.h| 6 + tools/include/uapi/linux/perf_event.h | 2 +- tools/include/uapi/linux/vhost.h | 18 ++ tools/perf/Makefile.perf | 14 +- tools/perf/arch/arm64/Makefile| 5 +- tools/perf/arch/arm64/entry/syscalls/mksyscalltbl | 6 +- tools/perf/arch/powerpc/util/sym-handling.c | 4 +- tools/perf/arch/x86/include/arch-tests.h | 1 + tools/perf/arch/x86/tests/Build | 1 + tools/perf/arch/x86/tests/arch-tests.c| 6 + tools/perf/arch/x86/tests/bp-modify.c | 213 ++ tools/perf/util/annotate.c| 32 +++- tools/perf/util/annotate.h| 1 + tools/perf/util/evsel.c | 5 +- tools/perf/util/map.c | 11 ++ tools/perf/util/trace-event-info.c| 2 +- tools/perf/util/trace-event-parse.c | 7 +- 28 files changed, 423 insertions(+), 43 deletions(-) create mode 100644 tools/perf/arch/x86/tests/bp-modify.c diff --git a/arch/x86/events/intel/lbr.c b/arch/x86/events/intel/lbr.c index f3e006bed9a7..c88ed39582a1 100644 --- a/arch/x86/events/intel/lbr.c +++ b/arch/x86/events/intel/lbr.c @@ -1272,4 +1272,8 @@ void intel_pmu_lbr_init_knl(void) x86_pmu.lbr_sel_mask = LBR_SEL_MASK; x86_pmu.lbr_sel_map = snb_lbr_sel_map; + + /* Knights Landing does have MISPREDICT bit */ + if (x86_pmu.intel_cap.lbr_format == LBR_FORMAT_LIP) + x86_pmu.intel_cap.lbr_format = LBR_FORMAT_EIP_FLAGS; } diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h index eeb787b1c53c..f35eb72739c0 100644 --- a/include/uapi/linux/perf_event.h +++ b/include/uapi/linux/perf_event.h @@ -144,7 +144,7 @@ enum perf_event_sample_format { PERF_SAMPLE_MAX = 1U << 20, /* non-ABI */ - __PERF_SAMPLE_CALLCHAIN_EARLY = 1ULL << 63, + __PERF_SAMPLE_CALLCHAIN_EARLY = 1ULL << 63, /* non-ABI;
[GIT pull] perf fixes for 4.18
Linus, please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus A set of fixes for perf: drivers: - Fix the hardcoded index of extra PCI devices on Broadwell which causes a resource conflict and triggers warnings on CPU hotplug. tools: - Update the tools copy of several files, including perf_event.h, powerpc's asm/unistd.h (new io_pgetevents syscall), bpf.h and x86's memcpy_64.s (used in 'perf bench mem'), silencing the respective warnings during the perf tools build. - Fix the build on the alpine:edge distro. Thanks, tglx --> Arnaldo Carvalho de Melo (5): tools headers uapi: Update tools's copy of linux/perf_event.h tools headers powerpc: Update asm/unistd.h copy to pick new tools headers uapi: Refresh linux/bpf.h copy tools arch: Update arch/x86/lib/memcpy_64.S copy used in 'perf bench mem memcpy' perf tools: Fix the build on the alpine:edge distro Kan Liang (1): perf/x86/intel/uncore: Fix hardcoded index of Broadwell extra PCI devices arch/x86/events/intel/uncore.h | 2 +- arch/x86/events/intel/uncore_snbep.c | 10 ++- tools/arch/powerpc/include/uapi/asm/unistd.h | 1 + tools/arch/x86/include/asm/mcsafe_test.h | 13 tools/arch/x86/lib/memcpy_64.S | 112 +-- tools/include/uapi/linux/bpf.h | 28 +-- tools/include/uapi/linux/perf_event.h| 2 + tools/perf/arch/x86/util/pmu.c | 1 + tools/perf/arch/x86/util/tsc.c | 1 + tools/perf/bench/Build | 1 + tools/perf/bench/mem-memcpy-x86-64-asm.S | 1 + tools/perf/bench/mem-memcpy-x86-64-lib.c | 24 ++ tools/perf/perf.h| 1 + tools/perf/util/header.h | 1 + tools/perf/util/namespaces.h | 1 + 15 files changed, 132 insertions(+), 67 deletions(-) create mode 100644 tools/arch/x86/include/asm/mcsafe_test.h create mode 100644 tools/perf/bench/mem-memcpy-x86-64-lib.c diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h index c9e1e0bef3c3..e17ab885b1e9 100644 --- a/arch/x86/events/intel/uncore.h +++ b/arch/x86/events/intel/uncore.h @@ -28,7 +28,7 @@ #define UNCORE_PCI_DEV_TYPE(data) ((data >> 8) & 0xff) #define UNCORE_PCI_DEV_IDX(data) (data & 0xff) #define UNCORE_EXTRA_PCI_DEV 0xff -#define UNCORE_EXTRA_PCI_DEV_MAX 3 +#define UNCORE_EXTRA_PCI_DEV_MAX 4 #define UNCORE_EVENT_CONSTRAINT(c, n) EVENT_CONSTRAINT(c, n, 0xff) diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c index 87dc0263a2e1..51d7c117e3c7 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c @@ -1029,6 +1029,7 @@ void snbep_uncore_cpu_init(void) enum { SNBEP_PCI_QPI_PORT0_FILTER, SNBEP_PCI_QPI_PORT1_FILTER, + BDX_PCI_QPI_PORT2_FILTER, HSWEP_PCI_PCU_3, }; @@ -3286,15 +3287,18 @@ static const struct pci_device_id bdx_uncore_pci_ids[] = { }, { /* QPI Port 0 filter */ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f86), - .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, 0), + .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, + SNBEP_PCI_QPI_PORT0_FILTER), }, { /* QPI Port 1 filter */ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f96), - .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, 1), + .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, + SNBEP_PCI_QPI_PORT1_FILTER), }, { /* QPI Port 2 filter */ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f46), - .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, 2), + .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, + BDX_PCI_QPI_PORT2_FILTER), }, { /* PCU.3 (for Capability registers) */ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6fc0), diff --git a/tools/arch/powerpc/include/uapi/asm/unistd.h b/tools/arch/powerpc/include/uapi/asm/unistd.h index ac5ba55066dd..985534d0b448 100644 --- a/tools/arch/powerpc/include/uapi/asm/unistd.h +++ b/tools/arch/powerpc/include/uapi/asm/unistd.h @@ -399,5 +399,6 @@ #define __NR_pkey_free 385 #define __NR_pkey_mprotect 386 #define __NR_rseq 387 +#define __NR_io_pgetevents 388 #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ diff --git a/tools/arch/x86/include/asm/mcsafe_test.h b/tools/arch/x86/include/asm/mcsafe_test.h new file mode 100644 index ..2ccd588fbad4 --- /dev/null +++ b/tools/arch/x86/include/asm/mcsafe_test.h @@ -0,0 +1,13 @@
[GIT pull] perf fixes for 4.18
Linus, please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus A set of fixes for perf: drivers: - Fix the hardcoded index of extra PCI devices on Broadwell which causes a resource conflict and triggers warnings on CPU hotplug. tools: - Update the tools copy of several files, including perf_event.h, powerpc's asm/unistd.h (new io_pgetevents syscall), bpf.h and x86's memcpy_64.s (used in 'perf bench mem'), silencing the respective warnings during the perf tools build. - Fix the build on the alpine:edge distro. Thanks, tglx --> Arnaldo Carvalho de Melo (5): tools headers uapi: Update tools's copy of linux/perf_event.h tools headers powerpc: Update asm/unistd.h copy to pick new tools headers uapi: Refresh linux/bpf.h copy tools arch: Update arch/x86/lib/memcpy_64.S copy used in 'perf bench mem memcpy' perf tools: Fix the build on the alpine:edge distro Kan Liang (1): perf/x86/intel/uncore: Fix hardcoded index of Broadwell extra PCI devices arch/x86/events/intel/uncore.h | 2 +- arch/x86/events/intel/uncore_snbep.c | 10 ++- tools/arch/powerpc/include/uapi/asm/unistd.h | 1 + tools/arch/x86/include/asm/mcsafe_test.h | 13 tools/arch/x86/lib/memcpy_64.S | 112 +-- tools/include/uapi/linux/bpf.h | 28 +-- tools/include/uapi/linux/perf_event.h| 2 + tools/perf/arch/x86/util/pmu.c | 1 + tools/perf/arch/x86/util/tsc.c | 1 + tools/perf/bench/Build | 1 + tools/perf/bench/mem-memcpy-x86-64-asm.S | 1 + tools/perf/bench/mem-memcpy-x86-64-lib.c | 24 ++ tools/perf/perf.h| 1 + tools/perf/util/header.h | 1 + tools/perf/util/namespaces.h | 1 + 15 files changed, 132 insertions(+), 67 deletions(-) create mode 100644 tools/arch/x86/include/asm/mcsafe_test.h create mode 100644 tools/perf/bench/mem-memcpy-x86-64-lib.c diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h index c9e1e0bef3c3..e17ab885b1e9 100644 --- a/arch/x86/events/intel/uncore.h +++ b/arch/x86/events/intel/uncore.h @@ -28,7 +28,7 @@ #define UNCORE_PCI_DEV_TYPE(data) ((data >> 8) & 0xff) #define UNCORE_PCI_DEV_IDX(data) (data & 0xff) #define UNCORE_EXTRA_PCI_DEV 0xff -#define UNCORE_EXTRA_PCI_DEV_MAX 3 +#define UNCORE_EXTRA_PCI_DEV_MAX 4 #define UNCORE_EVENT_CONSTRAINT(c, n) EVENT_CONSTRAINT(c, n, 0xff) diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c index 87dc0263a2e1..51d7c117e3c7 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c @@ -1029,6 +1029,7 @@ void snbep_uncore_cpu_init(void) enum { SNBEP_PCI_QPI_PORT0_FILTER, SNBEP_PCI_QPI_PORT1_FILTER, + BDX_PCI_QPI_PORT2_FILTER, HSWEP_PCI_PCU_3, }; @@ -3286,15 +3287,18 @@ static const struct pci_device_id bdx_uncore_pci_ids[] = { }, { /* QPI Port 0 filter */ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f86), - .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, 0), + .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, + SNBEP_PCI_QPI_PORT0_FILTER), }, { /* QPI Port 1 filter */ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f96), - .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, 1), + .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, + SNBEP_PCI_QPI_PORT1_FILTER), }, { /* QPI Port 2 filter */ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f46), - .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, 2), + .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, + BDX_PCI_QPI_PORT2_FILTER), }, { /* PCU.3 (for Capability registers) */ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6fc0), diff --git a/tools/arch/powerpc/include/uapi/asm/unistd.h b/tools/arch/powerpc/include/uapi/asm/unistd.h index ac5ba55066dd..985534d0b448 100644 --- a/tools/arch/powerpc/include/uapi/asm/unistd.h +++ b/tools/arch/powerpc/include/uapi/asm/unistd.h @@ -399,5 +399,6 @@ #define __NR_pkey_free 385 #define __NR_pkey_mprotect 386 #define __NR_rseq 387 +#define __NR_io_pgetevents 388 #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ diff --git a/tools/arch/x86/include/asm/mcsafe_test.h b/tools/arch/x86/include/asm/mcsafe_test.h new file mode 100644 index ..2ccd588fbad4 --- /dev/null +++ b/tools/arch/x86/include/asm/mcsafe_test.h @@ -0,0 +1,13 @@
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 7f635ff187ab6be0b350b3ec06791e376af238ab perf/core: Fix crash when using HW tracing kernel filters Misc fixes: - AMD IBS data corruptor fix (uncovered by UBSAN) - an Intel PEBS entry unwind error fix - a HW-tracing crash fix - a MAINTAINERS update Thanks, Ingo --> Ananth N Mavinakayanahalli (1): MAINTAINERS: Add Naveen N. Rao as kprobes co-maintainer Mathieu Poirier (1): perf/core: Fix crash when using HW tracing kernel filters Peter Zijlstra (1): perf/x86/intel: Fix unwind errors from PEBS entries (mk-II) Thomas Gleixner (1): perf/x86/amd/ibs: Don't access non-started event MAINTAINERS | 2 +- arch/x86/events/amd/ibs.c | 6 +- arch/x86/events/intel/core.c| 3 +++ arch/x86/events/intel/ds.c | 25 +++-- include/linux/perf_event.h | 1 + include/uapi/linux/perf_event.h | 2 ++ kernel/events/core.c| 10 -- 7 files changed, 31 insertions(+), 18 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 0fe4228f78cb..42a884c1b0f7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7984,7 +7984,7 @@ F:lib/test_kmod.c F: tools/testing/selftests/kmod/ KPROBES -M: Ananth N Mavinakayanahalli +M: Naveen N. Rao M: Anil S Keshavamurthy M: "David S. Miller" M: Masami Hiramatsu diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c index 4b98101209a1..d50bb4dc0650 100644 --- a/arch/x86/events/amd/ibs.c +++ b/arch/x86/events/amd/ibs.c @@ -579,7 +579,7 @@ static int perf_ibs_handle_irq(struct perf_ibs *perf_ibs, struct pt_regs *iregs) { struct cpu_perf_ibs *pcpu = this_cpu_ptr(perf_ibs->pcpu); struct perf_event *event = pcpu->event; - struct hw_perf_event *hwc = >hw; + struct hw_perf_event *hwc; struct perf_sample_data data; struct perf_raw_record raw; struct pt_regs regs; @@ -602,6 +602,10 @@ static int perf_ibs_handle_irq(struct perf_ibs *perf_ibs, struct pt_regs *iregs) return 0; } + if (WARN_ON_ONCE(!event)) + goto fail; + + hwc = >hw; msr = hwc->config_base; buf = ibs_data.regs; rdmsrl(msr, *buf); diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 707b2a96e516..86f0c15dcc2d 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -2997,6 +2997,9 @@ static int intel_pmu_hw_config(struct perf_event *event) } if (x86_pmu.pebs_aliases) x86_pmu.pebs_aliases(event); + + if (event->attr.sample_type & PERF_SAMPLE_CALLCHAIN) + event->attr.sample_type |= __PERF_SAMPLE_CALLCHAIN_EARLY; } if (needs_branch_stack(event)) { diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c index 8cf03f101938..8dbba77e0518 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -1185,17 +1185,21 @@ static void setup_pebs_sample_data(struct perf_event *event, data->data_src.val = val; } + /* +* We must however always use iregs for the unwinder to stay sane; the +* record BP,SP,IP can point into thin air when the record is from a +* previous PMI context or an (I)RET happend between the record and +* PMI. +*/ + if (sample_type & PERF_SAMPLE_CALLCHAIN) + data->callchain = perf_callchain(event, iregs); + /* * We use the interrupt regs as a base because the PEBS record does not * contain a full regs set, specifically it seems to lack segment * descriptors, which get used by things like user_mode(). * * In the simple case fix up only the IP for PERF_SAMPLE_IP. -* -* We must however always use BP,SP from iregs for the unwinder to stay -* sane; the record BP,SP can point into thin air when the record is -* from a previous PMI context or an (I)RET happend between the record -* and PMI. */ *regs = *iregs; @@ -1214,15 +1218,8 @@ static void setup_pebs_sample_data(struct perf_event *event, regs->si = pebs->si; regs->di = pebs->di; - /* -* Per the above; only set BP,SP if we don't need callchains. -* -* XXX: does this make sense? -*/ - if (!(sample_type & PERF_SAMPLE_CALLCHAIN)) { - regs->bp = pebs->bp; - regs->sp = pebs->sp; - } + regs->bp = pebs->bp; + regs->sp = pebs->sp; #ifndef CONFIG_X86_32 regs->r8 = pebs->r8; diff --git
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 7f635ff187ab6be0b350b3ec06791e376af238ab perf/core: Fix crash when using HW tracing kernel filters Misc fixes: - AMD IBS data corruptor fix (uncovered by UBSAN) - an Intel PEBS entry unwind error fix - a HW-tracing crash fix - a MAINTAINERS update Thanks, Ingo --> Ananth N Mavinakayanahalli (1): MAINTAINERS: Add Naveen N. Rao as kprobes co-maintainer Mathieu Poirier (1): perf/core: Fix crash when using HW tracing kernel filters Peter Zijlstra (1): perf/x86/intel: Fix unwind errors from PEBS entries (mk-II) Thomas Gleixner (1): perf/x86/amd/ibs: Don't access non-started event MAINTAINERS | 2 +- arch/x86/events/amd/ibs.c | 6 +- arch/x86/events/intel/core.c| 3 +++ arch/x86/events/intel/ds.c | 25 +++-- include/linux/perf_event.h | 1 + include/uapi/linux/perf_event.h | 2 ++ kernel/events/core.c| 10 -- 7 files changed, 31 insertions(+), 18 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 0fe4228f78cb..42a884c1b0f7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7984,7 +7984,7 @@ F:lib/test_kmod.c F: tools/testing/selftests/kmod/ KPROBES -M: Ananth N Mavinakayanahalli +M: Naveen N. Rao M: Anil S Keshavamurthy M: "David S. Miller" M: Masami Hiramatsu diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c index 4b98101209a1..d50bb4dc0650 100644 --- a/arch/x86/events/amd/ibs.c +++ b/arch/x86/events/amd/ibs.c @@ -579,7 +579,7 @@ static int perf_ibs_handle_irq(struct perf_ibs *perf_ibs, struct pt_regs *iregs) { struct cpu_perf_ibs *pcpu = this_cpu_ptr(perf_ibs->pcpu); struct perf_event *event = pcpu->event; - struct hw_perf_event *hwc = >hw; + struct hw_perf_event *hwc; struct perf_sample_data data; struct perf_raw_record raw; struct pt_regs regs; @@ -602,6 +602,10 @@ static int perf_ibs_handle_irq(struct perf_ibs *perf_ibs, struct pt_regs *iregs) return 0; } + if (WARN_ON_ONCE(!event)) + goto fail; + + hwc = >hw; msr = hwc->config_base; buf = ibs_data.regs; rdmsrl(msr, *buf); diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 707b2a96e516..86f0c15dcc2d 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -2997,6 +2997,9 @@ static int intel_pmu_hw_config(struct perf_event *event) } if (x86_pmu.pebs_aliases) x86_pmu.pebs_aliases(event); + + if (event->attr.sample_type & PERF_SAMPLE_CALLCHAIN) + event->attr.sample_type |= __PERF_SAMPLE_CALLCHAIN_EARLY; } if (needs_branch_stack(event)) { diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c index 8cf03f101938..8dbba77e0518 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -1185,17 +1185,21 @@ static void setup_pebs_sample_data(struct perf_event *event, data->data_src.val = val; } + /* +* We must however always use iregs for the unwinder to stay sane; the +* record BP,SP,IP can point into thin air when the record is from a +* previous PMI context or an (I)RET happend between the record and +* PMI. +*/ + if (sample_type & PERF_SAMPLE_CALLCHAIN) + data->callchain = perf_callchain(event, iregs); + /* * We use the interrupt regs as a base because the PEBS record does not * contain a full regs set, specifically it seems to lack segment * descriptors, which get used by things like user_mode(). * * In the simple case fix up only the IP for PERF_SAMPLE_IP. -* -* We must however always use BP,SP from iregs for the unwinder to stay -* sane; the record BP,SP can point into thin air when the record is -* from a previous PMI context or an (I)RET happend between the record -* and PMI. */ *regs = *iregs; @@ -1214,15 +1218,8 @@ static void setup_pebs_sample_data(struct perf_event *event, regs->si = pebs->si; regs->di = pebs->di; - /* -* Per the above; only set BP,SP if we don't need callchains. -* -* XXX: does this make sense? -*/ - if (!(sample_type & PERF_SAMPLE_CALLCHAIN)) { - regs->bp = pebs->bp; - regs->sp = pebs->sp; - } + regs->bp = pebs->bp; + regs->sp = pebs->sp; #ifndef CONFIG_X86_32 regs->r8 = pebs->r8; diff --git
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 6e1d33b24a2b4aebcb05782e937ebc9a7a4a3f50 Merge tag 'perf-urgent-for-mingo-4.18-20180711' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent Misc tooling fixes: ptyhon3 related fixes, gcc8 fix, bashism fixes and some other smaller fixes. Thanks, Ingo --> Janne Huttunen (1): perf script python: Fix dict reference counting Jeremy Cline (7): perf tools: Generate a Python script compatible with Python 2 and 3 perf scripts python: Add Python 3 support to Core.py perf scripts python: Add Python 3 support to SchedGui.py perf scripts python: Add Python 3 support to Util.py perf scripts python: Add Python 3 support to sched-migration.py perf scripts python: Add Python 3 support to EventClass.py perf tools: Use python-config --includes rather than --cflags Jiri Olsa (2): perf tools: Fix compilation errors on gcc8 perf stat: Fix --interval_clear option Kim Phillips (4): perf test shell: Replace '|&' with '2>&1 |' to work with more shells perf test shell: Make perf's inet_pton test more portable perf llvm-utils: Remove bashism from kernel include fetch script perf test shell: Prevent temporary editor files from being considered test scripts tools/perf/Makefile.config | 3 +- tools/perf/arch/x86/util/perf_regs.c | 2 +- tools/perf/builtin-stat.c | 2 +- tools/perf/jvmti/jvmti_agent.c | 3 +- .../python/Perf-Trace-Util/lib/Perf/Trace/Core.py | 40 +- .../Perf-Trace-Util/lib/Perf/Trace/EventClass.py | 4 ++- .../Perf-Trace-Util/lib/Perf/Trace/SchedGui.py | 2 +- .../python/Perf-Trace-Util/lib/Perf/Trace/Util.py | 11 +++--- tools/perf/scripts/python/sched-migration.py | 14 +--- tools/perf/tests/builtin-test.c| 2 +- .../tests/shell/record+probe_libc_inet_pton.sh | 37 +++- tools/perf/tests/shell/trace+probe_vfs_getname.sh | 2 +- tools/perf/util/llvm-utils.c | 6 ++-- .../util/scripting-engines/trace-event-python.c| 37 +--- 14 files changed, 84 insertions(+), 81 deletions(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index b5ac356ba323..f5a3b402589e 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -207,8 +207,7 @@ ifdef PYTHON_CONFIG PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil - PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) - PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS)) + PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --includes 2>/dev/null) FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) endif diff --git a/tools/perf/arch/x86/util/perf_regs.c b/tools/perf/arch/x86/util/perf_regs.c index 4b2caf6d48e7..fead6b3b4206 100644 --- a/tools/perf/arch/x86/util/perf_regs.c +++ b/tools/perf/arch/x86/util/perf_regs.c @@ -226,7 +226,7 @@ int arch_sdt_arg_parse_op(char *old_op, char **new_op) else if (rm[2].rm_so != rm[2].rm_eo) prefix[0] = '+'; else - strncpy(prefix, "+0", 2); + scnprintf(prefix, sizeof(prefix), "+0"); } /* Rename register */ diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 22547a490e1f..05be023c3f0e 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -1742,7 +1742,7 @@ static void print_interval(char *prefix, struct timespec *ts) } } - if ((num_print_interval == 0 && metric_only) || interval_clear) + if ((num_print_interval == 0 || interval_clear) && metric_only) print_metric_headers(" ", true); if (++num_print_interval == 25) num_print_interval = 0; diff --git a/tools/perf/jvmti/jvmti_agent.c b/tools/perf/jvmti/jvmti_agent.c index 0c6d1002b524..ac1bcdc17dae 100644 --- a/tools/perf/jvmti/jvmti_agent.c +++ b/tools/perf/jvmti/jvmti_agent.c @@ -35,6 +35,7 @@ #include #include /* for gettid() */ #include +#include #include "jvmti_agent.h" #include "../util/jitdump.h" @@ -249,7 +250,7 @@ void *jvmti_open(void) /* * jitdump file name */ - snprintf(dump_path, PATH_MAX, "%s/jit-%i.dump", jit_path, getpid()); + scnprintf(dump_path, PATH_MAX, "%s/jit-%i.dump", jit_path, getpid()); fd = open(dump_path, O_CREAT|O_TRUNC|O_RDWR, 0666); if (fd == -1) diff --git
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 6e1d33b24a2b4aebcb05782e937ebc9a7a4a3f50 Merge tag 'perf-urgent-for-mingo-4.18-20180711' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent Misc tooling fixes: ptyhon3 related fixes, gcc8 fix, bashism fixes and some other smaller fixes. Thanks, Ingo --> Janne Huttunen (1): perf script python: Fix dict reference counting Jeremy Cline (7): perf tools: Generate a Python script compatible with Python 2 and 3 perf scripts python: Add Python 3 support to Core.py perf scripts python: Add Python 3 support to SchedGui.py perf scripts python: Add Python 3 support to Util.py perf scripts python: Add Python 3 support to sched-migration.py perf scripts python: Add Python 3 support to EventClass.py perf tools: Use python-config --includes rather than --cflags Jiri Olsa (2): perf tools: Fix compilation errors on gcc8 perf stat: Fix --interval_clear option Kim Phillips (4): perf test shell: Replace '|&' with '2>&1 |' to work with more shells perf test shell: Make perf's inet_pton test more portable perf llvm-utils: Remove bashism from kernel include fetch script perf test shell: Prevent temporary editor files from being considered test scripts tools/perf/Makefile.config | 3 +- tools/perf/arch/x86/util/perf_regs.c | 2 +- tools/perf/builtin-stat.c | 2 +- tools/perf/jvmti/jvmti_agent.c | 3 +- .../python/Perf-Trace-Util/lib/Perf/Trace/Core.py | 40 +- .../Perf-Trace-Util/lib/Perf/Trace/EventClass.py | 4 ++- .../Perf-Trace-Util/lib/Perf/Trace/SchedGui.py | 2 +- .../python/Perf-Trace-Util/lib/Perf/Trace/Util.py | 11 +++--- tools/perf/scripts/python/sched-migration.py | 14 +--- tools/perf/tests/builtin-test.c| 2 +- .../tests/shell/record+probe_libc_inet_pton.sh | 37 +++- tools/perf/tests/shell/trace+probe_vfs_getname.sh | 2 +- tools/perf/util/llvm-utils.c | 6 ++-- .../util/scripting-engines/trace-event-python.c| 37 +--- 14 files changed, 84 insertions(+), 81 deletions(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index b5ac356ba323..f5a3b402589e 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -207,8 +207,7 @@ ifdef PYTHON_CONFIG PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil - PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) - PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS)) + PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --includes 2>/dev/null) FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) endif diff --git a/tools/perf/arch/x86/util/perf_regs.c b/tools/perf/arch/x86/util/perf_regs.c index 4b2caf6d48e7..fead6b3b4206 100644 --- a/tools/perf/arch/x86/util/perf_regs.c +++ b/tools/perf/arch/x86/util/perf_regs.c @@ -226,7 +226,7 @@ int arch_sdt_arg_parse_op(char *old_op, char **new_op) else if (rm[2].rm_so != rm[2].rm_eo) prefix[0] = '+'; else - strncpy(prefix, "+0", 2); + scnprintf(prefix, sizeof(prefix), "+0"); } /* Rename register */ diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 22547a490e1f..05be023c3f0e 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -1742,7 +1742,7 @@ static void print_interval(char *prefix, struct timespec *ts) } } - if ((num_print_interval == 0 && metric_only) || interval_clear) + if ((num_print_interval == 0 || interval_clear) && metric_only) print_metric_headers(" ", true); if (++num_print_interval == 25) num_print_interval = 0; diff --git a/tools/perf/jvmti/jvmti_agent.c b/tools/perf/jvmti/jvmti_agent.c index 0c6d1002b524..ac1bcdc17dae 100644 --- a/tools/perf/jvmti/jvmti_agent.c +++ b/tools/perf/jvmti/jvmti_agent.c @@ -35,6 +35,7 @@ #include #include /* for gettid() */ #include +#include #include "jvmti_agent.h" #include "../util/jitdump.h" @@ -249,7 +250,7 @@ void *jvmti_open(void) /* * jitdump file name */ - snprintf(dump_path, PATH_MAX, "%s/jit-%i.dump", jit_path, getpid()); + scnprintf(dump_path, PATH_MAX, "%s/jit-%i.dump", jit_path, getpid()); fd = open(dump_path, O_CREAT|O_TRUNC|O_RDWR, 0666); if (fd == -1) diff --git
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 9331510135640429711afbd0c810686100824a79 perf/core: Move inline keyword at the beginning of declaration Tooling fixes mostly, plus a build warning fix. Thanks, Ingo --> Adrian Hunter (1): perf intel-pt: Fix packet decoding of CYC packets Arnaldo Carvalho de Melo (5): tools headers uapi: Synchronize drm/drm.h perf tools: Update x86's syscall_64.tbl, adding 'io_pgetevents' and 'rseq' tools include powerpc: Update arch/powerpc/include/uapi/asm/unistd.h copy to get 'rseq' syscall tools include uapi: Update if_link.h to pick IFLA_{BRPORT_ISOLATED,VXLAN_TTL_INHERIT} tools include uapi: Synchronize bpf.h with the kernel Ingo Molnar (1): tools/headers: Pick up latest kernel ABIs Jiri Olsa (3): perf tests: Add event parsing error handling to parse events test perf tests: Add valid callback for parse-events test perf bench: Fix numa report output code Mathieu Malaterre (1): perf/core: Move inline keyword at the beginning of declaration Ravi Bangoria (3): perf script: Add missing output fields in a hint perf script: Fix crash because of missing evsel->priv perf tools: Fix crash caused by accessing feat_ops[HEADER_LAST_FEATURE] Sandipan Das (1): perf report powerpc: Fix crash if callchain is empty Thomas Richter (5): perf record: Support s390 random socket_id assignment perf test session topology: Fix test on s390 perf alias: Remove trailing newline when reading sysfs files perf alias: Rebuild alias expression string to make it comparable perf stat: Remove duplicate event counting Yonghong Song (1): perf tools: Fix a clang 7.0 compilation error kernel/events/core.c | 2 +- tools/arch/arm/include/uapi/asm/kvm.h | 1 + tools/arch/arm64/include/uapi/asm/kvm.h| 1 + tools/arch/powerpc/include/uapi/asm/kvm.h | 1 + tools/arch/powerpc/include/uapi/asm/unistd.h | 1 + tools/arch/x86/include/asm/cpufeatures.h | 2 + tools/include/uapi/drm/drm.h | 7 ++ tools/include/uapi/linux/bpf.h | 2 +- tools/include/uapi/linux/if_link.h | 2 + tools/include/uapi/linux/kvm.h | 1 + tools/perf/arch/powerpc/util/skip-callchain-idx.c | 2 +- tools/perf/arch/x86/entry/syscalls/syscall_64.tbl | 2 + tools/perf/bench/numa.c| 5 +- tools/perf/builtin-annotate.c | 11 ++- tools/perf/builtin-report.c| 3 +- tools/perf/builtin-script.c| 30 ++- tools/perf/tests/parse-events.c| 25 -- tools/perf/tests/topology.c| 1 + tools/perf/util/c++/clang.cpp | 11 ++- tools/perf/util/header.c | 12 ++- .../util/intel-pt-decoder/intel-pt-pkt-decoder.c | 2 +- tools/perf/util/pmu.c | 99 +- 22 files changed, 201 insertions(+), 22 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 80cca2b30c4f..8f0434a9951a 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -6482,7 +6482,7 @@ void perf_prepare_sample(struct perf_event_header *header, data->phys_addr = perf_virt_to_phys(data->addr); } -static void __always_inline +static __always_inline void __perf_event_output(struct perf_event *event, struct perf_sample_data *data, struct pt_regs *regs, diff --git a/tools/arch/arm/include/uapi/asm/kvm.h b/tools/arch/arm/include/uapi/asm/kvm.h index caae4843cb70..16e006f708ca 100644 --- a/tools/arch/arm/include/uapi/asm/kvm.h +++ b/tools/arch/arm/include/uapi/asm/kvm.h @@ -91,6 +91,7 @@ struct kvm_regs { #define KVM_VGIC_V3_ADDR_TYPE_DIST 2 #define KVM_VGIC_V3_ADDR_TYPE_REDIST 3 #define KVM_VGIC_ITS_ADDR_TYPE 4 +#define KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION5 #define KVM_VGIC_V3_DIST_SIZE SZ_64K #define KVM_VGIC_V3_REDIST_SIZE(2 * SZ_64K) diff --git a/tools/arch/arm64/include/uapi/asm/kvm.h b/tools/arch/arm64/include/uapi/asm/kvm.h index 04b3256f8e6d..4e76630dd655 100644 --- a/tools/arch/arm64/include/uapi/asm/kvm.h +++ b/tools/arch/arm64/include/uapi/asm/kvm.h @@ -91,6 +91,7 @@ struct kvm_regs { #define KVM_VGIC_V3_ADDR_TYPE_DIST 2 #define KVM_VGIC_V3_ADDR_TYPE_REDIST 3 #define KVM_VGIC_ITS_ADDR_TYPE 4 +#define KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION5 #define KVM_VGIC_V3_DIST_SIZE SZ_64K #define KVM_VGIC_V3_REDIST_SIZE(2 * SZ_64K) diff --git a/tools/arch/powerpc/include/uapi/asm/kvm.h b/tools/arch/powerpc/include/uapi/asm/kvm.h index
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 9331510135640429711afbd0c810686100824a79 perf/core: Move inline keyword at the beginning of declaration Tooling fixes mostly, plus a build warning fix. Thanks, Ingo --> Adrian Hunter (1): perf intel-pt: Fix packet decoding of CYC packets Arnaldo Carvalho de Melo (5): tools headers uapi: Synchronize drm/drm.h perf tools: Update x86's syscall_64.tbl, adding 'io_pgetevents' and 'rseq' tools include powerpc: Update arch/powerpc/include/uapi/asm/unistd.h copy to get 'rseq' syscall tools include uapi: Update if_link.h to pick IFLA_{BRPORT_ISOLATED,VXLAN_TTL_INHERIT} tools include uapi: Synchronize bpf.h with the kernel Ingo Molnar (1): tools/headers: Pick up latest kernel ABIs Jiri Olsa (3): perf tests: Add event parsing error handling to parse events test perf tests: Add valid callback for parse-events test perf bench: Fix numa report output code Mathieu Malaterre (1): perf/core: Move inline keyword at the beginning of declaration Ravi Bangoria (3): perf script: Add missing output fields in a hint perf script: Fix crash because of missing evsel->priv perf tools: Fix crash caused by accessing feat_ops[HEADER_LAST_FEATURE] Sandipan Das (1): perf report powerpc: Fix crash if callchain is empty Thomas Richter (5): perf record: Support s390 random socket_id assignment perf test session topology: Fix test on s390 perf alias: Remove trailing newline when reading sysfs files perf alias: Rebuild alias expression string to make it comparable perf stat: Remove duplicate event counting Yonghong Song (1): perf tools: Fix a clang 7.0 compilation error kernel/events/core.c | 2 +- tools/arch/arm/include/uapi/asm/kvm.h | 1 + tools/arch/arm64/include/uapi/asm/kvm.h| 1 + tools/arch/powerpc/include/uapi/asm/kvm.h | 1 + tools/arch/powerpc/include/uapi/asm/unistd.h | 1 + tools/arch/x86/include/asm/cpufeatures.h | 2 + tools/include/uapi/drm/drm.h | 7 ++ tools/include/uapi/linux/bpf.h | 2 +- tools/include/uapi/linux/if_link.h | 2 + tools/include/uapi/linux/kvm.h | 1 + tools/perf/arch/powerpc/util/skip-callchain-idx.c | 2 +- tools/perf/arch/x86/entry/syscalls/syscall_64.tbl | 2 + tools/perf/bench/numa.c| 5 +- tools/perf/builtin-annotate.c | 11 ++- tools/perf/builtin-report.c| 3 +- tools/perf/builtin-script.c| 30 ++- tools/perf/tests/parse-events.c| 25 -- tools/perf/tests/topology.c| 1 + tools/perf/util/c++/clang.cpp | 11 ++- tools/perf/util/header.c | 12 ++- .../util/intel-pt-decoder/intel-pt-pkt-decoder.c | 2 +- tools/perf/util/pmu.c | 99 +- 22 files changed, 201 insertions(+), 22 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 80cca2b30c4f..8f0434a9951a 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -6482,7 +6482,7 @@ void perf_prepare_sample(struct perf_event_header *header, data->phys_addr = perf_virt_to_phys(data->addr); } -static void __always_inline +static __always_inline void __perf_event_output(struct perf_event *event, struct perf_sample_data *data, struct pt_regs *regs, diff --git a/tools/arch/arm/include/uapi/asm/kvm.h b/tools/arch/arm/include/uapi/asm/kvm.h index caae4843cb70..16e006f708ca 100644 --- a/tools/arch/arm/include/uapi/asm/kvm.h +++ b/tools/arch/arm/include/uapi/asm/kvm.h @@ -91,6 +91,7 @@ struct kvm_regs { #define KVM_VGIC_V3_ADDR_TYPE_DIST 2 #define KVM_VGIC_V3_ADDR_TYPE_REDIST 3 #define KVM_VGIC_ITS_ADDR_TYPE 4 +#define KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION5 #define KVM_VGIC_V3_DIST_SIZE SZ_64K #define KVM_VGIC_V3_REDIST_SIZE(2 * SZ_64K) diff --git a/tools/arch/arm64/include/uapi/asm/kvm.h b/tools/arch/arm64/include/uapi/asm/kvm.h index 04b3256f8e6d..4e76630dd655 100644 --- a/tools/arch/arm64/include/uapi/asm/kvm.h +++ b/tools/arch/arm64/include/uapi/asm/kvm.h @@ -91,6 +91,7 @@ struct kvm_regs { #define KVM_VGIC_V3_ADDR_TYPE_DIST 2 #define KVM_VGIC_V3_ADDR_TYPE_REDIST 3 #define KVM_VGIC_ITS_ADDR_TYPE 4 +#define KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION5 #define KVM_VGIC_V3_DIST_SIZE SZ_64K #define KVM_VGIC_V3_REDIST_SIZE(2 * SZ_64K) diff --git a/tools/arch/powerpc/include/uapi/asm/kvm.h b/tools/arch/powerpc/include/uapi/asm/kvm.h index
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 4e9ae0d3d5bf4e2f1b466ba451bd18f2c5b69845 Merge tag 'perf-urgent-for-mingo-4.17-20180602' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent Leftover perf tooling fixes from the v4.17 cycle: they sync up updated ABI headers with their tooling versions. Thanks, Ingo --> Arnaldo Carvalho de Melo (4): perf trace beauty prctl: Default header_dir to cwd to work without parms tools headers: Synchronize prctl.h ABI header tools headers: Sync x86 cpufeatures.h with the kernel sources perf tools intel-pt-decoder: Update insn.h from the kernel sources tools/arch/x86/include/asm/cpufeatures.h | 20 ++-- tools/include/uapi/linux/prctl.h | 12 tools/perf/trace/beauty/prctl_option.sh | 2 +- tools/perf/util/intel-pt-decoder/insn.h | 18 ++ 4 files changed, 45 insertions(+), 7 deletions(-) diff --git a/tools/arch/x86/include/asm/cpufeatures.h b/tools/arch/x86/include/asm/cpufeatures.h index 578793e97431..fb00a2fca990 100644 --- a/tools/arch/x86/include/asm/cpufeatures.h +++ b/tools/arch/x86/include/asm/cpufeatures.h @@ -198,7 +198,6 @@ #define X86_FEATURE_CAT_L2 ( 7*32+ 5) /* Cache Allocation Technology L2 */ #define X86_FEATURE_CDP_L3 ( 7*32+ 6) /* Code and Data Prioritization L3 */ #define X86_FEATURE_INVPCID_SINGLE ( 7*32+ 7) /* Effectively INVPCID && CR4.PCIDE=1 */ - #define X86_FEATURE_HW_PSTATE ( 7*32+ 8) /* AMD HW-PState */ #define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9) /* AMD ProcFeedbackInterface */ #define X86_FEATURE_SME( 7*32+10) /* AMD Secure Memory Encryption */ @@ -207,13 +206,19 @@ #define X86_FEATURE_RETPOLINE_AMD ( 7*32+13) /* "" AMD Retpoline mitigation for Spectre variant 2 */ #define X86_FEATURE_INTEL_PPIN ( 7*32+14) /* Intel Processor Inventory Number */ #define X86_FEATURE_CDP_L2 ( 7*32+15) /* Code and Data Prioritization L2 */ - +#define X86_FEATURE_MSR_SPEC_CTRL ( 7*32+16) /* "" MSR SPEC_CTRL is implemented */ +#define X86_FEATURE_SSBD ( 7*32+17) /* Speculative Store Bypass Disable */ #define X86_FEATURE_MBA( 7*32+18) /* Memory Bandwidth Allocation */ #define X86_FEATURE_RSB_CTXSW ( 7*32+19) /* "" Fill RSB on context switches */ #define X86_FEATURE_SEV( 7*32+20) /* AMD Secure Encrypted Virtualization */ - #define X86_FEATURE_USE_IBPB ( 7*32+21) /* "" Indirect Branch Prediction Barrier enabled */ #define X86_FEATURE_USE_IBRS_FW( 7*32+22) /* "" Use IBRS during runtime firmware calls */ +#define X86_FEATURE_SPEC_STORE_BYPASS_DISABLE ( 7*32+23) /* "" Disable Speculative Store Bypass. */ +#define X86_FEATURE_LS_CFG_SSBD( 7*32+24) /* "" AMD SSBD implementation via LS_CFG MSR */ +#define X86_FEATURE_IBRS ( 7*32+25) /* Indirect Branch Restricted Speculation */ +#define X86_FEATURE_IBPB ( 7*32+26) /* Indirect Branch Prediction Barrier */ +#define X86_FEATURE_STIBP ( 7*32+27) /* Single Thread Indirect Branch Predictors */ +#define X86_FEATURE_ZEN( 7*32+28) /* "" CPU is AMD family 0x17 (Zen) */ /* Virtualization flags: Linux defined, word 8 */ #define X86_FEATURE_TPR_SHADOW ( 8*32+ 0) /* Intel TPR Shadow */ @@ -274,9 +279,10 @@ #define X86_FEATURE_CLZERO (13*32+ 0) /* CLZERO instruction */ #define X86_FEATURE_IRPERF (13*32+ 1) /* Instructions Retired Count */ #define X86_FEATURE_XSAVEERPTR (13*32+ 2) /* Always save/restore FP error pointers */ -#define X86_FEATURE_IBPB (13*32+12) /* Indirect Branch Prediction Barrier */ -#define X86_FEATURE_IBRS (13*32+14) /* Indirect Branch Restricted Speculation */ -#define X86_FEATURE_STIBP (13*32+15) /* Single Thread Indirect Branch Predictors */ +#define X86_FEATURE_AMD_IBPB (13*32+12) /* "" Indirect Branch Prediction Barrier */ +#define X86_FEATURE_AMD_IBRS (13*32+14) /* "" Indirect Branch Restricted Speculation */ +#define X86_FEATURE_AMD_STIBP (13*32+15) /* "" Single Thread Indirect Branch Predictors */ +#define X86_FEATURE_VIRT_SSBD (13*32+25) /* Virtualized Speculative Store Bypass Disable */ /* Thermal and Power Management Leaf, CPUID level 0x0006 (EAX), word 14 */ #define X86_FEATURE_DTHERM (14*32+ 0) /* Digital Thermal Sensor */ @@ -334,6 +340,7 @@ #define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */ #define X86_FEATURE_INTEL_STIBP(18*32+27) /* "" Single Thread Indirect Branch Predictors */ #define X86_FEATURE_ARCH_CAPABILITIES (18*32+29) /*
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 4e9ae0d3d5bf4e2f1b466ba451bd18f2c5b69845 Merge tag 'perf-urgent-for-mingo-4.17-20180602' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent Leftover perf tooling fixes from the v4.17 cycle: they sync up updated ABI headers with their tooling versions. Thanks, Ingo --> Arnaldo Carvalho de Melo (4): perf trace beauty prctl: Default header_dir to cwd to work without parms tools headers: Synchronize prctl.h ABI header tools headers: Sync x86 cpufeatures.h with the kernel sources perf tools intel-pt-decoder: Update insn.h from the kernel sources tools/arch/x86/include/asm/cpufeatures.h | 20 ++-- tools/include/uapi/linux/prctl.h | 12 tools/perf/trace/beauty/prctl_option.sh | 2 +- tools/perf/util/intel-pt-decoder/insn.h | 18 ++ 4 files changed, 45 insertions(+), 7 deletions(-) diff --git a/tools/arch/x86/include/asm/cpufeatures.h b/tools/arch/x86/include/asm/cpufeatures.h index 578793e97431..fb00a2fca990 100644 --- a/tools/arch/x86/include/asm/cpufeatures.h +++ b/tools/arch/x86/include/asm/cpufeatures.h @@ -198,7 +198,6 @@ #define X86_FEATURE_CAT_L2 ( 7*32+ 5) /* Cache Allocation Technology L2 */ #define X86_FEATURE_CDP_L3 ( 7*32+ 6) /* Code and Data Prioritization L3 */ #define X86_FEATURE_INVPCID_SINGLE ( 7*32+ 7) /* Effectively INVPCID && CR4.PCIDE=1 */ - #define X86_FEATURE_HW_PSTATE ( 7*32+ 8) /* AMD HW-PState */ #define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9) /* AMD ProcFeedbackInterface */ #define X86_FEATURE_SME( 7*32+10) /* AMD Secure Memory Encryption */ @@ -207,13 +206,19 @@ #define X86_FEATURE_RETPOLINE_AMD ( 7*32+13) /* "" AMD Retpoline mitigation for Spectre variant 2 */ #define X86_FEATURE_INTEL_PPIN ( 7*32+14) /* Intel Processor Inventory Number */ #define X86_FEATURE_CDP_L2 ( 7*32+15) /* Code and Data Prioritization L2 */ - +#define X86_FEATURE_MSR_SPEC_CTRL ( 7*32+16) /* "" MSR SPEC_CTRL is implemented */ +#define X86_FEATURE_SSBD ( 7*32+17) /* Speculative Store Bypass Disable */ #define X86_FEATURE_MBA( 7*32+18) /* Memory Bandwidth Allocation */ #define X86_FEATURE_RSB_CTXSW ( 7*32+19) /* "" Fill RSB on context switches */ #define X86_FEATURE_SEV( 7*32+20) /* AMD Secure Encrypted Virtualization */ - #define X86_FEATURE_USE_IBPB ( 7*32+21) /* "" Indirect Branch Prediction Barrier enabled */ #define X86_FEATURE_USE_IBRS_FW( 7*32+22) /* "" Use IBRS during runtime firmware calls */ +#define X86_FEATURE_SPEC_STORE_BYPASS_DISABLE ( 7*32+23) /* "" Disable Speculative Store Bypass. */ +#define X86_FEATURE_LS_CFG_SSBD( 7*32+24) /* "" AMD SSBD implementation via LS_CFG MSR */ +#define X86_FEATURE_IBRS ( 7*32+25) /* Indirect Branch Restricted Speculation */ +#define X86_FEATURE_IBPB ( 7*32+26) /* Indirect Branch Prediction Barrier */ +#define X86_FEATURE_STIBP ( 7*32+27) /* Single Thread Indirect Branch Predictors */ +#define X86_FEATURE_ZEN( 7*32+28) /* "" CPU is AMD family 0x17 (Zen) */ /* Virtualization flags: Linux defined, word 8 */ #define X86_FEATURE_TPR_SHADOW ( 8*32+ 0) /* Intel TPR Shadow */ @@ -274,9 +279,10 @@ #define X86_FEATURE_CLZERO (13*32+ 0) /* CLZERO instruction */ #define X86_FEATURE_IRPERF (13*32+ 1) /* Instructions Retired Count */ #define X86_FEATURE_XSAVEERPTR (13*32+ 2) /* Always save/restore FP error pointers */ -#define X86_FEATURE_IBPB (13*32+12) /* Indirect Branch Prediction Barrier */ -#define X86_FEATURE_IBRS (13*32+14) /* Indirect Branch Restricted Speculation */ -#define X86_FEATURE_STIBP (13*32+15) /* Single Thread Indirect Branch Predictors */ +#define X86_FEATURE_AMD_IBPB (13*32+12) /* "" Indirect Branch Prediction Barrier */ +#define X86_FEATURE_AMD_IBRS (13*32+14) /* "" Indirect Branch Restricted Speculation */ +#define X86_FEATURE_AMD_STIBP (13*32+15) /* "" Single Thread Indirect Branch Predictors */ +#define X86_FEATURE_VIRT_SSBD (13*32+25) /* Virtualized Speculative Store Bypass Disable */ /* Thermal and Power Management Leaf, CPUID level 0x0006 (EAX), word 14 */ #define X86_FEATURE_DTHERM (14*32+ 0) /* Digital Thermal Sensor */ @@ -334,6 +340,7 @@ #define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */ #define X86_FEATURE_INTEL_STIBP(18*32+27) /* "" Single Thread Indirect Branch Predictors */ #define X86_FEATURE_ARCH_CAPABILITIES (18*32+29) /*
[GIT pull] perf fixes for 4.17
Linus, please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus A set of fixes for perf tooling: - Fix 'perf test Session topology' segfault on s390 (Thomas Richter) - Fix NULL return handling in bpf__prepare_load() (YueHaibing) - Fix indexing on Coresight ETM packet queue decoder (Mathieu Poirier) - Fix perf.data format description of NRCPUS header (Arnaldo Carvalho de Melo) - Update perf.data documentation section on cpu topology - Handle uncore event aliases in small groups properly (Kan Liang) - Add missing perf_sample.addr into python sample dictionary (Leo Yan) Thanks, tglx --> Arnaldo Carvalho de Melo (1): perf tools: Fix perf.data format description of NRCPUS header Kan Liang (1): perf parse-events: Handle uncore event aliases in small groups properly Leo Yan (1): perf script python: Add addr into perf sample dict Mathieu Poirier (1): perf cs-etm: Fix indexing for decoder packet queue Thomas Richter (2): perf test: "Session topology" dumps core on s390 perf data: Update documentation section on cpu topology YueHaibing (1): perf bpf: Fix NULL return handling in bpf__prepare_load() tools/perf/Documentation/perf.data-file-format.txt | 10 +- tools/perf/tests/topology.c| 30 - tools/perf/util/bpf-loader.c | 6 +- tools/perf/util/cs-etm-decoder/cs-etm-decoder.c| 12 +- tools/perf/util/evsel.h| 1 + tools/perf/util/parse-events.c | 130 - tools/perf/util/parse-events.h | 7 +- tools/perf/util/parse-events.y | 8 +- .../util/scripting-engines/trace-event-python.c| 2 + 9 files changed, 185 insertions(+), 21 deletions(-) diff --git a/tools/perf/Documentation/perf.data-file-format.txt b/tools/perf/Documentation/perf.data-file-format.txt index d00f0d51cab8..dfb218feaad9 100644 --- a/tools/perf/Documentation/perf.data-file-format.txt +++ b/tools/perf/Documentation/perf.data-file-format.txt @@ -111,8 +111,8 @@ A perf_header_string with the CPU architecture (uname -m) A structure defining the number of CPUs. struct nr_cpus { - uint32_t nr_cpus_online; uint32_t nr_cpus_available; /* CPUs not yet onlined */ + uint32_t nr_cpus_online; }; HEADER_CPUDESC = 8, @@ -153,10 +153,18 @@ struct { HEADER_CPU_TOPOLOGY = 13, String lists defining the core and CPU threads topology. +The string lists are followed by a variable length array +which contains core_id and socket_id of each cpu. +The number of entries can be determined by the size of the +section minus the sizes of both string lists. struct { struct perf_header_string_list cores; /* Variable length */ struct perf_header_string_list threads; /* Variable length */ + struct { + uint32_t core_id; + uint32_t socket_id; + } cpus[nr]; /* Variable length records */ }; Example: diff --git a/tools/perf/tests/topology.c b/tools/perf/tests/topology.c index 17cb1bb3448c..40e30a26b23c 100644 --- a/tools/perf/tests/topology.c +++ b/tools/perf/tests/topology.c @@ -70,6 +70,27 @@ static int check_cpu_topology(char *path, struct cpu_map *map) session = perf_session__new(, false, NULL); TEST_ASSERT_VAL("can't get session", session); + /* On platforms with large numbers of CPUs process_cpu_topology() +* might issue an error while reading the perf.data file section +* HEADER_CPU_TOPOLOGY and the cpu_topology_map pointed to by member +* cpu is a NULL pointer. +* Example: On s390 +* CPU 0 is on core_id 0 and physical_package_id 6 +* CPU 1 is on core_id 1 and physical_package_id 3 +* +* Core_id and physical_package_id are platform and architecture +* dependend and might have higher numbers than the CPU id. +* This actually depends on the configuration. +* +* In this case process_cpu_topology() prints error message: +* "socket_id number is too big. You may need to upgrade the +* perf tool." +* +* This is the reason why this test might be skipped. +*/ + if (!session->header.env.cpu) + return TEST_SKIP; + for (i = 0; i < session->header.env.nr_cpus_avail; i++) { if (!cpu_map__has(map, i)) continue; @@ -95,7 +116,7 @@ int test__session_topology(struct test *test __maybe_unused, int subtest __maybe { char path[PATH_MAX]; struct cpu_map *map; - int ret = -1; + int ret = TEST_FAIL; TEST_ASSERT_VAL("can't get templ file", !get_temp(path)); @@ -110,12 +131,9 @@ int test__session_topology(struct test *test
[GIT pull] perf fixes for 4.17
Linus, please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus A set of fixes for perf tooling: - Fix 'perf test Session topology' segfault on s390 (Thomas Richter) - Fix NULL return handling in bpf__prepare_load() (YueHaibing) - Fix indexing on Coresight ETM packet queue decoder (Mathieu Poirier) - Fix perf.data format description of NRCPUS header (Arnaldo Carvalho de Melo) - Update perf.data documentation section on cpu topology - Handle uncore event aliases in small groups properly (Kan Liang) - Add missing perf_sample.addr into python sample dictionary (Leo Yan) Thanks, tglx --> Arnaldo Carvalho de Melo (1): perf tools: Fix perf.data format description of NRCPUS header Kan Liang (1): perf parse-events: Handle uncore event aliases in small groups properly Leo Yan (1): perf script python: Add addr into perf sample dict Mathieu Poirier (1): perf cs-etm: Fix indexing for decoder packet queue Thomas Richter (2): perf test: "Session topology" dumps core on s390 perf data: Update documentation section on cpu topology YueHaibing (1): perf bpf: Fix NULL return handling in bpf__prepare_load() tools/perf/Documentation/perf.data-file-format.txt | 10 +- tools/perf/tests/topology.c| 30 - tools/perf/util/bpf-loader.c | 6 +- tools/perf/util/cs-etm-decoder/cs-etm-decoder.c| 12 +- tools/perf/util/evsel.h| 1 + tools/perf/util/parse-events.c | 130 - tools/perf/util/parse-events.h | 7 +- tools/perf/util/parse-events.y | 8 +- .../util/scripting-engines/trace-event-python.c| 2 + 9 files changed, 185 insertions(+), 21 deletions(-) diff --git a/tools/perf/Documentation/perf.data-file-format.txt b/tools/perf/Documentation/perf.data-file-format.txt index d00f0d51cab8..dfb218feaad9 100644 --- a/tools/perf/Documentation/perf.data-file-format.txt +++ b/tools/perf/Documentation/perf.data-file-format.txt @@ -111,8 +111,8 @@ A perf_header_string with the CPU architecture (uname -m) A structure defining the number of CPUs. struct nr_cpus { - uint32_t nr_cpus_online; uint32_t nr_cpus_available; /* CPUs not yet onlined */ + uint32_t nr_cpus_online; }; HEADER_CPUDESC = 8, @@ -153,10 +153,18 @@ struct { HEADER_CPU_TOPOLOGY = 13, String lists defining the core and CPU threads topology. +The string lists are followed by a variable length array +which contains core_id and socket_id of each cpu. +The number of entries can be determined by the size of the +section minus the sizes of both string lists. struct { struct perf_header_string_list cores; /* Variable length */ struct perf_header_string_list threads; /* Variable length */ + struct { + uint32_t core_id; + uint32_t socket_id; + } cpus[nr]; /* Variable length records */ }; Example: diff --git a/tools/perf/tests/topology.c b/tools/perf/tests/topology.c index 17cb1bb3448c..40e30a26b23c 100644 --- a/tools/perf/tests/topology.c +++ b/tools/perf/tests/topology.c @@ -70,6 +70,27 @@ static int check_cpu_topology(char *path, struct cpu_map *map) session = perf_session__new(, false, NULL); TEST_ASSERT_VAL("can't get session", session); + /* On platforms with large numbers of CPUs process_cpu_topology() +* might issue an error while reading the perf.data file section +* HEADER_CPU_TOPOLOGY and the cpu_topology_map pointed to by member +* cpu is a NULL pointer. +* Example: On s390 +* CPU 0 is on core_id 0 and physical_package_id 6 +* CPU 1 is on core_id 1 and physical_package_id 3 +* +* Core_id and physical_package_id are platform and architecture +* dependend and might have higher numbers than the CPU id. +* This actually depends on the configuration. +* +* In this case process_cpu_topology() prints error message: +* "socket_id number is too big. You may need to upgrade the +* perf tool." +* +* This is the reason why this test might be skipped. +*/ + if (!session->header.env.cpu) + return TEST_SKIP; + for (i = 0; i < session->header.env.nr_cpus_avail; i++) { if (!cpu_map__has(map, i)) continue; @@ -95,7 +116,7 @@ int test__session_topology(struct test *test __maybe_unused, int subtest __maybe { char path[PATH_MAX]; struct cpu_map *map; - int ret = -1; + int ret = TEST_FAIL; TEST_ASSERT_VAL("can't get templ file", !get_temp(path)); @@ -110,12 +131,9 @@ int test__session_topology(struct test *test
[GIT pull] perf fixes for 4.17
Linus, please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus Address issues on the perf tooling side: - Fix segfault when processing unknown threads in cs-etm - Fix "perf test inet_pton" on s390 failing due to missing inline - Display all available events on 'perf annotate --stdio' - Add missing newline when parsing an empty BPF program Thanks, tglx --> Arnaldo Carvalho de Melo (1): perf tools: Add missing newline when parsing empty BPF proggie Jin Yao (1): perf annotate: Display all available events on --stdio Leo Yan (2): perf cs-etm: Support unknown_thread in cs_etm_auxtrace perf cs-etm: Remove redundant space Thomas Richter (1): perf test: "probe libc's inet_pton" fails on s390 due to missing inline .../tests/shell/record+probe_libc_inet_pton.sh | 2 +- tools/perf/util/annotate.c | 3 +++ tools/perf/util/cs-etm.c | 28 ++ tools/perf/util/parse-events.c | 2 +- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh index 016882dbbc16..ee86473643be 100755 --- a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh +++ b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh @@ -16,7 +16,7 @@ nm -g $libc 2>/dev/null | fgrep -q inet_pton || exit 254 trace_libc_inet_pton_backtrace() { idx=0 expected[0]="ping[][0-9 \.:]+probe_libc:inet_pton: \([[:xdigit:]]+\)" - expected[1]=".*inet_pton[[:space:]]\($libc\)$" + expected[1]=".*inet_pton[[:space:]]\($libc|inlined\)$" case "$(uname -m)" in s390x) eventattr='call-graph=dwarf,max-stack=4' diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 536ee148bff8..5d74a30fe00f 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -1263,6 +1263,9 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 start max_percent = sample->percent; } + if (al->samples_nr > nr_percent) + nr_percent = al->samples_nr; + if (max_percent < min_pcnt) return -1; diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 40020b1ca54f..bf16dc9ee507 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -239,6 +239,7 @@ static void cs_etm__free(struct perf_session *session) for (i = 0; i < aux->num_cpu; i++) zfree(>metadata[i]); + thread__zput(aux->unknown_thread); zfree(>metadata); zfree(); } @@ -612,8 +613,8 @@ cs_etm__get_trace(struct cs_etm_buffer *buff, struct cs_etm_queue *etmq) return buff->len; } -static void cs_etm__set_pid_tid_cpu(struct cs_etm_auxtrace *etm, -struct auxtrace_queue *queue) +static void cs_etm__set_pid_tid_cpu(struct cs_etm_auxtrace *etm, + struct auxtrace_queue *queue) { struct cs_etm_queue *etmq = queue->priv; @@ -1357,6 +1358,23 @@ int cs_etm__process_auxtrace_info(union perf_event *event, etm->auxtrace.free = cs_etm__free; session->auxtrace = >auxtrace; + etm->unknown_thread = thread__new(9, 9); + if (!etm->unknown_thread) + goto err_free_queues; + + /* +* Initialize list node so that at thread__zput() we can avoid +* segmentation fault at list_del_init(). +*/ + INIT_LIST_HEAD(>unknown_thread->node); + + err = thread__set_comm(etm->unknown_thread, "unknown", 0); + if (err) + goto err_delete_thread; + + if (thread__init_map_groups(etm->unknown_thread, etm->machine)) + goto err_delete_thread; + if (dump_trace) { cs_etm__print_auxtrace_info(auxtrace_info->priv, num_cpu); return 0; @@ -1371,16 +1389,18 @@ int cs_etm__process_auxtrace_info(union perf_event *event, err = cs_etm__synth_events(etm, session); if (err) - goto err_free_queues; + goto err_delete_thread; err = auxtrace_queues__process_index(>queues, session); if (err) - goto err_free_queues; + goto err_delete_thread; etm->data_queued = etm->queues.populated; return 0; +err_delete_thread: + thread__zput(etm->unknown_thread); err_free_queues: auxtrace_queues__free(>queues); session->auxtrace = NULL; diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 2fb0272146d8..b8b8a9558d32 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@
[GIT pull] perf fixes for 4.17
Linus, please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus Address issues on the perf tooling side: - Fix segfault when processing unknown threads in cs-etm - Fix "perf test inet_pton" on s390 failing due to missing inline - Display all available events on 'perf annotate --stdio' - Add missing newline when parsing an empty BPF program Thanks, tglx --> Arnaldo Carvalho de Melo (1): perf tools: Add missing newline when parsing empty BPF proggie Jin Yao (1): perf annotate: Display all available events on --stdio Leo Yan (2): perf cs-etm: Support unknown_thread in cs_etm_auxtrace perf cs-etm: Remove redundant space Thomas Richter (1): perf test: "probe libc's inet_pton" fails on s390 due to missing inline .../tests/shell/record+probe_libc_inet_pton.sh | 2 +- tools/perf/util/annotate.c | 3 +++ tools/perf/util/cs-etm.c | 28 ++ tools/perf/util/parse-events.c | 2 +- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh index 016882dbbc16..ee86473643be 100755 --- a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh +++ b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh @@ -16,7 +16,7 @@ nm -g $libc 2>/dev/null | fgrep -q inet_pton || exit 254 trace_libc_inet_pton_backtrace() { idx=0 expected[0]="ping[][0-9 \.:]+probe_libc:inet_pton: \([[:xdigit:]]+\)" - expected[1]=".*inet_pton[[:space:]]\($libc\)$" + expected[1]=".*inet_pton[[:space:]]\($libc|inlined\)$" case "$(uname -m)" in s390x) eventattr='call-graph=dwarf,max-stack=4' diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 536ee148bff8..5d74a30fe00f 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -1263,6 +1263,9 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 start max_percent = sample->percent; } + if (al->samples_nr > nr_percent) + nr_percent = al->samples_nr; + if (max_percent < min_pcnt) return -1; diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 40020b1ca54f..bf16dc9ee507 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -239,6 +239,7 @@ static void cs_etm__free(struct perf_session *session) for (i = 0; i < aux->num_cpu; i++) zfree(>metadata[i]); + thread__zput(aux->unknown_thread); zfree(>metadata); zfree(); } @@ -612,8 +613,8 @@ cs_etm__get_trace(struct cs_etm_buffer *buff, struct cs_etm_queue *etmq) return buff->len; } -static void cs_etm__set_pid_tid_cpu(struct cs_etm_auxtrace *etm, -struct auxtrace_queue *queue) +static void cs_etm__set_pid_tid_cpu(struct cs_etm_auxtrace *etm, + struct auxtrace_queue *queue) { struct cs_etm_queue *etmq = queue->priv; @@ -1357,6 +1358,23 @@ int cs_etm__process_auxtrace_info(union perf_event *event, etm->auxtrace.free = cs_etm__free; session->auxtrace = >auxtrace; + etm->unknown_thread = thread__new(9, 9); + if (!etm->unknown_thread) + goto err_free_queues; + + /* +* Initialize list node so that at thread__zput() we can avoid +* segmentation fault at list_del_init(). +*/ + INIT_LIST_HEAD(>unknown_thread->node); + + err = thread__set_comm(etm->unknown_thread, "unknown", 0); + if (err) + goto err_delete_thread; + + if (thread__init_map_groups(etm->unknown_thread, etm->machine)) + goto err_delete_thread; + if (dump_trace) { cs_etm__print_auxtrace_info(auxtrace_info->priv, num_cpu); return 0; @@ -1371,16 +1389,18 @@ int cs_etm__process_auxtrace_info(union perf_event *event, err = cs_etm__synth_events(etm, session); if (err) - goto err_free_queues; + goto err_delete_thread; err = auxtrace_queues__process_index(>queues, session); if (err) - goto err_free_queues; + goto err_delete_thread; etm->data_queued = etm->queues.populated; return 0; +err_delete_thread: + thread__zput(etm->unknown_thread); err_free_queues: auxtrace_queues__free(>queues); session->auxtrace = NULL; diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 2fb0272146d8..b8b8a9558d32 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@
[GIT pull] perf fixes for 4.17
Linus, please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus Another small set of perf tooling fixes and updates: . Revert "perf pmu: Fix pmu events parsing rule", as it broke Intel PT event description parsing (Arnaldo Carvalho de Melo) . Sync x86's cpufeatures.h and kvm UAPI headers with the kernel sources, suppressing the ABI drift warnings (Arnaldo Carvalho de Melo) - Remove duplicated entry for westmereep-dp in Intel's mapfile.csv (William Cohen) - Fix typo in 'perf bench numa' options description (Yisheng Xie) Thanks, tglx --> Arnaldo Carvalho de Melo (4): tools headers: Sync x86 cpufeatures.h with the kernel sources tools headers kvm: Sync uapi/linux/kvm.h with the kernel sources tools headers kvm: Sync ARM UAPI headers with the kernel sources Revert "perf pmu: Fix pmu events parsing rule" William Cohen (1): perf vendor events intel: Remove duplicated entry for westmereep-dp in mapfile.csv Yisheng Xie (1): perf bench numa: Fix typo in options tools/arch/arm/include/uapi/asm/kvm.h | 6 ++ tools/arch/arm64/include/uapi/asm/kvm.h| 6 ++ tools/arch/x86/include/asm/cpufeatures.h | 1 + tools/include/uapi/linux/kvm.h | 7 +++ tools/perf/bench/numa.c| 2 +- tools/perf/pmu-events/arch/x86/mapfile.csv | 1 - tools/perf/util/parse-events.y | 8 7 files changed, 25 insertions(+), 6 deletions(-) diff --git a/tools/arch/arm/include/uapi/asm/kvm.h b/tools/arch/arm/include/uapi/asm/kvm.h index 2ba95d6fe852..caae4843cb70 100644 --- a/tools/arch/arm/include/uapi/asm/kvm.h +++ b/tools/arch/arm/include/uapi/asm/kvm.h @@ -195,6 +195,12 @@ struct kvm_arch_memory_slot { #define KVM_REG_ARM_VFP_FPINST 0x1009 #define KVM_REG_ARM_VFP_FPINST20x100A +/* KVM-as-firmware specific pseudo-registers */ +#define KVM_REG_ARM_FW (0x0014 << KVM_REG_ARM_COPROC_SHIFT) +#define KVM_REG_ARM_FW_REG(r) (KVM_REG_ARM | KVM_REG_SIZE_U64 | \ +KVM_REG_ARM_FW | ((r) & 0x)) +#define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0) + /* Device Control API: ARM VGIC */ #define KVM_DEV_ARM_VGIC_GRP_ADDR 0 #define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1 diff --git a/tools/arch/arm64/include/uapi/asm/kvm.h b/tools/arch/arm64/include/uapi/asm/kvm.h index 9abbf3044654..04b3256f8e6d 100644 --- a/tools/arch/arm64/include/uapi/asm/kvm.h +++ b/tools/arch/arm64/include/uapi/asm/kvm.h @@ -206,6 +206,12 @@ struct kvm_arch_memory_slot { #define KVM_REG_ARM_TIMER_CNT ARM64_SYS_REG(3, 3, 14, 3, 2) #define KVM_REG_ARM_TIMER_CVAL ARM64_SYS_REG(3, 3, 14, 0, 2) +/* KVM-as-firmware specific pseudo-registers */ +#define KVM_REG_ARM_FW (0x0014 << KVM_REG_ARM_COPROC_SHIFT) +#define KVM_REG_ARM_FW_REG(r) (KVM_REG_ARM64 | KVM_REG_SIZE_U64 | \ +KVM_REG_ARM_FW | ((r) & 0x)) +#define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0) + /* Device Control API: ARM VGIC */ #define KVM_DEV_ARM_VGIC_GRP_ADDR 0 #define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1 diff --git a/tools/arch/x86/include/asm/cpufeatures.h b/tools/arch/x86/include/asm/cpufeatures.h index d554c11e01ff..578793e97431 100644 --- a/tools/arch/x86/include/asm/cpufeatures.h +++ b/tools/arch/x86/include/asm/cpufeatures.h @@ -320,6 +320,7 @@ #define X86_FEATURE_AVX512_VPOPCNTDQ (16*32+14) /* POPCNT for vectors of DW/QW */ #define X86_FEATURE_LA57 (16*32+16) /* 5-level page tables */ #define X86_FEATURE_RDPID (16*32+22) /* RDPID instruction */ +#define X86_FEATURE_CLDEMOTE (16*32+25) /* CLDEMOTE instruction */ /* AMD-defined CPU features, CPUID level 0x8007 (EBX), word 17 */ #define X86_FEATURE_OVERFLOW_RECOV (17*32+ 0) /* MCA overflow recovery support */ diff --git a/tools/include/uapi/linux/kvm.h b/tools/include/uapi/linux/kvm.h index 1065006c9bf5..b02c41e53d56 100644 --- a/tools/include/uapi/linux/kvm.h +++ b/tools/include/uapi/linux/kvm.h @@ -676,6 +676,13 @@ struct kvm_ioeventfd { __u8 pad[36]; }; +#define KVM_X86_DISABLE_EXITS_MWAIT (1 << 0) +#define KVM_X86_DISABLE_EXITS_HTL(1 << 1) +#define KVM_X86_DISABLE_EXITS_PAUSE (1 << 2) +#define KVM_X86_DISABLE_VALID_EXITS (KVM_X86_DISABLE_EXITS_MWAIT | \ + KVM_X86_DISABLE_EXITS_HTL | \ + KVM_X86_DISABLE_EXITS_PAUSE) + /* for KVM_ENABLE_CAP */ struct kvm_enable_cap { /* in */ diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c index 944070e98a2c..63eb49082774 100644 --- a/tools/perf/bench/numa.c +++ b/tools/perf/bench/numa.c @@ -175,7 +175,7 @@ static const struct option options[] = {
[GIT pull] perf fixes for 4.17
Linus, please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus Another small set of perf tooling fixes and updates: . Revert "perf pmu: Fix pmu events parsing rule", as it broke Intel PT event description parsing (Arnaldo Carvalho de Melo) . Sync x86's cpufeatures.h and kvm UAPI headers with the kernel sources, suppressing the ABI drift warnings (Arnaldo Carvalho de Melo) - Remove duplicated entry for westmereep-dp in Intel's mapfile.csv (William Cohen) - Fix typo in 'perf bench numa' options description (Yisheng Xie) Thanks, tglx --> Arnaldo Carvalho de Melo (4): tools headers: Sync x86 cpufeatures.h with the kernel sources tools headers kvm: Sync uapi/linux/kvm.h with the kernel sources tools headers kvm: Sync ARM UAPI headers with the kernel sources Revert "perf pmu: Fix pmu events parsing rule" William Cohen (1): perf vendor events intel: Remove duplicated entry for westmereep-dp in mapfile.csv Yisheng Xie (1): perf bench numa: Fix typo in options tools/arch/arm/include/uapi/asm/kvm.h | 6 ++ tools/arch/arm64/include/uapi/asm/kvm.h| 6 ++ tools/arch/x86/include/asm/cpufeatures.h | 1 + tools/include/uapi/linux/kvm.h | 7 +++ tools/perf/bench/numa.c| 2 +- tools/perf/pmu-events/arch/x86/mapfile.csv | 1 - tools/perf/util/parse-events.y | 8 7 files changed, 25 insertions(+), 6 deletions(-) diff --git a/tools/arch/arm/include/uapi/asm/kvm.h b/tools/arch/arm/include/uapi/asm/kvm.h index 2ba95d6fe852..caae4843cb70 100644 --- a/tools/arch/arm/include/uapi/asm/kvm.h +++ b/tools/arch/arm/include/uapi/asm/kvm.h @@ -195,6 +195,12 @@ struct kvm_arch_memory_slot { #define KVM_REG_ARM_VFP_FPINST 0x1009 #define KVM_REG_ARM_VFP_FPINST20x100A +/* KVM-as-firmware specific pseudo-registers */ +#define KVM_REG_ARM_FW (0x0014 << KVM_REG_ARM_COPROC_SHIFT) +#define KVM_REG_ARM_FW_REG(r) (KVM_REG_ARM | KVM_REG_SIZE_U64 | \ +KVM_REG_ARM_FW | ((r) & 0x)) +#define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0) + /* Device Control API: ARM VGIC */ #define KVM_DEV_ARM_VGIC_GRP_ADDR 0 #define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1 diff --git a/tools/arch/arm64/include/uapi/asm/kvm.h b/tools/arch/arm64/include/uapi/asm/kvm.h index 9abbf3044654..04b3256f8e6d 100644 --- a/tools/arch/arm64/include/uapi/asm/kvm.h +++ b/tools/arch/arm64/include/uapi/asm/kvm.h @@ -206,6 +206,12 @@ struct kvm_arch_memory_slot { #define KVM_REG_ARM_TIMER_CNT ARM64_SYS_REG(3, 3, 14, 3, 2) #define KVM_REG_ARM_TIMER_CVAL ARM64_SYS_REG(3, 3, 14, 0, 2) +/* KVM-as-firmware specific pseudo-registers */ +#define KVM_REG_ARM_FW (0x0014 << KVM_REG_ARM_COPROC_SHIFT) +#define KVM_REG_ARM_FW_REG(r) (KVM_REG_ARM64 | KVM_REG_SIZE_U64 | \ +KVM_REG_ARM_FW | ((r) & 0x)) +#define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0) + /* Device Control API: ARM VGIC */ #define KVM_DEV_ARM_VGIC_GRP_ADDR 0 #define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1 diff --git a/tools/arch/x86/include/asm/cpufeatures.h b/tools/arch/x86/include/asm/cpufeatures.h index d554c11e01ff..578793e97431 100644 --- a/tools/arch/x86/include/asm/cpufeatures.h +++ b/tools/arch/x86/include/asm/cpufeatures.h @@ -320,6 +320,7 @@ #define X86_FEATURE_AVX512_VPOPCNTDQ (16*32+14) /* POPCNT for vectors of DW/QW */ #define X86_FEATURE_LA57 (16*32+16) /* 5-level page tables */ #define X86_FEATURE_RDPID (16*32+22) /* RDPID instruction */ +#define X86_FEATURE_CLDEMOTE (16*32+25) /* CLDEMOTE instruction */ /* AMD-defined CPU features, CPUID level 0x8007 (EBX), word 17 */ #define X86_FEATURE_OVERFLOW_RECOV (17*32+ 0) /* MCA overflow recovery support */ diff --git a/tools/include/uapi/linux/kvm.h b/tools/include/uapi/linux/kvm.h index 1065006c9bf5..b02c41e53d56 100644 --- a/tools/include/uapi/linux/kvm.h +++ b/tools/include/uapi/linux/kvm.h @@ -676,6 +676,13 @@ struct kvm_ioeventfd { __u8 pad[36]; }; +#define KVM_X86_DISABLE_EXITS_MWAIT (1 << 0) +#define KVM_X86_DISABLE_EXITS_HTL(1 << 1) +#define KVM_X86_DISABLE_EXITS_PAUSE (1 << 2) +#define KVM_X86_DISABLE_VALID_EXITS (KVM_X86_DISABLE_EXITS_MWAIT | \ + KVM_X86_DISABLE_EXITS_HTL | \ + KVM_X86_DISABLE_EXITS_PAUSE) + /* for KVM_ENABLE_CAP */ struct kvm_enable_cap { /* in */ diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c index 944070e98a2c..63eb49082774 100644 --- a/tools/perf/bench/numa.c +++ b/tools/perf/bench/numa.c @@ -175,7 +175,7 @@ static const struct option options[] = {
[GIT pull] perf fixes for 4.17
Linus, please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus A larger set of updates for perf: - Kernel: - Handle the SBOX uncore monitoring correctly on Broadwell CPUs which do not have SBOX. - Store context switch out type in PERF_RECORD_SWITCH[_CPU_WIDE]. The percentage of preempting and non-preempting context switches help understanding the nature of workloads (CPU or IO bound) that are running on a machine. This adds the kernel facility and userspace changes needed to show this information in 'perf script' and 'perf report -D' (Alexey Budankov) - Remove a WARN_ON() in the trace/kprobes code which is pointless because the return error code is already telling the caller what's wrong. - Revert a fugly workaround for clang BPF targets. - Fix sample_max_stack maximum check and do not proceed when an error has been detect, return them to avoid misidentifying errors (Jiri Olsa) - Add SPDX idenitifiers and get rid of GPL boilderplate. - Tools: - Synchronize kernel ABI headers, v4.17-rc1 (Ingo Molnar) - Support MAP_FIXED_NOREPLACE, noticed when updating the tools/include/ copies (Arnaldo Carvalho de Melo) - Add '\n' at the end of parse-options error messages (Ravi Bangoria) - Add s390 support for detailed/verbose PMU event description (Thomas Richter) - perf annotate fixes and improvements: - Allow showing offsets in more than just jump targets, use the new 'O' hotkey in the TUI, config ~/.perfconfig annotate.offset_level for it and for --stdio2 (Arnaldo Carvalho de Melo) - Use the resolved variable names from objdump disassembled lines to make them more compact, just like was already done for some instructions, like "mov", this eventually will be done more generally, but lets now add some more to the existing mechanism (Arnaldo Carvalho de Melo) - perf record fixes: - Change warning for missing topology sysfs entry to debug, as not all architectures have those files, s390 being one of those (Thomas Richter) - Remove old error messages about things that unlikely to be the root cause in modern systems (Andi Kleen) - perf sched fixes: - Fix -g/--call-graph documentation (Takuya Yamamoto) - perf stat: - Enable 1ms interval for printing event counters values in (Alexey Budankov) - perf test fixes: - Run dwarf unwind on arm32 (Kim Phillips) - Remove unused ptrace.h include from LLVM test, sidesteping older clang's lack of support for some asm constructs (Arnaldo Carvalho de Melo) - Fixup BPF test using epoll_pwait syscall function probe, to cope with the syscall routines renames performed in this development cycle (Arnaldo Carvalho de Melo) - perf version fixes: - Do not print info about HAVE_LIBAUDIT_SUPPORT in 'perf version --build-options' when HAVE_SYSCALL_TABLE_SUPPORT is true, as libaudit won't be used in that case, print info about syscall_table support instead (Jin Yao) - Build system fixes: - Use HAVE_..._SUPPORT used consistently (Jin Yao) - Restore READ_ONCE() C++ compatibility in tools/include (Mark Rutland) - Give hints about package names needed to build jvmti (Arnaldo Carvalho de Melo) Thanks, tglx --> Alexey Budankov (4): perf stat: Enable 1ms interval for printing event counters values perf/core: Store context switch out type in PERF_RECORD_SWITCH[_CPU_WIDE] perf report: Extend raw dump (-D) out with switch out event type perf script: Extend misc field decoding with switch out event type Andi Kleen (4): perf mem: Allow all record/report options perf hists browser: Clarify top/report browser help perf record: Remove misleading error suggestion perf record: Remove suggestion to enable APIC Arnaldo Carvalho de Melo (11): perf annotate: Allow showing offsets in more than just jump targets perf annotate browser: Allow showing offsets in more than just jump targets perf jvmti: Give hints about package names needed to build perf tests bpf: Remove unused ptrace.h include from LLVM test Revert "x86/asm: Allow again using asm.h when building for the 'bpf' clang target" perf report: Fix switching to another perf.data file perf annotate: Allow setting the offset level in .perfconfig perf annotate: Handle variables in 'sub', 'or' and many other instructions perf trace: Support MAP_FIXED_NOREPLACE perf tests mmap: Show which tracepoint is failing perf test BPF: Fixup BPF test using epoll_pwait syscall function probe Ingo Molnar (1): tools/headers: Synchronize kernel ABI headers, v4.17-rc1 Jin Yao (3): perf
[GIT pull] perf fixes for 4.17
Linus, please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus A larger set of updates for perf: - Kernel: - Handle the SBOX uncore monitoring correctly on Broadwell CPUs which do not have SBOX. - Store context switch out type in PERF_RECORD_SWITCH[_CPU_WIDE]. The percentage of preempting and non-preempting context switches help understanding the nature of workloads (CPU or IO bound) that are running on a machine. This adds the kernel facility and userspace changes needed to show this information in 'perf script' and 'perf report -D' (Alexey Budankov) - Remove a WARN_ON() in the trace/kprobes code which is pointless because the return error code is already telling the caller what's wrong. - Revert a fugly workaround for clang BPF targets. - Fix sample_max_stack maximum check and do not proceed when an error has been detect, return them to avoid misidentifying errors (Jiri Olsa) - Add SPDX idenitifiers and get rid of GPL boilderplate. - Tools: - Synchronize kernel ABI headers, v4.17-rc1 (Ingo Molnar) - Support MAP_FIXED_NOREPLACE, noticed when updating the tools/include/ copies (Arnaldo Carvalho de Melo) - Add '\n' at the end of parse-options error messages (Ravi Bangoria) - Add s390 support for detailed/verbose PMU event description (Thomas Richter) - perf annotate fixes and improvements: - Allow showing offsets in more than just jump targets, use the new 'O' hotkey in the TUI, config ~/.perfconfig annotate.offset_level for it and for --stdio2 (Arnaldo Carvalho de Melo) - Use the resolved variable names from objdump disassembled lines to make them more compact, just like was already done for some instructions, like "mov", this eventually will be done more generally, but lets now add some more to the existing mechanism (Arnaldo Carvalho de Melo) - perf record fixes: - Change warning for missing topology sysfs entry to debug, as not all architectures have those files, s390 being one of those (Thomas Richter) - Remove old error messages about things that unlikely to be the root cause in modern systems (Andi Kleen) - perf sched fixes: - Fix -g/--call-graph documentation (Takuya Yamamoto) - perf stat: - Enable 1ms interval for printing event counters values in (Alexey Budankov) - perf test fixes: - Run dwarf unwind on arm32 (Kim Phillips) - Remove unused ptrace.h include from LLVM test, sidesteping older clang's lack of support for some asm constructs (Arnaldo Carvalho de Melo) - Fixup BPF test using epoll_pwait syscall function probe, to cope with the syscall routines renames performed in this development cycle (Arnaldo Carvalho de Melo) - perf version fixes: - Do not print info about HAVE_LIBAUDIT_SUPPORT in 'perf version --build-options' when HAVE_SYSCALL_TABLE_SUPPORT is true, as libaudit won't be used in that case, print info about syscall_table support instead (Jin Yao) - Build system fixes: - Use HAVE_..._SUPPORT used consistently (Jin Yao) - Restore READ_ONCE() C++ compatibility in tools/include (Mark Rutland) - Give hints about package names needed to build jvmti (Arnaldo Carvalho de Melo) Thanks, tglx --> Alexey Budankov (4): perf stat: Enable 1ms interval for printing event counters values perf/core: Store context switch out type in PERF_RECORD_SWITCH[_CPU_WIDE] perf report: Extend raw dump (-D) out with switch out event type perf script: Extend misc field decoding with switch out event type Andi Kleen (4): perf mem: Allow all record/report options perf hists browser: Clarify top/report browser help perf record: Remove misleading error suggestion perf record: Remove suggestion to enable APIC Arnaldo Carvalho de Melo (11): perf annotate: Allow showing offsets in more than just jump targets perf annotate browser: Allow showing offsets in more than just jump targets perf jvmti: Give hints about package names needed to build perf tests bpf: Remove unused ptrace.h include from LLVM test Revert "x86/asm: Allow again using asm.h when building for the 'bpf' clang target" perf report: Fix switching to another perf.data file perf annotate: Allow setting the offset level in .perfconfig perf annotate: Handle variables in 'sub', 'or' and many other instructions perf trace: Support MAP_FIXED_NOREPLACE perf tests mmap: Show which tracepoint is failing perf test BPF: Fixup BPF test using epoll_pwait syscall function probe Ingo Molnar (1): tools/headers: Synchronize kernel ABI headers, v4.17-rc1 Jin Yao (3): perf
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: f67b15037a7a50c57f72e69a6d59941ad90a0f0f perf/hwbp: Simplify the perf-hwbp code, fix documentation Two fixlets. Thanks, Ingo --> Linus Torvalds (1): perf/hwbp: Simplify the perf-hwbp code, fix documentation Stephane Eranian (1): perf/x86/intel: Fix linear IP of PEBS real_ip on Haswell and later CPUs arch/x86/events/intel/ds.c| 25 + kernel/events/hw_breakpoint.c | 30 +++--- 2 files changed, 24 insertions(+), 31 deletions(-) diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c index d8015235ba76..5e526c54247e 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -1153,6 +1153,7 @@ static void setup_pebs_sample_data(struct perf_event *event, if (pebs == NULL) return; + regs->flags &= ~PERF_EFLAGS_EXACT; sample_type = event->attr.sample_type; dsrc = sample_type & PERF_SAMPLE_DATA_SRC; @@ -1197,7 +1198,6 @@ static void setup_pebs_sample_data(struct perf_event *event, */ *regs = *iregs; regs->flags = pebs->flags; - set_linear_ip(regs, pebs->ip); if (sample_type & PERF_SAMPLE_REGS_INTR) { regs->ax = pebs->ax; @@ -1233,13 +1233,22 @@ static void setup_pebs_sample_data(struct perf_event *event, #endif } - if (event->attr.precise_ip > 1 && x86_pmu.intel_cap.pebs_format >= 2) { - regs->ip = pebs->real_ip; - regs->flags |= PERF_EFLAGS_EXACT; - } else if (event->attr.precise_ip > 1 && intel_pmu_pebs_fixup_ip(regs)) - regs->flags |= PERF_EFLAGS_EXACT; - else - regs->flags &= ~PERF_EFLAGS_EXACT; + if (event->attr.precise_ip > 1) { + /* Haswell and later have the eventing IP, so use it: */ + if (x86_pmu.intel_cap.pebs_format >= 2) { + set_linear_ip(regs, pebs->real_ip); + regs->flags |= PERF_EFLAGS_EXACT; + } else { + /* Otherwise use PEBS off-by-1 IP: */ + set_linear_ip(regs, pebs->ip); + + /* ... and try to fix it up using the LBR entries: */ + if (intel_pmu_pebs_fixup_ip(regs)) + regs->flags |= PERF_EFLAGS_EXACT; + } + } else + set_linear_ip(regs, pebs->ip); + if ((sample_type & (PERF_SAMPLE_ADDR | PERF_SAMPLE_PHYS_ADDR)) && x86_pmu.intel_cap.pebs_format >= 1) diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c index 3f8cb1e14588..253ae2da13c3 100644 --- a/kernel/events/hw_breakpoint.c +++ b/kernel/events/hw_breakpoint.c @@ -427,16 +427,9 @@ EXPORT_SYMBOL_GPL(register_user_hw_breakpoint); * modify_user_hw_breakpoint - modify a user-space hardware breakpoint * @bp: the breakpoint structure to modify * @attr: new breakpoint attributes - * @triggered: callback to trigger when we hit the breakpoint - * @tsk: pointer to 'task_struct' of the process to which the address belongs */ int modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *attr) { - u64 old_addr = bp->attr.bp_addr; - u64 old_len = bp->attr.bp_len; - int old_type = bp->attr.bp_type; - int err = 0; - /* * modify_user_hw_breakpoint can be invoked with IRQs disabled and hence it * will not be possible to raise IPIs that invoke __perf_event_disable. @@ -451,27 +444,18 @@ int modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *att bp->attr.bp_addr = attr->bp_addr; bp->attr.bp_type = attr->bp_type; bp->attr.bp_len = attr->bp_len; + bp->attr.disabled = 1; - if (attr->disabled) - goto end; - - err = validate_hw_breakpoint(bp); - if (!err) - perf_event_enable(bp); + if (!attr->disabled) { + int err = validate_hw_breakpoint(bp); - if (err) { - bp->attr.bp_addr = old_addr; - bp->attr.bp_type = old_type; - bp->attr.bp_len = old_len; - if (!bp->attr.disabled) - perf_event_enable(bp); + if (err) + return err; - return err; + perf_event_enable(bp); + bp->attr.disabled = 0; } -end: - bp->attr.disabled = attr->disabled; - return 0; } EXPORT_SYMBOL_GPL(modify_user_hw_breakpoint);
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: f67b15037a7a50c57f72e69a6d59941ad90a0f0f perf/hwbp: Simplify the perf-hwbp code, fix documentation Two fixlets. Thanks, Ingo --> Linus Torvalds (1): perf/hwbp: Simplify the perf-hwbp code, fix documentation Stephane Eranian (1): perf/x86/intel: Fix linear IP of PEBS real_ip on Haswell and later CPUs arch/x86/events/intel/ds.c| 25 + kernel/events/hw_breakpoint.c | 30 +++--- 2 files changed, 24 insertions(+), 31 deletions(-) diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c index d8015235ba76..5e526c54247e 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -1153,6 +1153,7 @@ static void setup_pebs_sample_data(struct perf_event *event, if (pebs == NULL) return; + regs->flags &= ~PERF_EFLAGS_EXACT; sample_type = event->attr.sample_type; dsrc = sample_type & PERF_SAMPLE_DATA_SRC; @@ -1197,7 +1198,6 @@ static void setup_pebs_sample_data(struct perf_event *event, */ *regs = *iregs; regs->flags = pebs->flags; - set_linear_ip(regs, pebs->ip); if (sample_type & PERF_SAMPLE_REGS_INTR) { regs->ax = pebs->ax; @@ -1233,13 +1233,22 @@ static void setup_pebs_sample_data(struct perf_event *event, #endif } - if (event->attr.precise_ip > 1 && x86_pmu.intel_cap.pebs_format >= 2) { - regs->ip = pebs->real_ip; - regs->flags |= PERF_EFLAGS_EXACT; - } else if (event->attr.precise_ip > 1 && intel_pmu_pebs_fixup_ip(regs)) - regs->flags |= PERF_EFLAGS_EXACT; - else - regs->flags &= ~PERF_EFLAGS_EXACT; + if (event->attr.precise_ip > 1) { + /* Haswell and later have the eventing IP, so use it: */ + if (x86_pmu.intel_cap.pebs_format >= 2) { + set_linear_ip(regs, pebs->real_ip); + regs->flags |= PERF_EFLAGS_EXACT; + } else { + /* Otherwise use PEBS off-by-1 IP: */ + set_linear_ip(regs, pebs->ip); + + /* ... and try to fix it up using the LBR entries: */ + if (intel_pmu_pebs_fixup_ip(regs)) + regs->flags |= PERF_EFLAGS_EXACT; + } + } else + set_linear_ip(regs, pebs->ip); + if ((sample_type & (PERF_SAMPLE_ADDR | PERF_SAMPLE_PHYS_ADDR)) && x86_pmu.intel_cap.pebs_format >= 1) diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c index 3f8cb1e14588..253ae2da13c3 100644 --- a/kernel/events/hw_breakpoint.c +++ b/kernel/events/hw_breakpoint.c @@ -427,16 +427,9 @@ EXPORT_SYMBOL_GPL(register_user_hw_breakpoint); * modify_user_hw_breakpoint - modify a user-space hardware breakpoint * @bp: the breakpoint structure to modify * @attr: new breakpoint attributes - * @triggered: callback to trigger when we hit the breakpoint - * @tsk: pointer to 'task_struct' of the process to which the address belongs */ int modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *attr) { - u64 old_addr = bp->attr.bp_addr; - u64 old_len = bp->attr.bp_len; - int old_type = bp->attr.bp_type; - int err = 0; - /* * modify_user_hw_breakpoint can be invoked with IRQs disabled and hence it * will not be possible to raise IPIs that invoke __perf_event_disable. @@ -451,27 +444,18 @@ int modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *att bp->attr.bp_addr = attr->bp_addr; bp->attr.bp_type = attr->bp_type; bp->attr.bp_len = attr->bp_len; + bp->attr.disabled = 1; - if (attr->disabled) - goto end; - - err = validate_hw_breakpoint(bp); - if (!err) - perf_event_enable(bp); + if (!attr->disabled) { + int err = validate_hw_breakpoint(bp); - if (err) { - bp->attr.bp_addr = old_addr; - bp->attr.bp_type = old_type; - bp->attr.bp_len = old_len; - if (!bp->attr.disabled) - perf_event_enable(bp); + if (err) + return err; - return err; + perf_event_enable(bp); + bp->attr.disabled = 0; } -end: - bp->attr.disabled = attr->disabled; - return 0; } EXPORT_SYMBOL_GPL(modify_user_hw_breakpoint);
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: c917e0f259908e75bd2a65877e25f9d90c22c848 perf/cgroup: Fix child event counting bug Misc kernel side fixes: - a cgroup events counting fix - an x86 Intel PMU truncated-parameter fix - an x86 RDPMC fix - an x86 API naming fix/rename - an x86 uncore driver big-hardware PCI enumeration fix - an x86 uncore driver filter constraint fix Thanks, Ingo --> Dan Carpenter (1): perf/x86/intel: Don't accidentally clear high bits in bdw_limit_period() Kan Liang (3): perf/x86/intel: Disable userspace RDPMC usage for large PEBS perf/x86/intel: Rename confusing 'freerunning PEBS' API and implementation to 'large PEBS' perf/x86/intel/uncore: Fix multi-domain PCI CHA enumeration bug on Skylake servers Song Liu (1): perf/cgroup: Fix child event counting bug Stephane Eranian (1): perf/x86/intel/uncore: Add missing filter constraint for SKX CHA event arch/x86/events/core.c | 3 ++- arch/x86/events/intel/core.c | 14 +++--- arch/x86/events/intel/ds.c | 6 +++--- arch/x86/events/intel/uncore_snbep.c | 32 ++-- arch/x86/events/perf_event.h | 6 +++--- kernel/events/core.c | 21 - 6 files changed, 49 insertions(+), 33 deletions(-) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 140d33288e78..88797c80b3e0 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -2118,7 +2118,8 @@ static int x86_pmu_event_init(struct perf_event *event) event->destroy(event); } - if (READ_ONCE(x86_pmu.attr_rdpmc)) + if (READ_ONCE(x86_pmu.attr_rdpmc) && + !(event->hw.flags & PERF_X86_EVENT_LARGE_PEBS)) event->hw.flags |= PERF_X86_EVENT_RDPMC_ALLOWED; return err; diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 56457cb73448..1e41d7508d99 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -2952,9 +2952,9 @@ static void intel_pebs_aliases_skl(struct perf_event *event) return intel_pebs_aliases_precdist(event); } -static unsigned long intel_pmu_free_running_flags(struct perf_event *event) +static unsigned long intel_pmu_large_pebs_flags(struct perf_event *event) { - unsigned long flags = x86_pmu.free_running_flags; + unsigned long flags = x86_pmu.large_pebs_flags; if (event->attr.use_clockid) flags &= ~PERF_SAMPLE_TIME; @@ -2976,8 +2976,8 @@ static int intel_pmu_hw_config(struct perf_event *event) if (!event->attr.freq) { event->hw.flags |= PERF_X86_EVENT_AUTO_RELOAD; if (!(event->attr.sample_type & - ~intel_pmu_free_running_flags(event))) - event->hw.flags |= PERF_X86_EVENT_FREERUNNING; + ~intel_pmu_large_pebs_flags(event))) + event->hw.flags |= PERF_X86_EVENT_LARGE_PEBS; } if (x86_pmu.pebs_aliases) x86_pmu.pebs_aliases(event); @@ -3194,7 +3194,7 @@ static unsigned bdw_limit_period(struct perf_event *event, unsigned left) X86_CONFIG(.event=0xc0, .umask=0x01)) { if (left < 128) left = 128; - left &= ~0x3fu; + left &= ~0x3fULL; } return left; } @@ -3460,7 +3460,7 @@ static __initconst const struct x86_pmu core_pmu = { .event_map = intel_pmu_event_map, .max_events = ARRAY_SIZE(intel_perfmon_event_map), .apic = 1, - .free_running_flags = PEBS_FREERUNNING_FLAGS, + .large_pebs_flags = LARGE_PEBS_FLAGS, /* * Intel PMCs cannot be accessed sanely above 32-bit width, @@ -3502,7 +3502,7 @@ static __initconst const struct x86_pmu intel_pmu = { .event_map = intel_pmu_event_map, .max_events = ARRAY_SIZE(intel_perfmon_event_map), .apic = 1, - .free_running_flags = PEBS_FREERUNNING_FLAGS, + .large_pebs_flags = LARGE_PEBS_FLAGS, /* * Intel PMCs cannot be accessed sanely above 32 bit width, * so we install an artificial 1<<31 period regardless of diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c index 18c25ab28557..d8015235ba76 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -935,7 +935,7 @@ void intel_pmu_pebs_add(struct perf_event *event) bool needed_cb = pebs_needs_sched_cb(cpuc); cpuc->n_pebs++; - if (hwc->flags & PERF_X86_EVENT_FREERUNNING) + if (hwc->flags &
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: c917e0f259908e75bd2a65877e25f9d90c22c848 perf/cgroup: Fix child event counting bug Misc kernel side fixes: - a cgroup events counting fix - an x86 Intel PMU truncated-parameter fix - an x86 RDPMC fix - an x86 API naming fix/rename - an x86 uncore driver big-hardware PCI enumeration fix - an x86 uncore driver filter constraint fix Thanks, Ingo --> Dan Carpenter (1): perf/x86/intel: Don't accidentally clear high bits in bdw_limit_period() Kan Liang (3): perf/x86/intel: Disable userspace RDPMC usage for large PEBS perf/x86/intel: Rename confusing 'freerunning PEBS' API and implementation to 'large PEBS' perf/x86/intel/uncore: Fix multi-domain PCI CHA enumeration bug on Skylake servers Song Liu (1): perf/cgroup: Fix child event counting bug Stephane Eranian (1): perf/x86/intel/uncore: Add missing filter constraint for SKX CHA event arch/x86/events/core.c | 3 ++- arch/x86/events/intel/core.c | 14 +++--- arch/x86/events/intel/ds.c | 6 +++--- arch/x86/events/intel/uncore_snbep.c | 32 ++-- arch/x86/events/perf_event.h | 6 +++--- kernel/events/core.c | 21 - 6 files changed, 49 insertions(+), 33 deletions(-) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 140d33288e78..88797c80b3e0 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -2118,7 +2118,8 @@ static int x86_pmu_event_init(struct perf_event *event) event->destroy(event); } - if (READ_ONCE(x86_pmu.attr_rdpmc)) + if (READ_ONCE(x86_pmu.attr_rdpmc) && + !(event->hw.flags & PERF_X86_EVENT_LARGE_PEBS)) event->hw.flags |= PERF_X86_EVENT_RDPMC_ALLOWED; return err; diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 56457cb73448..1e41d7508d99 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -2952,9 +2952,9 @@ static void intel_pebs_aliases_skl(struct perf_event *event) return intel_pebs_aliases_precdist(event); } -static unsigned long intel_pmu_free_running_flags(struct perf_event *event) +static unsigned long intel_pmu_large_pebs_flags(struct perf_event *event) { - unsigned long flags = x86_pmu.free_running_flags; + unsigned long flags = x86_pmu.large_pebs_flags; if (event->attr.use_clockid) flags &= ~PERF_SAMPLE_TIME; @@ -2976,8 +2976,8 @@ static int intel_pmu_hw_config(struct perf_event *event) if (!event->attr.freq) { event->hw.flags |= PERF_X86_EVENT_AUTO_RELOAD; if (!(event->attr.sample_type & - ~intel_pmu_free_running_flags(event))) - event->hw.flags |= PERF_X86_EVENT_FREERUNNING; + ~intel_pmu_large_pebs_flags(event))) + event->hw.flags |= PERF_X86_EVENT_LARGE_PEBS; } if (x86_pmu.pebs_aliases) x86_pmu.pebs_aliases(event); @@ -3194,7 +3194,7 @@ static unsigned bdw_limit_period(struct perf_event *event, unsigned left) X86_CONFIG(.event=0xc0, .umask=0x01)) { if (left < 128) left = 128; - left &= ~0x3fu; + left &= ~0x3fULL; } return left; } @@ -3460,7 +3460,7 @@ static __initconst const struct x86_pmu core_pmu = { .event_map = intel_pmu_event_map, .max_events = ARRAY_SIZE(intel_perfmon_event_map), .apic = 1, - .free_running_flags = PEBS_FREERUNNING_FLAGS, + .large_pebs_flags = LARGE_PEBS_FLAGS, /* * Intel PMCs cannot be accessed sanely above 32-bit width, @@ -3502,7 +3502,7 @@ static __initconst const struct x86_pmu intel_pmu = { .event_map = intel_pmu_event_map, .max_events = ARRAY_SIZE(intel_perfmon_event_map), .apic = 1, - .free_running_flags = PEBS_FREERUNNING_FLAGS, + .large_pebs_flags = LARGE_PEBS_FLAGS, /* * Intel PMCs cannot be accessed sanely above 32 bit width, * so we install an artificial 1<<31 period regardless of diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c index 18c25ab28557..d8015235ba76 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -935,7 +935,7 @@ void intel_pmu_pebs_add(struct perf_event *event) bool needed_cb = pebs_needs_sched_cb(cpuc); cpuc->n_pebs++; - if (hwc->flags & PERF_X86_EVENT_FREERUNNING) + if (hwc->flags &
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 59410f5ac70a0949a6f06ba43eecb8f99be31291 Merge tag 'perf-urgent-for-mingo-4.16-20180205' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent Tooling fixes, plus add missing interval sampling to certain x86 PEBS events. Thanks, Ingo --> Arnaldo Carvalho de Melo (5): tools headers: Synchronize sound/asound.h tooling headers: Synchronize updated s390 kvm UAPI headers tools headers: Sync {tools/,}arch/powerpc/include/uapi/asm/kvm.h tools headers: Synchronize uapi/linux/sched.h tools headers: Synchoronize x86 features UAPI headers Jiri Olsa (3): perf evsel: Fix period/freq terms setup perf record: Fix period option handling x86/events/intel/ds: Add PERF_SAMPLE_PERIOD into PEBS_FREERUNNING_FLAGS Ravi Bangoria (2): perf trace: Fix call-graph output perf tools: Add trace/beauty/generated/ into .gitignore arch/x86/events/perf_event.h | 3 ++- tools/arch/powerpc/include/uapi/asm/kvm.h | 25 + tools/arch/s390/include/uapi/asm/kvm.h | 5 - tools/arch/x86/include/asm/cpufeatures.h | 24 tools/arch/x86/include/asm/disabled-features.h | 3 ++- tools/arch/x86/include/asm/required-features.h | 3 ++- tools/include/uapi/linux/kvm.h | 4 tools/include/uapi/linux/sched.h | 5 + tools/include/uapi/sound/asound.h | 9 + tools/perf/.gitignore | 1 + tools/perf/builtin-record.c| 3 ++- tools/perf/builtin-trace.c | 5 - tools/perf/perf.h | 1 + tools/perf/util/evsel.c| 13 ++--- 14 files changed, 91 insertions(+), 13 deletions(-) diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h index 8e4ea143ed96..78f91ec1056e 100644 --- a/arch/x86/events/perf_event.h +++ b/arch/x86/events/perf_event.h @@ -93,7 +93,8 @@ struct amd_nb { PERF_SAMPLE_ID | PERF_SAMPLE_CPU | PERF_SAMPLE_STREAM_ID | \ PERF_SAMPLE_DATA_SRC | PERF_SAMPLE_IDENTIFIER | \ PERF_SAMPLE_TRANSACTION | PERF_SAMPLE_PHYS_ADDR | \ - PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_REGS_USER) + PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_REGS_USER | \ + PERF_SAMPLE_PERIOD) #define PEBS_REGS \ (PERF_REG_X86_AX | \ diff --git a/tools/arch/powerpc/include/uapi/asm/kvm.h b/tools/arch/powerpc/include/uapi/asm/kvm.h index 61d6049f4c1e..637b7263cb86 100644 --- a/tools/arch/powerpc/include/uapi/asm/kvm.h +++ b/tools/arch/powerpc/include/uapi/asm/kvm.h @@ -443,6 +443,31 @@ struct kvm_ppc_rmmu_info { __u32 ap_encodings[8]; }; +/* For KVM_PPC_GET_CPU_CHAR */ +struct kvm_ppc_cpu_char { + __u64 character; /* characteristics of the CPU */ + __u64 behaviour; /* recommended software behaviour */ + __u64 character_mask; /* valid bits in character */ + __u64 behaviour_mask; /* valid bits in behaviour */ +}; + +/* + * Values for character and character_mask. + * These are identical to the values used by H_GET_CPU_CHARACTERISTICS. + */ +#define KVM_PPC_CPU_CHAR_SPEC_BAR_ORI31(1ULL << 63) +#define KVM_PPC_CPU_CHAR_BCCTRL_SERIALISED (1ULL << 62) +#define KVM_PPC_CPU_CHAR_L1D_FLUSH_ORI30 (1ULL << 61) +#define KVM_PPC_CPU_CHAR_L1D_FLUSH_TRIG2 (1ULL << 60) +#define KVM_PPC_CPU_CHAR_L1D_THREAD_PRIV (1ULL << 59) +#define KVM_PPC_CPU_CHAR_BR_HINT_HONOURED (1ULL << 58) +#define KVM_PPC_CPU_CHAR_MTTRIG_THR_RECONF (1ULL << 57) +#define KVM_PPC_CPU_CHAR_COUNT_CACHE_DIS (1ULL << 56) + +#define KVM_PPC_CPU_BEHAV_FAVOUR_SECURITY (1ULL << 63) +#define KVM_PPC_CPU_BEHAV_L1D_FLUSH_PR (1ULL << 62) +#define KVM_PPC_CPU_BEHAV_BNDS_CHK_SPEC_BAR(1ULL << 61) + /* Per-vcpu XICS interrupt controller state */ #define KVM_REG_PPC_ICP_STATE (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8c) diff --git a/tools/arch/s390/include/uapi/asm/kvm.h b/tools/arch/s390/include/uapi/asm/kvm.h index 38535a57fef8..4cdaa55fabfe 100644 --- a/tools/arch/s390/include/uapi/asm/kvm.h +++ b/tools/arch/s390/include/uapi/asm/kvm.h @@ -224,6 +224,7 @@ struct kvm_guest_debug_arch { #define KVM_SYNC_RICCB (1UL << 7) #define KVM_SYNC_FPRS (1UL << 8) #define KVM_SYNC_GSCB (1UL << 9) +#define KVM_SYNC_BPBC (1UL << 10) /* length and alignment of the sdnx as a power of two */ #define SDNXC 8 #define SDNXL (1UL << SDNXC) @@ -247,7 +248,9 @@ struct kvm_sync_regs { }; __u8 reserved[512];/* for future vector expansion */ __u32 fpc; /* valid on KVM_SYNC_VRS or KVM_SYNC_FPRS */ - __u8 padding1[52]; /* riccb needs to be 64byte
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 59410f5ac70a0949a6f06ba43eecb8f99be31291 Merge tag 'perf-urgent-for-mingo-4.16-20180205' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent Tooling fixes, plus add missing interval sampling to certain x86 PEBS events. Thanks, Ingo --> Arnaldo Carvalho de Melo (5): tools headers: Synchronize sound/asound.h tooling headers: Synchronize updated s390 kvm UAPI headers tools headers: Sync {tools/,}arch/powerpc/include/uapi/asm/kvm.h tools headers: Synchronize uapi/linux/sched.h tools headers: Synchoronize x86 features UAPI headers Jiri Olsa (3): perf evsel: Fix period/freq terms setup perf record: Fix period option handling x86/events/intel/ds: Add PERF_SAMPLE_PERIOD into PEBS_FREERUNNING_FLAGS Ravi Bangoria (2): perf trace: Fix call-graph output perf tools: Add trace/beauty/generated/ into .gitignore arch/x86/events/perf_event.h | 3 ++- tools/arch/powerpc/include/uapi/asm/kvm.h | 25 + tools/arch/s390/include/uapi/asm/kvm.h | 5 - tools/arch/x86/include/asm/cpufeatures.h | 24 tools/arch/x86/include/asm/disabled-features.h | 3 ++- tools/arch/x86/include/asm/required-features.h | 3 ++- tools/include/uapi/linux/kvm.h | 4 tools/include/uapi/linux/sched.h | 5 + tools/include/uapi/sound/asound.h | 9 + tools/perf/.gitignore | 1 + tools/perf/builtin-record.c| 3 ++- tools/perf/builtin-trace.c | 5 - tools/perf/perf.h | 1 + tools/perf/util/evsel.c| 13 ++--- 14 files changed, 91 insertions(+), 13 deletions(-) diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h index 8e4ea143ed96..78f91ec1056e 100644 --- a/arch/x86/events/perf_event.h +++ b/arch/x86/events/perf_event.h @@ -93,7 +93,8 @@ struct amd_nb { PERF_SAMPLE_ID | PERF_SAMPLE_CPU | PERF_SAMPLE_STREAM_ID | \ PERF_SAMPLE_DATA_SRC | PERF_SAMPLE_IDENTIFIER | \ PERF_SAMPLE_TRANSACTION | PERF_SAMPLE_PHYS_ADDR | \ - PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_REGS_USER) + PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_REGS_USER | \ + PERF_SAMPLE_PERIOD) #define PEBS_REGS \ (PERF_REG_X86_AX | \ diff --git a/tools/arch/powerpc/include/uapi/asm/kvm.h b/tools/arch/powerpc/include/uapi/asm/kvm.h index 61d6049f4c1e..637b7263cb86 100644 --- a/tools/arch/powerpc/include/uapi/asm/kvm.h +++ b/tools/arch/powerpc/include/uapi/asm/kvm.h @@ -443,6 +443,31 @@ struct kvm_ppc_rmmu_info { __u32 ap_encodings[8]; }; +/* For KVM_PPC_GET_CPU_CHAR */ +struct kvm_ppc_cpu_char { + __u64 character; /* characteristics of the CPU */ + __u64 behaviour; /* recommended software behaviour */ + __u64 character_mask; /* valid bits in character */ + __u64 behaviour_mask; /* valid bits in behaviour */ +}; + +/* + * Values for character and character_mask. + * These are identical to the values used by H_GET_CPU_CHARACTERISTICS. + */ +#define KVM_PPC_CPU_CHAR_SPEC_BAR_ORI31(1ULL << 63) +#define KVM_PPC_CPU_CHAR_BCCTRL_SERIALISED (1ULL << 62) +#define KVM_PPC_CPU_CHAR_L1D_FLUSH_ORI30 (1ULL << 61) +#define KVM_PPC_CPU_CHAR_L1D_FLUSH_TRIG2 (1ULL << 60) +#define KVM_PPC_CPU_CHAR_L1D_THREAD_PRIV (1ULL << 59) +#define KVM_PPC_CPU_CHAR_BR_HINT_HONOURED (1ULL << 58) +#define KVM_PPC_CPU_CHAR_MTTRIG_THR_RECONF (1ULL << 57) +#define KVM_PPC_CPU_CHAR_COUNT_CACHE_DIS (1ULL << 56) + +#define KVM_PPC_CPU_BEHAV_FAVOUR_SECURITY (1ULL << 63) +#define KVM_PPC_CPU_BEHAV_L1D_FLUSH_PR (1ULL << 62) +#define KVM_PPC_CPU_BEHAV_BNDS_CHK_SPEC_BAR(1ULL << 61) + /* Per-vcpu XICS interrupt controller state */ #define KVM_REG_PPC_ICP_STATE (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8c) diff --git a/tools/arch/s390/include/uapi/asm/kvm.h b/tools/arch/s390/include/uapi/asm/kvm.h index 38535a57fef8..4cdaa55fabfe 100644 --- a/tools/arch/s390/include/uapi/asm/kvm.h +++ b/tools/arch/s390/include/uapi/asm/kvm.h @@ -224,6 +224,7 @@ struct kvm_guest_debug_arch { #define KVM_SYNC_RICCB (1UL << 7) #define KVM_SYNC_FPRS (1UL << 8) #define KVM_SYNC_GSCB (1UL << 9) +#define KVM_SYNC_BPBC (1UL << 10) /* length and alignment of the sdnx as a power of two */ #define SDNXC 8 #define SDNXL (1UL << SDNXC) @@ -247,7 +248,9 @@ struct kvm_sync_regs { }; __u8 reserved[512];/* for future vector expansion */ __u32 fpc; /* valid on KVM_SYNC_VRS or KVM_SYNC_FPRS */ - __u8 padding1[52]; /* riccb needs to be 64byte
[GIT pull] perf fixes for 4.15
Linus, please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus Four patches which all address lock inversions and deadlocks in the perf core code and the Intel debug store. Thanks, tglx --> Peter Zijlstra (4): perf/core: Fix lock inversion between perf,trace,cpuhp perf/core: Fix another perf,trace,cpuhp lock inversion perf/core: Fix ctx::mutex deadlock perf/x86: Fix perf,x86,cpuhp deadlock arch/x86/events/intel/ds.c | 33 +--- kernel/events/core.c | 47 +- 2 files changed, 60 insertions(+), 20 deletions(-) diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c index 8156e47da7ba..18c25ab28557 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -372,10 +372,9 @@ static int alloc_pebs_buffer(int cpu) static void release_pebs_buffer(int cpu) { struct cpu_hw_events *hwev = per_cpu_ptr(_hw_events, cpu); - struct debug_store *ds = hwev->ds; void *cea; - if (!ds || !x86_pmu.pebs) + if (!x86_pmu.pebs) return; kfree(per_cpu(insn_buffer, cpu)); @@ -384,7 +383,6 @@ static void release_pebs_buffer(int cpu) /* Clear the fixmap */ cea = _cpu_entry_area(cpu)->cpu_debug_buffers.pebs_buffer; ds_clear_cea(cea, x86_pmu.pebs_buffer_size); - ds->pebs_buffer_base = 0; dsfree_pages(hwev->ds_pebs_vaddr, x86_pmu.pebs_buffer_size); hwev->ds_pebs_vaddr = NULL; } @@ -419,16 +417,14 @@ static int alloc_bts_buffer(int cpu) static void release_bts_buffer(int cpu) { struct cpu_hw_events *hwev = per_cpu_ptr(_hw_events, cpu); - struct debug_store *ds = hwev->ds; void *cea; - if (!ds || !x86_pmu.bts) + if (!x86_pmu.bts) return; /* Clear the fixmap */ cea = _cpu_entry_area(cpu)->cpu_debug_buffers.bts_buffer; ds_clear_cea(cea, BTS_BUFFER_SIZE); - ds->bts_buffer_base = 0; dsfree_pages(hwev->ds_bts_vaddr, BTS_BUFFER_SIZE); hwev->ds_bts_vaddr = NULL; } @@ -454,16 +450,22 @@ void release_ds_buffers(void) if (!x86_pmu.bts && !x86_pmu.pebs) return; - get_online_cpus(); - for_each_online_cpu(cpu) + for_each_possible_cpu(cpu) + release_ds_buffer(cpu); + + for_each_possible_cpu(cpu) { + /* +* Again, ignore errors from offline CPUs, they will no longer +* observe cpu_hw_events.ds and not program the DS_AREA when +* they come up. +*/ fini_debug_store_on_cpu(cpu); + } for_each_possible_cpu(cpu) { release_pebs_buffer(cpu); release_bts_buffer(cpu); - release_ds_buffer(cpu); } - put_online_cpus(); } void reserve_ds_buffers(void) @@ -483,8 +485,6 @@ void reserve_ds_buffers(void) if (!x86_pmu.pebs) pebs_err = 1; - get_online_cpus(); - for_each_possible_cpu(cpu) { if (alloc_ds_buffer(cpu)) { bts_err = 1; @@ -521,11 +521,14 @@ void reserve_ds_buffers(void) if (x86_pmu.pebs && !pebs_err) x86_pmu.pebs_active = 1; - for_each_online_cpu(cpu) + for_each_possible_cpu(cpu) { + /* +* Ignores wrmsr_on_cpu() errors for offline CPUs they +* will get this call through intel_pmu_cpu_starting(). +*/ init_debug_store_on_cpu(cpu); + } } - - put_online_cpus(); } /* diff --git a/kernel/events/core.c b/kernel/events/core.c index 4df5b695bf0d..5d8f4031f8d5 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -1231,6 +1231,10 @@ static void put_ctx(struct perf_event_context *ctx) * perf_event_context::lock * perf_event::mmap_mutex * mmap_sem + * + *cpu_hotplug_lock + * pmus_lock + * cpuctx->mutex / perf_event_context::mutex */ static struct perf_event_context * perf_event_ctx_lock_nested(struct perf_event *event, int nesting) @@ -4196,6 +4200,7 @@ int perf_event_release_kernel(struct perf_event *event) { struct perf_event_context *ctx = event->ctx; struct perf_event *child, *tmp; + LIST_HEAD(free_list); /* * If we got here through err_file: fput(event_file); we will not have @@ -4268,8 +4273,7 @@ int perf_event_release_kernel(struct perf_event *event) struct perf_event, child_list); if (tmp == child) { perf_remove_from_context(child, DETACH_GROUP); - list_del(>child_list); -
[GIT pull] perf fixes for 4.15
Linus, please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus Four patches which all address lock inversions and deadlocks in the perf core code and the Intel debug store. Thanks, tglx --> Peter Zijlstra (4): perf/core: Fix lock inversion between perf,trace,cpuhp perf/core: Fix another perf,trace,cpuhp lock inversion perf/core: Fix ctx::mutex deadlock perf/x86: Fix perf,x86,cpuhp deadlock arch/x86/events/intel/ds.c | 33 +--- kernel/events/core.c | 47 +- 2 files changed, 60 insertions(+), 20 deletions(-) diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c index 8156e47da7ba..18c25ab28557 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -372,10 +372,9 @@ static int alloc_pebs_buffer(int cpu) static void release_pebs_buffer(int cpu) { struct cpu_hw_events *hwev = per_cpu_ptr(_hw_events, cpu); - struct debug_store *ds = hwev->ds; void *cea; - if (!ds || !x86_pmu.pebs) + if (!x86_pmu.pebs) return; kfree(per_cpu(insn_buffer, cpu)); @@ -384,7 +383,6 @@ static void release_pebs_buffer(int cpu) /* Clear the fixmap */ cea = _cpu_entry_area(cpu)->cpu_debug_buffers.pebs_buffer; ds_clear_cea(cea, x86_pmu.pebs_buffer_size); - ds->pebs_buffer_base = 0; dsfree_pages(hwev->ds_pebs_vaddr, x86_pmu.pebs_buffer_size); hwev->ds_pebs_vaddr = NULL; } @@ -419,16 +417,14 @@ static int alloc_bts_buffer(int cpu) static void release_bts_buffer(int cpu) { struct cpu_hw_events *hwev = per_cpu_ptr(_hw_events, cpu); - struct debug_store *ds = hwev->ds; void *cea; - if (!ds || !x86_pmu.bts) + if (!x86_pmu.bts) return; /* Clear the fixmap */ cea = _cpu_entry_area(cpu)->cpu_debug_buffers.bts_buffer; ds_clear_cea(cea, BTS_BUFFER_SIZE); - ds->bts_buffer_base = 0; dsfree_pages(hwev->ds_bts_vaddr, BTS_BUFFER_SIZE); hwev->ds_bts_vaddr = NULL; } @@ -454,16 +450,22 @@ void release_ds_buffers(void) if (!x86_pmu.bts && !x86_pmu.pebs) return; - get_online_cpus(); - for_each_online_cpu(cpu) + for_each_possible_cpu(cpu) + release_ds_buffer(cpu); + + for_each_possible_cpu(cpu) { + /* +* Again, ignore errors from offline CPUs, they will no longer +* observe cpu_hw_events.ds and not program the DS_AREA when +* they come up. +*/ fini_debug_store_on_cpu(cpu); + } for_each_possible_cpu(cpu) { release_pebs_buffer(cpu); release_bts_buffer(cpu); - release_ds_buffer(cpu); } - put_online_cpus(); } void reserve_ds_buffers(void) @@ -483,8 +485,6 @@ void reserve_ds_buffers(void) if (!x86_pmu.pebs) pebs_err = 1; - get_online_cpus(); - for_each_possible_cpu(cpu) { if (alloc_ds_buffer(cpu)) { bts_err = 1; @@ -521,11 +521,14 @@ void reserve_ds_buffers(void) if (x86_pmu.pebs && !pebs_err) x86_pmu.pebs_active = 1; - for_each_online_cpu(cpu) + for_each_possible_cpu(cpu) { + /* +* Ignores wrmsr_on_cpu() errors for offline CPUs they +* will get this call through intel_pmu_cpu_starting(). +*/ init_debug_store_on_cpu(cpu); + } } - - put_online_cpus(); } /* diff --git a/kernel/events/core.c b/kernel/events/core.c index 4df5b695bf0d..5d8f4031f8d5 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -1231,6 +1231,10 @@ static void put_ctx(struct perf_event_context *ctx) * perf_event_context::lock * perf_event::mmap_mutex * mmap_sem + * + *cpu_hotplug_lock + * pmus_lock + * cpuctx->mutex / perf_event_context::mutex */ static struct perf_event_context * perf_event_ctx_lock_nested(struct perf_event *event, int nesting) @@ -4196,6 +4200,7 @@ int perf_event_release_kernel(struct perf_event *event) { struct perf_event_context *ctx = event->ctx; struct perf_event *child, *tmp; + LIST_HEAD(free_list); /* * If we got here through err_file: fput(event_file); we will not have @@ -4268,8 +4273,7 @@ int perf_event_release_kernel(struct perf_event *event) struct perf_event, child_list); if (tmp == child) { perf_remove_from_context(child, DETACH_GROUP); - list_del(>child_list); -
[GIT pull] perf fixes for 4.15
Linus, please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus This update contains: - Plug a memory leak in the intel pmu init code - clang fixes - tooling fix to avoid including kernel headers - A fix for jvmti to generate correct debug information for inlined code - Replace backtick with a regular shell function - Fix the build in hardened environments Thanks, tglx --> Arnaldo Carvalho de Melo (2): tools arch s390: Do not include header files from the kernel sources x86/asm: Allow again using asm.h when building for the 'bpf' clang target Ben Gainey (1): perf jvmti: Generate correct debug information for inlined code Jiri Olsa (2): perf tools: Use shell function for perl cflags retrieval perf tools: Fix up build in hardened environments Thomas Gleixner (1): perf/x86/intel: Plug memory leak in intel_pmu_init() arch/x86/events/intel/core.c | 5 +- arch/x86/include/asm/asm.h | 2 + tools/arch/s390/include/uapi/asm/perf_regs.h | 44 tools/perf/Makefile.config | 9 +- tools/perf/arch/s390/include/perf_regs.h | 2 +- tools/perf/check-headers.sh | 1 + tools/perf/jvmti/jvmti_agent.c | 16 +-- tools/perf/jvmti/jvmti_agent.h | 7 +- tools/perf/jvmti/libjvmti.c | 147 ++- 9 files changed, 190 insertions(+), 43 deletions(-) create mode 100644 tools/arch/s390/include/uapi/asm/perf_regs.h diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 09c26a4f139c..731153a4681e 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -3847,6 +3847,8 @@ static struct attribute *intel_pmu_attrs[] = { __init int intel_pmu_init(void) { + struct attribute **extra_attr = NULL; + struct attribute **to_free = NULL; union cpuid10_edx edx; union cpuid10_eax eax; union cpuid10_ebx ebx; @@ -3854,7 +3856,6 @@ __init int intel_pmu_init(void) unsigned int unused; struct extra_reg *er; int version, i; - struct attribute **extra_attr = NULL; char *name; if (!cpu_has(_cpu_data, X86_FEATURE_ARCH_PERFMON)) { @@ -4294,6 +4295,7 @@ __init int intel_pmu_init(void) extra_attr = boot_cpu_has(X86_FEATURE_RTM) ? hsw_format_attr : nhm_format_attr; extra_attr = merge_attr(extra_attr, skl_format_attr); + to_free = extra_attr; x86_pmu.cpu_events = get_hsw_events_attrs(); intel_pmu_pebs_data_source_skl( boot_cpu_data.x86_model == INTEL_FAM6_SKYLAKE_X); @@ -4401,6 +4403,7 @@ __init int intel_pmu_init(void) pr_cont("full-width counters, "); } + kfree(to_free); return 0; } diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h index 219faaec51df..386a6900e206 100644 --- a/arch/x86/include/asm/asm.h +++ b/arch/x86/include/asm/asm.h @@ -136,6 +136,7 @@ #endif #ifndef __ASSEMBLY__ +#ifndef __BPF__ /* * This output constraint should be used for any inline asm which has a "call" * instruction. Otherwise the asm may be inserted before the frame pointer @@ -145,5 +146,6 @@ register unsigned long current_stack_pointer asm(_ASM_SP); #define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer) #endif +#endif #endif /* _ASM_X86_ASM_H */ diff --git a/tools/arch/s390/include/uapi/asm/perf_regs.h b/tools/arch/s390/include/uapi/asm/perf_regs.h new file mode 100644 index ..d17dd9e5d516 --- /dev/null +++ b/tools/arch/s390/include/uapi/asm/perf_regs.h @@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _ASM_S390_PERF_REGS_H +#define _ASM_S390_PERF_REGS_H + +enum perf_event_s390_regs { + PERF_REG_S390_R0, + PERF_REG_S390_R1, + PERF_REG_S390_R2, + PERF_REG_S390_R3, + PERF_REG_S390_R4, + PERF_REG_S390_R5, + PERF_REG_S390_R6, + PERF_REG_S390_R7, + PERF_REG_S390_R8, + PERF_REG_S390_R9, + PERF_REG_S390_R10, + PERF_REG_S390_R11, + PERF_REG_S390_R12, + PERF_REG_S390_R13, + PERF_REG_S390_R14, + PERF_REG_S390_R15, + PERF_REG_S390_FP0, + PERF_REG_S390_FP1, + PERF_REG_S390_FP2, + PERF_REG_S390_FP3, + PERF_REG_S390_FP4, + PERF_REG_S390_FP5, + PERF_REG_S390_FP6, + PERF_REG_S390_FP7, + PERF_REG_S390_FP8, + PERF_REG_S390_FP9, + PERF_REG_S390_FP10, + PERF_REG_S390_FP11, + PERF_REG_S390_FP12, + PERF_REG_S390_FP13, + PERF_REG_S390_FP14, + PERF_REG_S390_FP15, + PERF_REG_S390_MASK, + PERF_REG_S390_PC, + + PERF_REG_S390_MAX +}; + +#endif /* _ASM_S390_PERF_REGS_H */ diff
[GIT pull] perf fixes for 4.15
Linus, please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus This update contains: - Plug a memory leak in the intel pmu init code - clang fixes - tooling fix to avoid including kernel headers - A fix for jvmti to generate correct debug information for inlined code - Replace backtick with a regular shell function - Fix the build in hardened environments Thanks, tglx --> Arnaldo Carvalho de Melo (2): tools arch s390: Do not include header files from the kernel sources x86/asm: Allow again using asm.h when building for the 'bpf' clang target Ben Gainey (1): perf jvmti: Generate correct debug information for inlined code Jiri Olsa (2): perf tools: Use shell function for perl cflags retrieval perf tools: Fix up build in hardened environments Thomas Gleixner (1): perf/x86/intel: Plug memory leak in intel_pmu_init() arch/x86/events/intel/core.c | 5 +- arch/x86/include/asm/asm.h | 2 + tools/arch/s390/include/uapi/asm/perf_regs.h | 44 tools/perf/Makefile.config | 9 +- tools/perf/arch/s390/include/perf_regs.h | 2 +- tools/perf/check-headers.sh | 1 + tools/perf/jvmti/jvmti_agent.c | 16 +-- tools/perf/jvmti/jvmti_agent.h | 7 +- tools/perf/jvmti/libjvmti.c | 147 ++- 9 files changed, 190 insertions(+), 43 deletions(-) create mode 100644 tools/arch/s390/include/uapi/asm/perf_regs.h diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 09c26a4f139c..731153a4681e 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -3847,6 +3847,8 @@ static struct attribute *intel_pmu_attrs[] = { __init int intel_pmu_init(void) { + struct attribute **extra_attr = NULL; + struct attribute **to_free = NULL; union cpuid10_edx edx; union cpuid10_eax eax; union cpuid10_ebx ebx; @@ -3854,7 +3856,6 @@ __init int intel_pmu_init(void) unsigned int unused; struct extra_reg *er; int version, i; - struct attribute **extra_attr = NULL; char *name; if (!cpu_has(_cpu_data, X86_FEATURE_ARCH_PERFMON)) { @@ -4294,6 +4295,7 @@ __init int intel_pmu_init(void) extra_attr = boot_cpu_has(X86_FEATURE_RTM) ? hsw_format_attr : nhm_format_attr; extra_attr = merge_attr(extra_attr, skl_format_attr); + to_free = extra_attr; x86_pmu.cpu_events = get_hsw_events_attrs(); intel_pmu_pebs_data_source_skl( boot_cpu_data.x86_model == INTEL_FAM6_SKYLAKE_X); @@ -4401,6 +4403,7 @@ __init int intel_pmu_init(void) pr_cont("full-width counters, "); } + kfree(to_free); return 0; } diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h index 219faaec51df..386a6900e206 100644 --- a/arch/x86/include/asm/asm.h +++ b/arch/x86/include/asm/asm.h @@ -136,6 +136,7 @@ #endif #ifndef __ASSEMBLY__ +#ifndef __BPF__ /* * This output constraint should be used for any inline asm which has a "call" * instruction. Otherwise the asm may be inserted before the frame pointer @@ -145,5 +146,6 @@ register unsigned long current_stack_pointer asm(_ASM_SP); #define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer) #endif +#endif #endif /* _ASM_X86_ASM_H */ diff --git a/tools/arch/s390/include/uapi/asm/perf_regs.h b/tools/arch/s390/include/uapi/asm/perf_regs.h new file mode 100644 index ..d17dd9e5d516 --- /dev/null +++ b/tools/arch/s390/include/uapi/asm/perf_regs.h @@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _ASM_S390_PERF_REGS_H +#define _ASM_S390_PERF_REGS_H + +enum perf_event_s390_regs { + PERF_REG_S390_R0, + PERF_REG_S390_R1, + PERF_REG_S390_R2, + PERF_REG_S390_R3, + PERF_REG_S390_R4, + PERF_REG_S390_R5, + PERF_REG_S390_R6, + PERF_REG_S390_R7, + PERF_REG_S390_R8, + PERF_REG_S390_R9, + PERF_REG_S390_R10, + PERF_REG_S390_R11, + PERF_REG_S390_R12, + PERF_REG_S390_R13, + PERF_REG_S390_R14, + PERF_REG_S390_R15, + PERF_REG_S390_FP0, + PERF_REG_S390_FP1, + PERF_REG_S390_FP2, + PERF_REG_S390_FP3, + PERF_REG_S390_FP4, + PERF_REG_S390_FP5, + PERF_REG_S390_FP6, + PERF_REG_S390_FP7, + PERF_REG_S390_FP8, + PERF_REG_S390_FP9, + PERF_REG_S390_FP10, + PERF_REG_S390_FP11, + PERF_REG_S390_FP12, + PERF_REG_S390_FP13, + PERF_REG_S390_FP14, + PERF_REG_S390_FP15, + PERF_REG_S390_MASK, + PERF_REG_S390_PC, + + PERF_REG_S390_MAX +}; + +#endif /* _ASM_S390_PERF_REGS_H */ diff
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 34c9ca37aaec2e307b837bb099d3b44f0ea04ddc tooling/headers: Synchronize updated s390 and x86 UAPI headers This tree includes perf namespace support kernel side fixes, plus an accumulated set of perf tooling fixes - including UAPI header synchronization that should make the perf build less noisy. Thanks, Ingo --> Adrian Hunter (1): perf intel-pt: Bring instruction decoder files into line with the kernel Andi Kleen (1): perf record: Fix -c/-F options for cpu event aliases Andrei Vagin (1): perf trace: Fix an exit code of trace__symbols_init Arnaldo Carvalho de Melo (16): perf evlist: Set the correct idx when adding dummy events perf record: Generate PERF_RECORD_{MMAP,COMM,EXEC} with --delay perf evsel: Fix up leftover perf_evsel_stat usage via evsel->priv perf script: Fix --per-event-dump for auxtrace synth evsels perf machine: Guard against NULL in machine__exit() perf evlist: Add helper to check if attr.exclude_kernel is set in all evsels perf report: Ignore kptr_restrict when not sampling the kernel perf record: Ignore kptr_restrict when not sampling the kernel perf top: Ignore kptr_restrict when not sampling the kernel tools headers: Synchronize kernel ABI headers wrt SPDX tags tools headers: Synchronize perf_event.h header tools headers uapi: Synchronize drm/drm.h tools headers: Synchronize drm/i915_drm.h tools headers: Synchronize KVM arch ABI headers tools headers: Synchronize prctl.h ABI header tools headers: Syncronize mman.h ABI header Ingo Molnar (2): tools/headers: Synchronize kernel x86 UAPI headers tooling/headers: Synchronize updated s390 and x86 UAPI headers Jiri Olsa (3): perf: Fix header.size for namespace events perf top: Fix window dimensions change handling perf top: Use signal interface for SIGWINCH handler Namhyung Kim (1): perf help: Fix a bug during strstart() conversion Ravi Bangoria (1): perf annotate: Do not truncate instruction names at 6 chars Satheesh Rajendran (1): perf bench numa: Fixup discontiguous/sparse numa nodes Thomas Richter (3): perf test shell: Fix check open filename arg using 'perf trace' on s390x perf test shell: Fix test case probe libc's inet_pton on s390x perf test: Fix test 21 for s390x Vasily Averin (1): perf/core: Fix memory leak triggered by perf --namespace kernel/events/core.c | 5 +- tools/arch/arm/include/uapi/asm/kvm.h | 7 + tools/arch/arm64/include/uapi/asm/kvm.h| 7 + tools/arch/s390/include/uapi/asm/kvm.h | 4 - tools/arch/s390/include/uapi/asm/kvm_perf.h| 4 - tools/arch/x86/include/asm/cpufeatures.h | 537 +++-- tools/arch/x86/include/asm/disabled-features.h | 8 +- tools/include/uapi/asm-generic/mman.h | 1 + tools/include/uapi/drm/drm.h | 41 ++ tools/include/uapi/drm/i915_drm.h | 33 +- tools/include/uapi/linux/kcmp.h| 1 + tools/include/uapi/linux/kvm.h | 1 + tools/include/uapi/linux/perf_event.h | 1 + tools/include/uapi/linux/prctl.h | 10 + tools/perf/bench/numa.c| 56 ++- tools/perf/builtin-help.c | 4 +- tools/perf/builtin-record.c| 42 +- tools/perf/builtin-report.c| 3 + tools/perf/builtin-script.c| 31 +- tools/perf/builtin-top.c | 36 +- tools/perf/builtin-trace.c | 6 +- .../perf/tests/shell/trace+probe_libc_inet_pton.sh | 7 +- tools/perf/tests/shell/trace+probe_vfs_getname.sh | 6 +- tools/perf/tests/task-exit.c | 4 + tools/perf/trace/beauty/mmap.c | 3 + tools/perf/util/annotate.c | 18 +- tools/perf/util/evlist.c | 14 +- tools/perf/util/evlist.h | 2 + tools/perf/util/evsel.c| 14 +- tools/perf/util/evsel.h| 1 + tools/perf/util/intel-pt-decoder/inat.h| 10 + .../perf/util/intel-pt-decoder/x86-opcode-map.txt | 2 +- tools/perf/util/machine.c | 3 + tools/perf/util/parse-events.c | 2 + tools/perf/util/parse-events.h | 3 + tools/perf/util/pmu.c | 5 + 36 files changed, 594 insertions(+), 338 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 16beab4767e1..5961ef6dfd64 100644 ---
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 34c9ca37aaec2e307b837bb099d3b44f0ea04ddc tooling/headers: Synchronize updated s390 and x86 UAPI headers This tree includes perf namespace support kernel side fixes, plus an accumulated set of perf tooling fixes - including UAPI header synchronization that should make the perf build less noisy. Thanks, Ingo --> Adrian Hunter (1): perf intel-pt: Bring instruction decoder files into line with the kernel Andi Kleen (1): perf record: Fix -c/-F options for cpu event aliases Andrei Vagin (1): perf trace: Fix an exit code of trace__symbols_init Arnaldo Carvalho de Melo (16): perf evlist: Set the correct idx when adding dummy events perf record: Generate PERF_RECORD_{MMAP,COMM,EXEC} with --delay perf evsel: Fix up leftover perf_evsel_stat usage via evsel->priv perf script: Fix --per-event-dump for auxtrace synth evsels perf machine: Guard against NULL in machine__exit() perf evlist: Add helper to check if attr.exclude_kernel is set in all evsels perf report: Ignore kptr_restrict when not sampling the kernel perf record: Ignore kptr_restrict when not sampling the kernel perf top: Ignore kptr_restrict when not sampling the kernel tools headers: Synchronize kernel ABI headers wrt SPDX tags tools headers: Synchronize perf_event.h header tools headers uapi: Synchronize drm/drm.h tools headers: Synchronize drm/i915_drm.h tools headers: Synchronize KVM arch ABI headers tools headers: Synchronize prctl.h ABI header tools headers: Syncronize mman.h ABI header Ingo Molnar (2): tools/headers: Synchronize kernel x86 UAPI headers tooling/headers: Synchronize updated s390 and x86 UAPI headers Jiri Olsa (3): perf: Fix header.size for namespace events perf top: Fix window dimensions change handling perf top: Use signal interface for SIGWINCH handler Namhyung Kim (1): perf help: Fix a bug during strstart() conversion Ravi Bangoria (1): perf annotate: Do not truncate instruction names at 6 chars Satheesh Rajendran (1): perf bench numa: Fixup discontiguous/sparse numa nodes Thomas Richter (3): perf test shell: Fix check open filename arg using 'perf trace' on s390x perf test shell: Fix test case probe libc's inet_pton on s390x perf test: Fix test 21 for s390x Vasily Averin (1): perf/core: Fix memory leak triggered by perf --namespace kernel/events/core.c | 5 +- tools/arch/arm/include/uapi/asm/kvm.h | 7 + tools/arch/arm64/include/uapi/asm/kvm.h| 7 + tools/arch/s390/include/uapi/asm/kvm.h | 4 - tools/arch/s390/include/uapi/asm/kvm_perf.h| 4 - tools/arch/x86/include/asm/cpufeatures.h | 537 +++-- tools/arch/x86/include/asm/disabled-features.h | 8 +- tools/include/uapi/asm-generic/mman.h | 1 + tools/include/uapi/drm/drm.h | 41 ++ tools/include/uapi/drm/i915_drm.h | 33 +- tools/include/uapi/linux/kcmp.h| 1 + tools/include/uapi/linux/kvm.h | 1 + tools/include/uapi/linux/perf_event.h | 1 + tools/include/uapi/linux/prctl.h | 10 + tools/perf/bench/numa.c| 56 ++- tools/perf/builtin-help.c | 4 +- tools/perf/builtin-record.c| 42 +- tools/perf/builtin-report.c| 3 + tools/perf/builtin-script.c| 31 +- tools/perf/builtin-top.c | 36 +- tools/perf/builtin-trace.c | 6 +- .../perf/tests/shell/trace+probe_libc_inet_pton.sh | 7 +- tools/perf/tests/shell/trace+probe_vfs_getname.sh | 6 +- tools/perf/tests/task-exit.c | 4 + tools/perf/trace/beauty/mmap.c | 3 + tools/perf/util/annotate.c | 18 +- tools/perf/util/evlist.c | 14 +- tools/perf/util/evlist.h | 2 + tools/perf/util/evsel.c| 14 +- tools/perf/util/evsel.h| 1 + tools/perf/util/intel-pt-decoder/inat.h| 10 + .../perf/util/intel-pt-decoder/x86-opcode-map.txt | 2 +- tools/perf/util/machine.c | 3 + tools/perf/util/parse-events.c | 2 + tools/perf/util/parse-events.h | 3 + tools/perf/util/pmu.c | 5 + 36 files changed, 594 insertions(+), 338 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 16beab4767e1..5961ef6dfd64 100644 ---
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 4a31b424ac0656d1bb17520ee861144fe7a19664 perf/core: Fix memory leak triggered by perf --namespace Misc fixes: two PMU driver fixes and a memory leak fix. Thanks, Ingo --> Andi Kleen (1): perf/x86/intel: Hide TSX events when RTM is not supported Kan Liang (1): perf/x86/intel/uncore: Add event constraint for BDX PCU Vasily Averin (1): perf/core: Fix memory leak triggered by perf --namespace arch/x86/events/intel/core.c | 35 +++ arch/x86/events/intel/uncore_snbep.c | 8 kernel/events/core.c | 1 + 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 9fb9a1f1e47b..f94855000d4e 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -3730,6 +3730,19 @@ EVENT_ATTR_STR(cycles-t, cycles_t, "event=0x3c,in_tx=1"); EVENT_ATTR_STR(cycles-ct, cycles_ct, "event=0x3c,in_tx=1,in_tx_cp=1"); static struct attribute *hsw_events_attrs[] = { + EVENT_PTR(mem_ld_hsw), + EVENT_PTR(mem_st_hsw), + EVENT_PTR(td_slots_issued), + EVENT_PTR(td_slots_retired), + EVENT_PTR(td_fetch_bubbles), + EVENT_PTR(td_total_slots), + EVENT_PTR(td_total_slots_scale), + EVENT_PTR(td_recovery_bubbles), + EVENT_PTR(td_recovery_bubbles_scale), + NULL +}; + +static struct attribute *hsw_tsx_events_attrs[] = { EVENT_PTR(tx_start), EVENT_PTR(tx_commit), EVENT_PTR(tx_abort), @@ -3742,18 +3755,16 @@ static struct attribute *hsw_events_attrs[] = { EVENT_PTR(el_conflict), EVENT_PTR(cycles_t), EVENT_PTR(cycles_ct), - EVENT_PTR(mem_ld_hsw), - EVENT_PTR(mem_st_hsw), - EVENT_PTR(td_slots_issued), - EVENT_PTR(td_slots_retired), - EVENT_PTR(td_fetch_bubbles), - EVENT_PTR(td_total_slots), - EVENT_PTR(td_total_slots_scale), - EVENT_PTR(td_recovery_bubbles), - EVENT_PTR(td_recovery_bubbles_scale), NULL }; +static __init struct attribute **get_hsw_events_attrs(void) +{ + return boot_cpu_has(X86_FEATURE_RTM) ? + merge_attr(hsw_events_attrs, hsw_tsx_events_attrs) : + hsw_events_attrs; +} + static ssize_t freeze_on_smi_show(struct device *cdev, struct device_attribute *attr, char *buf) @@ -4182,7 +4193,7 @@ __init int intel_pmu_init(void) x86_pmu.hw_config = hsw_hw_config; x86_pmu.get_event_constraints = hsw_get_event_constraints; - x86_pmu.cpu_events = hsw_events_attrs; + x86_pmu.cpu_events = get_hsw_events_attrs(); x86_pmu.lbr_double_abort = true; extra_attr = boot_cpu_has(X86_FEATURE_RTM) ? hsw_format_attr : nhm_format_attr; @@ -4221,7 +4232,7 @@ __init int intel_pmu_init(void) x86_pmu.hw_config = hsw_hw_config; x86_pmu.get_event_constraints = hsw_get_event_constraints; - x86_pmu.cpu_events = hsw_events_attrs; + x86_pmu.cpu_events = get_hsw_events_attrs(); x86_pmu.limit_period = bdw_limit_period; extra_attr = boot_cpu_has(X86_FEATURE_RTM) ? hsw_format_attr : nhm_format_attr; @@ -4279,7 +4290,7 @@ __init int intel_pmu_init(void) extra_attr = boot_cpu_has(X86_FEATURE_RTM) ? hsw_format_attr : nhm_format_attr; extra_attr = merge_attr(extra_attr, skl_format_attr); - x86_pmu.cpu_events = hsw_events_attrs; + x86_pmu.cpu_events = get_hsw_events_attrs(); intel_pmu_pebs_data_source_skl( boot_cpu_data.x86_model == INTEL_FAM6_SKYLAKE_X); pr_cont("Skylake events, "); diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c index 95cb19f4e06f..f4e4168455a8 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c @@ -3035,11 +3035,19 @@ static struct intel_uncore_type *bdx_msr_uncores[] = { NULL, }; +/* Bit 7 'Use Occupancy' is not available for counter 0 on BDX */ +static struct event_constraint bdx_uncore_pcu_constraints[] = { + EVENT_CONSTRAINT(0x80, 0xe, 0x80), + EVENT_CONSTRAINT_END +}; + void bdx_uncore_cpu_init(void) { if (bdx_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores) bdx_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores; uncore_msr_uncores = bdx_msr_uncores; + + hswep_uncore_pcu.constraints = bdx_uncore_pcu_constraints; } static struct intel_uncore_type bdx_uncore_ha = { diff --git
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: 4a31b424ac0656d1bb17520ee861144fe7a19664 perf/core: Fix memory leak triggered by perf --namespace Misc fixes: two PMU driver fixes and a memory leak fix. Thanks, Ingo --> Andi Kleen (1): perf/x86/intel: Hide TSX events when RTM is not supported Kan Liang (1): perf/x86/intel/uncore: Add event constraint for BDX PCU Vasily Averin (1): perf/core: Fix memory leak triggered by perf --namespace arch/x86/events/intel/core.c | 35 +++ arch/x86/events/intel/uncore_snbep.c | 8 kernel/events/core.c | 1 + 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 9fb9a1f1e47b..f94855000d4e 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -3730,6 +3730,19 @@ EVENT_ATTR_STR(cycles-t, cycles_t, "event=0x3c,in_tx=1"); EVENT_ATTR_STR(cycles-ct, cycles_ct, "event=0x3c,in_tx=1,in_tx_cp=1"); static struct attribute *hsw_events_attrs[] = { + EVENT_PTR(mem_ld_hsw), + EVENT_PTR(mem_st_hsw), + EVENT_PTR(td_slots_issued), + EVENT_PTR(td_slots_retired), + EVENT_PTR(td_fetch_bubbles), + EVENT_PTR(td_total_slots), + EVENT_PTR(td_total_slots_scale), + EVENT_PTR(td_recovery_bubbles), + EVENT_PTR(td_recovery_bubbles_scale), + NULL +}; + +static struct attribute *hsw_tsx_events_attrs[] = { EVENT_PTR(tx_start), EVENT_PTR(tx_commit), EVENT_PTR(tx_abort), @@ -3742,18 +3755,16 @@ static struct attribute *hsw_events_attrs[] = { EVENT_PTR(el_conflict), EVENT_PTR(cycles_t), EVENT_PTR(cycles_ct), - EVENT_PTR(mem_ld_hsw), - EVENT_PTR(mem_st_hsw), - EVENT_PTR(td_slots_issued), - EVENT_PTR(td_slots_retired), - EVENT_PTR(td_fetch_bubbles), - EVENT_PTR(td_total_slots), - EVENT_PTR(td_total_slots_scale), - EVENT_PTR(td_recovery_bubbles), - EVENT_PTR(td_recovery_bubbles_scale), NULL }; +static __init struct attribute **get_hsw_events_attrs(void) +{ + return boot_cpu_has(X86_FEATURE_RTM) ? + merge_attr(hsw_events_attrs, hsw_tsx_events_attrs) : + hsw_events_attrs; +} + static ssize_t freeze_on_smi_show(struct device *cdev, struct device_attribute *attr, char *buf) @@ -4182,7 +4193,7 @@ __init int intel_pmu_init(void) x86_pmu.hw_config = hsw_hw_config; x86_pmu.get_event_constraints = hsw_get_event_constraints; - x86_pmu.cpu_events = hsw_events_attrs; + x86_pmu.cpu_events = get_hsw_events_attrs(); x86_pmu.lbr_double_abort = true; extra_attr = boot_cpu_has(X86_FEATURE_RTM) ? hsw_format_attr : nhm_format_attr; @@ -4221,7 +4232,7 @@ __init int intel_pmu_init(void) x86_pmu.hw_config = hsw_hw_config; x86_pmu.get_event_constraints = hsw_get_event_constraints; - x86_pmu.cpu_events = hsw_events_attrs; + x86_pmu.cpu_events = get_hsw_events_attrs(); x86_pmu.limit_period = bdw_limit_period; extra_attr = boot_cpu_has(X86_FEATURE_RTM) ? hsw_format_attr : nhm_format_attr; @@ -4279,7 +4290,7 @@ __init int intel_pmu_init(void) extra_attr = boot_cpu_has(X86_FEATURE_RTM) ? hsw_format_attr : nhm_format_attr; extra_attr = merge_attr(extra_attr, skl_format_attr); - x86_pmu.cpu_events = hsw_events_attrs; + x86_pmu.cpu_events = get_hsw_events_attrs(); intel_pmu_pebs_data_source_skl( boot_cpu_data.x86_model == INTEL_FAM6_SKYLAKE_X); pr_cont("Skylake events, "); diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c index 95cb19f4e06f..f4e4168455a8 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c @@ -3035,11 +3035,19 @@ static struct intel_uncore_type *bdx_msr_uncores[] = { NULL, }; +/* Bit 7 'Use Occupancy' is not available for counter 0 on BDX */ +static struct event_constraint bdx_uncore_pcu_constraints[] = { + EVENT_CONSTRAINT(0x80, 0xe, 0x80), + EVENT_CONSTRAINT_END +}; + void bdx_uncore_cpu_init(void) { if (bdx_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores) bdx_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores; uncore_msr_uncores = bdx_msr_uncores; + + hswep_uncore_pcu.constraints = bdx_uncore_pcu_constraints; } static struct intel_uncore_type bdx_uncore_ha = { diff --git
[GIT pull] perf fixes for 4.14
Linus, please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus A small set of fixes for perf tool: - Synchronize the i915 drm header to avoid the 'out of date' warning - Make sure that perf trace cleans up its temporary files on exit - Unbreak the build with newer flex versions - Add missing braces in the eBPF parsing rules Thanks, tglx --> Andrei Vagin (1): perf trace: Call machine__exit() at exit Ingo Molnar (1): tooling/headers: Sync the tools/include/uapi/drm/i915_drm.h UAPI header Jiri Olsa (2): perf tools: Add "reject" option for parse-events.l perf tools: Fix eBPF event specification parsing tools/include/uapi/drm/i915_drm.h | 1 + tools/perf/builtin-trace.c| 10 ++ tools/perf/util/parse-events.l| 5 +++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/include/uapi/drm/i915_drm.h b/tools/include/uapi/drm/i915_drm.h index 6598fb76d2c2..9816590d3ad2 100644 --- a/tools/include/uapi/drm/i915_drm.h +++ b/tools/include/uapi/drm/i915_drm.h @@ -829,6 +829,7 @@ struct drm_i915_gem_exec_fence { #define I915_EXEC_FENCE_WAIT(1<<0) #define I915_EXEC_FENCE_SIGNAL (1<<1) +#define __I915_EXEC_FENCE_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SIGNAL << 1)) __u32 flags; }; diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 771ddab94bb0..d5d7fff1c211 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -1138,6 +1138,14 @@ static int trace__symbols_init(struct trace *trace, struct perf_evlist *evlist) return err; } +static void trace__symbols__exit(struct trace *trace) +{ + machine__exit(trace->host); + trace->host = NULL; + + symbol__exit(); +} + static int syscall__alloc_arg_fmts(struct syscall *sc, int nr_args) { int idx; @@ -2481,6 +2489,8 @@ static int trace__run(struct trace *trace, int argc, const char **argv) } out_delete_evlist: + trace__symbols__exit(trace); + perf_evlist__delete(evlist); trace->evlist = NULL; trace->live = false; diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l index 6680e4fb7967..025729510525 100644 --- a/tools/perf/util/parse-events.l +++ b/tools/perf/util/parse-events.l @@ -5,6 +5,7 @@ %option stack %option bison-locations %option yylineno +%option reject %{ #include @@ -339,8 +340,8 @@ r{num_raw_hex} { return raw(yyscanner); } {num_hex} { return value(yyscanner, 16); } {modifier_event} { return str(yyscanner, PE_MODIFIER_EVENT); } -{bpf_object} { if (!isbpf(yyscanner)) USER_REJECT; return str(yyscanner, PE_BPF_OBJECT); } -{bpf_source} { if (!isbpf(yyscanner)) USER_REJECT; return str(yyscanner, PE_BPF_SOURCE); } +{bpf_object} { if (!isbpf(yyscanner)) { USER_REJECT }; return str(yyscanner, PE_BPF_OBJECT); } +{bpf_source} { if (!isbpf(yyscanner)) { USER_REJECT }; return str(yyscanner, PE_BPF_SOURCE); } {name} { return pmu_str_check(yyscanner); } "/"{ BEGIN(config); return '/'; } - { return '-'; }
[GIT pull] perf fixes for 4.14
Linus, please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus A small set of fixes for perf tool: - Synchronize the i915 drm header to avoid the 'out of date' warning - Make sure that perf trace cleans up its temporary files on exit - Unbreak the build with newer flex versions - Add missing braces in the eBPF parsing rules Thanks, tglx --> Andrei Vagin (1): perf trace: Call machine__exit() at exit Ingo Molnar (1): tooling/headers: Sync the tools/include/uapi/drm/i915_drm.h UAPI header Jiri Olsa (2): perf tools: Add "reject" option for parse-events.l perf tools: Fix eBPF event specification parsing tools/include/uapi/drm/i915_drm.h | 1 + tools/perf/builtin-trace.c| 10 ++ tools/perf/util/parse-events.l| 5 +++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/include/uapi/drm/i915_drm.h b/tools/include/uapi/drm/i915_drm.h index 6598fb76d2c2..9816590d3ad2 100644 --- a/tools/include/uapi/drm/i915_drm.h +++ b/tools/include/uapi/drm/i915_drm.h @@ -829,6 +829,7 @@ struct drm_i915_gem_exec_fence { #define I915_EXEC_FENCE_WAIT(1<<0) #define I915_EXEC_FENCE_SIGNAL (1<<1) +#define __I915_EXEC_FENCE_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SIGNAL << 1)) __u32 flags; }; diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 771ddab94bb0..d5d7fff1c211 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -1138,6 +1138,14 @@ static int trace__symbols_init(struct trace *trace, struct perf_evlist *evlist) return err; } +static void trace__symbols__exit(struct trace *trace) +{ + machine__exit(trace->host); + trace->host = NULL; + + symbol__exit(); +} + static int syscall__alloc_arg_fmts(struct syscall *sc, int nr_args) { int idx; @@ -2481,6 +2489,8 @@ static int trace__run(struct trace *trace, int argc, const char **argv) } out_delete_evlist: + trace__symbols__exit(trace); + perf_evlist__delete(evlist); trace->evlist = NULL; trace->live = false; diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l index 6680e4fb7967..025729510525 100644 --- a/tools/perf/util/parse-events.l +++ b/tools/perf/util/parse-events.l @@ -5,6 +5,7 @@ %option stack %option bison-locations %option yylineno +%option reject %{ #include @@ -339,8 +340,8 @@ r{num_raw_hex} { return raw(yyscanner); } {num_hex} { return value(yyscanner, 16); } {modifier_event} { return str(yyscanner, PE_MODIFIER_EVENT); } -{bpf_object} { if (!isbpf(yyscanner)) USER_REJECT; return str(yyscanner, PE_BPF_OBJECT); } -{bpf_source} { if (!isbpf(yyscanner)) USER_REJECT; return str(yyscanner, PE_BPF_SOURCE); } +{bpf_object} { if (!isbpf(yyscanner)) { USER_REJECT }; return str(yyscanner, PE_BPF_OBJECT); } +{bpf_source} { if (!isbpf(yyscanner)) { USER_REJECT }; return str(yyscanner, PE_BPF_SOURCE); } {name} { return pmu_str_check(yyscanner); } "/"{ BEGIN(config); return '/'; } - { return '-'; }
Re: [GIT PULL] perf fixes
On 2017.11.05 at 15:40 +0100, Ingo Molnar wrote: > Linus, > > Please pull the latest perf-urgent-for-linus git tree from: > >git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus > > Jiri Olsa (1): > perf tools: Unwind properly location after REJECT The patch above breaks the build for me: util/parse-events.l: In function ‘parse_events_lex’: util/parse-events-flex.c:4722:16: error: ‘reject_used_but_not_detected’ undeclared (first use in this function) */ ^ util/parse-events.l:159:2: note: in expansion of macro ‘REJECT’ REJECT ^~ util/parse-events.l:343:26: note: in expansion of macro ‘USER_REJECT’ {bpf_source} { if (!isbpf(yyscanner)) USER_REJECT; return str(yyscanner, PE_BPF_SOURCE); } ^~~ util/parse-events-flex.c:4722:16: note: each undeclared identifier is reported only once for each function it appears in */ ^ util/parse-events.l:159:2: note: in expansion of macro ‘REJECT’ REJECT ^~ util/parse-events.l:343:26: note: in expansion of macro ‘USER_REJECT’ {bpf_source} { if (!isbpf(yyscanner)) USER_REJECT; return str(yyscanner, PE_BPF_SOURCE); } ^~~ mv: cannot stat 'util/.parse-events-flex.o.tmp': No such file or directory -- Markus
Re: [GIT PULL] perf fixes
On 2017.11.05 at 15:40 +0100, Ingo Molnar wrote: > Linus, > > Please pull the latest perf-urgent-for-linus git tree from: > >git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git > perf-urgent-for-linus > > Jiri Olsa (1): > perf tools: Unwind properly location after REJECT The patch above breaks the build for me: util/parse-events.l: In function ‘parse_events_lex’: util/parse-events-flex.c:4722:16: error: ‘reject_used_but_not_detected’ undeclared (first use in this function) */ ^ util/parse-events.l:159:2: note: in expansion of macro ‘REJECT’ REJECT ^~ util/parse-events.l:343:26: note: in expansion of macro ‘USER_REJECT’ {bpf_source} { if (!isbpf(yyscanner)) USER_REJECT; return str(yyscanner, PE_BPF_SOURCE); } ^~~ util/parse-events-flex.c:4722:16: note: each undeclared identifier is reported only once for each function it appears in */ ^ util/parse-events.l:159:2: note: in expansion of macro ‘REJECT’ REJECT ^~ util/parse-events.l:343:26: note: in expansion of macro ‘USER_REJECT’ {bpf_source} { if (!isbpf(yyscanner)) USER_REJECT; return str(yyscanner, PE_BPF_SOURCE); } ^~~ mv: cannot stat 'util/.parse-events-flex.o.tmp': No such file or directory -- Markus
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: fb7df12d645cfba6a76a45fdcc7e3f7fbbcda661 tools/headers: Synchronize kernel ABI headers Various fixes: - synchronize kernel and tooling headers - cgroup support fix - two tooling fixes Thanks, Ingo --> Ingo Molnar (1): tools/headers: Synchronize kernel ABI headers Jiri Olsa (1): perf tools: Unwind properly location after REJECT Ravi Bangoria (1): perf symbols: Fix memory corruption because of zero length symbols Tejun Heo (1): perf/cgroup: Fix perf cgroup hierarchy support include/uapi/sound/asound.h | 6 +++--- kernel/events/core.c | 6 -- tools/arch/x86/include/asm/disabled-features.h | 1 - tools/arch/x86/include/asm/required-features.h | 1 - tools/arch/x86/include/uapi/asm/unistd.h | 1 + tools/arch/x86/lib/memcpy_64.S | 5 - tools/include/asm-generic/bitops/__fls.h | 1 + tools/include/asm-generic/bitops/arch_hweight.h | 1 + tools/include/asm-generic/bitops/const_hweight.h | 1 + tools/include/asm-generic/bitops/fls.h | 1 + tools/include/asm-generic/bitops/fls64.h | 1 + tools/include/asm/export.h | 7 +++ tools/include/linux/hash.h | 1 - tools/include/uapi/asm-generic/ioctls.h | 1 + tools/include/uapi/asm-generic/mman-common.h | 1 + tools/include/uapi/asm-generic/mman.h| 4 ++-- tools/include/uapi/linux/bpf.h | 4 ++-- tools/include/uapi/linux/bpf_common.h| 2 +- tools/include/uapi/linux/fcntl.h | 2 +- tools/include/uapi/linux/hw_breakpoint.h | 2 +- tools/include/uapi/linux/kvm.h | 1 + tools/include/uapi/linux/mman.h | 2 +- tools/include/uapi/linux/perf_event.h| 1 + tools/include/uapi/linux/sched.h | 1 + tools/include/uapi/linux/stat.h | 2 +- tools/include/uapi/linux/vhost.h | 1 + tools/include/uapi/sound/asound.h| 1 + tools/perf/util/annotate.c | 12 +++- tools/perf/util/parse-events.l | 8 ++-- 29 files changed, 57 insertions(+), 21 deletions(-) create mode 100644 tools/include/asm/export.h diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h index 299a822d2c4e..c227ccba60ae 100644 --- a/include/uapi/sound/asound.h +++ b/include/uapi/sound/asound.h @@ -94,7 +94,7 @@ enum { SNDRV_HWDEP_IFACE_VX, /* Digigram VX cards */ SNDRV_HWDEP_IFACE_MIXART, /* Digigram miXart cards */ SNDRV_HWDEP_IFACE_USX2Y,/* Tascam US122, US224 & US428 usb */ - SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */ + SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */ SNDRV_HWDEP_IFACE_BLUETOOTH,/* Bluetooth audio */ SNDRV_HWDEP_IFACE_USX2Y_PCM,/* Tascam US122, US224 & US428 rawusb pcm */ SNDRV_HWDEP_IFACE_PCXHR,/* Digigram PCXHR */ @@ -384,7 +384,7 @@ struct snd_mask { struct snd_pcm_hw_params { unsigned int flags; - struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - + struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; struct snd_mask mres[5];/* reserved masks */ struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - @@ -857,7 +857,7 @@ typedef int __bitwise snd_ctl_elem_iface_t; #define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */ #define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */ #define SNDRV_CTL_ELEM_ACCESS_OWNER(1<<10) /* write lock owner */ -#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */ +#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */ #define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */ /* bits 30 and 31 are obsoleted (for indirect access) */ diff --git a/kernel/events/core.c b/kernel/events/core.c index 9d93db81fa36..10cdb9c26b5d 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -901,9 +901,11 @@ list_update_cgroup_event(struct perf_event *event, cpuctx_entry = >cgrp_cpuctx_entry; /* cpuctx->cgrp is NULL unless a cgroup event is active in this CPU .*/ if (add) { + struct perf_cgroup *cgrp = perf_cgroup_from_task(current, ctx); + list_add(cpuctx_entry, this_cpu_ptr(_cpuctx_list)); - if (perf_cgroup_from_task(current, ctx) == event->cgrp) - cpuctx->cgrp = event->cgrp; + if
[GIT PULL] perf fixes
Linus, Please pull the latest perf-urgent-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus # HEAD: fb7df12d645cfba6a76a45fdcc7e3f7fbbcda661 tools/headers: Synchronize kernel ABI headers Various fixes: - synchronize kernel and tooling headers - cgroup support fix - two tooling fixes Thanks, Ingo --> Ingo Molnar (1): tools/headers: Synchronize kernel ABI headers Jiri Olsa (1): perf tools: Unwind properly location after REJECT Ravi Bangoria (1): perf symbols: Fix memory corruption because of zero length symbols Tejun Heo (1): perf/cgroup: Fix perf cgroup hierarchy support include/uapi/sound/asound.h | 6 +++--- kernel/events/core.c | 6 -- tools/arch/x86/include/asm/disabled-features.h | 1 - tools/arch/x86/include/asm/required-features.h | 1 - tools/arch/x86/include/uapi/asm/unistd.h | 1 + tools/arch/x86/lib/memcpy_64.S | 5 - tools/include/asm-generic/bitops/__fls.h | 1 + tools/include/asm-generic/bitops/arch_hweight.h | 1 + tools/include/asm-generic/bitops/const_hweight.h | 1 + tools/include/asm-generic/bitops/fls.h | 1 + tools/include/asm-generic/bitops/fls64.h | 1 + tools/include/asm/export.h | 7 +++ tools/include/linux/hash.h | 1 - tools/include/uapi/asm-generic/ioctls.h | 1 + tools/include/uapi/asm-generic/mman-common.h | 1 + tools/include/uapi/asm-generic/mman.h| 4 ++-- tools/include/uapi/linux/bpf.h | 4 ++-- tools/include/uapi/linux/bpf_common.h| 2 +- tools/include/uapi/linux/fcntl.h | 2 +- tools/include/uapi/linux/hw_breakpoint.h | 2 +- tools/include/uapi/linux/kvm.h | 1 + tools/include/uapi/linux/mman.h | 2 +- tools/include/uapi/linux/perf_event.h| 1 + tools/include/uapi/linux/sched.h | 1 + tools/include/uapi/linux/stat.h | 2 +- tools/include/uapi/linux/vhost.h | 1 + tools/include/uapi/sound/asound.h| 1 + tools/perf/util/annotate.c | 12 +++- tools/perf/util/parse-events.l | 8 ++-- 29 files changed, 57 insertions(+), 21 deletions(-) create mode 100644 tools/include/asm/export.h diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h index 299a822d2c4e..c227ccba60ae 100644 --- a/include/uapi/sound/asound.h +++ b/include/uapi/sound/asound.h @@ -94,7 +94,7 @@ enum { SNDRV_HWDEP_IFACE_VX, /* Digigram VX cards */ SNDRV_HWDEP_IFACE_MIXART, /* Digigram miXart cards */ SNDRV_HWDEP_IFACE_USX2Y,/* Tascam US122, US224 & US428 usb */ - SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */ + SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */ SNDRV_HWDEP_IFACE_BLUETOOTH,/* Bluetooth audio */ SNDRV_HWDEP_IFACE_USX2Y_PCM,/* Tascam US122, US224 & US428 rawusb pcm */ SNDRV_HWDEP_IFACE_PCXHR,/* Digigram PCXHR */ @@ -384,7 +384,7 @@ struct snd_mask { struct snd_pcm_hw_params { unsigned int flags; - struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - + struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; struct snd_mask mres[5];/* reserved masks */ struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - @@ -857,7 +857,7 @@ typedef int __bitwise snd_ctl_elem_iface_t; #define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */ #define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */ #define SNDRV_CTL_ELEM_ACCESS_OWNER(1<<10) /* write lock owner */ -#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */ +#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */ #define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */ /* bits 30 and 31 are obsoleted (for indirect access) */ diff --git a/kernel/events/core.c b/kernel/events/core.c index 9d93db81fa36..10cdb9c26b5d 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -901,9 +901,11 @@ list_update_cgroup_event(struct perf_event *event, cpuctx_entry = >cgrp_cpuctx_entry; /* cpuctx->cgrp is NULL unless a cgroup event is active in this CPU .*/ if (add) { + struct perf_cgroup *cgrp = perf_cgroup_from_task(current, ctx); + list_add(cpuctx_entry, this_cpu_ptr(_cpuctx_list)); - if (perf_cgroup_from_task(current, ctx) == event->cgrp) - cpuctx->cgrp = event->cgrp; + if