summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-03-31 11:37:04 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-03-31 11:37:04 -0400
commit590627f755bc385bd2b2fbd87de312a462889222 (patch)
tree2226c82bfccfbdbf7c08fc526ed2cfda38c36138 /tools
parentc29d85417c5f9a0a970ebd2571b65f0d52f110f5 (diff)
parent22261fdf68f23df3ddf359642696d6ce98e584fa (diff)
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf tooling fixes from Thomas Gleixner: "Core libraries: - Fix max perf_event_attr.precise_ip detection. - Fix parser error for uncore event alias - Fixup ordering of kernel maps after obtaining the main kernel map address. Intel PT: - Fix TSC slip where A TSC packet can slip past MTC packets so that the timestamp appears to go backwards. - Fixes for exported-sql-viewer GUI conversion to python3. ARM coresight: - Fix the build by adding a missing case value for enumeration value introduced in newer library, that now is the required one. tool headers: - Syncronize kernel headers with the kernel, getting new io_uring and pidfd_send_signal syscalls so that 'perf trace' can handle them" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf pmu: Fix parser error for uncore event alias perf scripts python: exported-sql-viewer.py: Fix python3 support perf scripts python: exported-sql-viewer.py: Fix never-ending loop perf machine: Update kernel map address and re-order properly tools headers uapi: Sync powerpc's asm/kvm.h copy with the kernel sources tools headers: Update x86's syscall_64.tbl and uapi/asm-generic/unistd tools headers uapi: Update drm/i915_drm.h tools arch x86: Sync asm/cpufeatures.h with the kernel sources tools headers uapi: Sync linux/fcntl.h to get the F_SEAL_FUTURE_WRITE addition tools headers uapi: Sync asm-generic/mman-common.h and linux/mman.h perf evsel: Fix max perf_event_attr.precise_ip detection perf intel-pt: Fix TSC slip perf cs-etm: Add missing case value
Diffstat (limited to 'tools')
-rw-r--r--tools/arch/alpha/include/uapi/asm/mman.h2
-rw-r--r--tools/arch/mips/include/uapi/asm/mman.h2
-rw-r--r--tools/arch/parisc/include/uapi/asm/mman.h2
-rw-r--r--tools/arch/powerpc/include/uapi/asm/kvm.h2
-rw-r--r--tools/arch/x86/include/asm/cpufeatures.h1
-rw-r--r--tools/arch/xtensa/include/uapi/asm/mman.h2
-rw-r--r--tools/build/feature/test-libopencsd.c4
-rw-r--r--tools/include/uapi/asm-generic/mman-common-tools.h23
-rw-r--r--tools/include/uapi/asm-generic/mman-common.h4
-rw-r--r--tools/include/uapi/asm-generic/mman.h2
-rw-r--r--tools/include/uapi/asm-generic/unistd.h11
-rw-r--r--tools/include/uapi/drm/i915_drm.h64
-rw-r--r--tools/include/uapi/linux/fcntl.h1
-rw-r--r--tools/include/uapi/linux/mman.h4
-rw-r--r--tools/perf/Makefile.perf4
-rw-r--r--tools/perf/arch/x86/entry/syscalls/syscall_64.tbl4
-rwxr-xr-xtools/perf/check-headers.sh2
-rwxr-xr-xtools/perf/scripts/python/exported-sql-viewer.py77
-rwxr-xr-xtools/perf/trace/beauty/mmap_flags.sh14
-rw-r--r--tools/perf/util/cs-etm-decoder/cs-etm-decoder.c1
-rw-r--r--tools/perf/util/evlist.c29
-rw-r--r--tools/perf/util/evlist.h2
-rw-r--r--tools/perf/util/evsel.c72
-rw-r--r--tools/perf/util/intel-pt-decoder/intel-pt-decoder.c20
-rw-r--r--tools/perf/util/machine.c32
-rw-r--r--tools/perf/util/pmu.c10
26 files changed, 288 insertions, 103 deletions
diff --git a/tools/arch/alpha/include/uapi/asm/mman.h b/tools/arch/alpha/include/uapi/asm/mman.h
index c317d3e6867a..ea6a255ae61f 100644
--- a/tools/arch/alpha/include/uapi/asm/mman.h
+++ b/tools/arch/alpha/include/uapi/asm/mman.h
@@ -27,8 +27,6 @@
27#define MAP_NONBLOCK 0x40000 27#define MAP_NONBLOCK 0x40000
28#define MAP_NORESERVE 0x10000 28#define MAP_NORESERVE 0x10000
29#define MAP_POPULATE 0x20000 29#define MAP_POPULATE 0x20000
30#define MAP_PRIVATE 0x02
31#define MAP_SHARED 0x01
32#define MAP_STACK 0x80000 30#define MAP_STACK 0x80000
33#define PROT_EXEC 0x4 31#define PROT_EXEC 0x4
34#define PROT_GROWSDOWN 0x01000000 32#define PROT_GROWSDOWN 0x01000000
diff --git a/tools/arch/mips/include/uapi/asm/mman.h b/tools/arch/mips/include/uapi/asm/mman.h
index de2206883abc..c8acaa138d46 100644
--- a/tools/arch/mips/include/uapi/asm/mman.h
+++ b/tools/arch/mips/include/uapi/asm/mman.h
@@ -28,8 +28,6 @@
28#define MAP_NONBLOCK 0x20000 28#define MAP_NONBLOCK 0x20000
29#define MAP_NORESERVE 0x0400 29#define MAP_NORESERVE 0x0400
30#define MAP_POPULATE 0x10000 30#define MAP_POPULATE 0x10000
31#define MAP_PRIVATE 0x002
32#define MAP_SHARED 0x001
33#define MAP_STACK 0x40000 31#define MAP_STACK 0x40000
34#define PROT_EXEC 0x04 32#define PROT_EXEC 0x04
35#define PROT_GROWSDOWN 0x01000000 33#define PROT_GROWSDOWN 0x01000000
diff --git a/tools/arch/parisc/include/uapi/asm/mman.h b/tools/arch/parisc/include/uapi/asm/mman.h
index 1bd78758bde9..f9fd1325f5bd 100644
--- a/tools/arch/parisc/include/uapi/asm/mman.h
+++ b/tools/arch/parisc/include/uapi/asm/mman.h
@@ -27,8 +27,6 @@
27#define MAP_NONBLOCK 0x20000 27#define MAP_NONBLOCK 0x20000
28#define MAP_NORESERVE 0x4000 28#define MAP_NORESERVE 0x4000
29#define MAP_POPULATE 0x10000 29#define MAP_POPULATE 0x10000
30#define MAP_PRIVATE 0x02
31#define MAP_SHARED 0x01
32#define MAP_STACK 0x40000 30#define MAP_STACK 0x40000
33#define PROT_EXEC 0x4 31#define PROT_EXEC 0x4
34#define PROT_GROWSDOWN 0x01000000 32#define PROT_GROWSDOWN 0x01000000
diff --git a/tools/arch/powerpc/include/uapi/asm/kvm.h b/tools/arch/powerpc/include/uapi/asm/kvm.h
index 8c876c166ef2..26ca425f4c2c 100644
--- a/tools/arch/powerpc/include/uapi/asm/kvm.h
+++ b/tools/arch/powerpc/include/uapi/asm/kvm.h
@@ -463,10 +463,12 @@ struct kvm_ppc_cpu_char {
463#define KVM_PPC_CPU_CHAR_BR_HINT_HONOURED (1ULL << 58) 463#define KVM_PPC_CPU_CHAR_BR_HINT_HONOURED (1ULL << 58)
464#define KVM_PPC_CPU_CHAR_MTTRIG_THR_RECONF (1ULL << 57) 464#define KVM_PPC_CPU_CHAR_MTTRIG_THR_RECONF (1ULL << 57)
465#define KVM_PPC_CPU_CHAR_COUNT_CACHE_DIS (1ULL << 56) 465#define KVM_PPC_CPU_CHAR_COUNT_CACHE_DIS (1ULL << 56)
466#define KVM_PPC_CPU_CHAR_BCCTR_FLUSH_ASSIST (1ull << 54)
466 467
467#define KVM_PPC_CPU_BEHAV_FAVOUR_SECURITY (1ULL << 63) 468#define KVM_PPC_CPU_BEHAV_FAVOUR_SECURITY (1ULL << 63)
468#define KVM_PPC_CPU_BEHAV_L1D_FLUSH_PR (1ULL << 62) 469#define KVM_PPC_CPU_BEHAV_L1D_FLUSH_PR (1ULL << 62)
469#define KVM_PPC_CPU_BEHAV_BNDS_CHK_SPEC_BAR (1ULL << 61) 470#define KVM_PPC_CPU_BEHAV_BNDS_CHK_SPEC_BAR (1ULL << 61)
471#define KVM_PPC_CPU_BEHAV_FLUSH_COUNT_CACHE (1ull << 58)
470 472
471/* Per-vcpu XICS interrupt controller state */ 473/* Per-vcpu XICS interrupt controller state */
472#define KVM_REG_PPC_ICP_STATE (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8c) 474#define KVM_REG_PPC_ICP_STATE (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8c)
diff --git a/tools/arch/x86/include/asm/cpufeatures.h b/tools/arch/x86/include/asm/cpufeatures.h
index 6d6122524711..981ff9479648 100644
--- a/tools/arch/x86/include/asm/cpufeatures.h
+++ b/tools/arch/x86/include/asm/cpufeatures.h
@@ -344,6 +344,7 @@
344/* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */ 344/* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */
345#define X86_FEATURE_AVX512_4VNNIW (18*32+ 2) /* AVX-512 Neural Network Instructions */ 345#define X86_FEATURE_AVX512_4VNNIW (18*32+ 2) /* AVX-512 Neural Network Instructions */
346#define X86_FEATURE_AVX512_4FMAPS (18*32+ 3) /* AVX-512 Multiply Accumulation Single precision */ 346#define X86_FEATURE_AVX512_4FMAPS (18*32+ 3) /* AVX-512 Multiply Accumulation Single precision */
347#define X86_FEATURE_TSX_FORCE_ABORT (18*32+13) /* "" TSX_FORCE_ABORT */
347#define X86_FEATURE_PCONFIG (18*32+18) /* Intel PCONFIG */ 348#define X86_FEATURE_PCONFIG (18*32+18) /* Intel PCONFIG */
348#define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */ 349#define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */
349#define X86_FEATURE_INTEL_STIBP (18*32+27) /* "" Single Thread Indirect Branch Predictors */ 350#define X86_FEATURE_INTEL_STIBP (18*32+27) /* "" Single Thread Indirect Branch Predictors */
diff --git a/tools/arch/xtensa/include/uapi/asm/mman.h b/tools/arch/xtensa/include/uapi/asm/mman.h
index 34dde6f44dae..f2b08c990afc 100644
--- a/tools/arch/xtensa/include/uapi/asm/mman.h
+++ b/tools/arch/xtensa/include/uapi/asm/mman.h
@@ -27,8 +27,6 @@
27#define MAP_NONBLOCK 0x20000 27#define MAP_NONBLOCK 0x20000
28#define MAP_NORESERVE 0x0400 28#define MAP_NORESERVE 0x0400
29#define MAP_POPULATE 0x10000 29#define MAP_POPULATE 0x10000
30#define MAP_PRIVATE 0x002
31#define MAP_SHARED 0x001
32#define MAP_STACK 0x40000 30#define MAP_STACK 0x40000
33#define PROT_EXEC 0x4 31#define PROT_EXEC 0x4
34#define PROT_GROWSDOWN 0x01000000 32#define PROT_GROWSDOWN 0x01000000
diff --git a/tools/build/feature/test-libopencsd.c b/tools/build/feature/test-libopencsd.c
index d68eb4fb40cc..2b0e02c38870 100644
--- a/tools/build/feature/test-libopencsd.c
+++ b/tools/build/feature/test-libopencsd.c
@@ -4,9 +4,9 @@
4/* 4/*
5 * Check OpenCSD library version is sufficient to provide required features 5 * Check OpenCSD library version is sufficient to provide required features
6 */ 6 */
7#define OCSD_MIN_VER ((0 << 16) | (10 << 8) | (0)) 7#define OCSD_MIN_VER ((0 << 16) | (11 << 8) | (0))
8#if !defined(OCSD_VER_NUM) || (OCSD_VER_NUM < OCSD_MIN_VER) 8#if !defined(OCSD_VER_NUM) || (OCSD_VER_NUM < OCSD_MIN_VER)
9#error "OpenCSD >= 0.10.0 is required" 9#error "OpenCSD >= 0.11.0 is required"
10#endif 10#endif
11 11
12int main(void) 12int main(void)
diff --git a/tools/include/uapi/asm-generic/mman-common-tools.h b/tools/include/uapi/asm-generic/mman-common-tools.h
new file mode 100644
index 000000000000..af7d0d3a3182
--- /dev/null
+++ b/tools/include/uapi/asm-generic/mman-common-tools.h
@@ -0,0 +1,23 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef __ASM_GENERIC_MMAN_COMMON_TOOLS_ONLY_H
3#define __ASM_GENERIC_MMAN_COMMON_TOOLS_ONLY_H
4
5#include <asm-generic/mman-common.h>
6
7/* We need this because we need to have tools/include/uapi/ included in the tools
8 * header search path to get access to stuff that is not yet in the system's
9 * copy of the files in that directory, but since this cset:
10 *
11 * 746c9398f5ac ("arch: move common mmap flags to linux/mman.h")
12 *
13 * We end up making sys/mman.h, that is in the system headers, to not find the
14 * MAP_SHARED and MAP_PRIVATE defines because they are not anymore in our copy
15 * of asm-generic/mman-common.h. So we define them here and include this header
16 * from each of the per arch mman.h headers.
17 */
18#ifndef MAP_SHARED
19#define MAP_SHARED 0x01 /* Share changes */
20#define MAP_PRIVATE 0x02 /* Changes are private */
21#define MAP_SHARED_VALIDATE 0x03 /* share + validate extension flags */
22#endif
23#endif // __ASM_GENERIC_MMAN_COMMON_TOOLS_ONLY_H
diff --git a/tools/include/uapi/asm-generic/mman-common.h b/tools/include/uapi/asm-generic/mman-common.h
index e7ee32861d51..abd238d0f7a4 100644
--- a/tools/include/uapi/asm-generic/mman-common.h
+++ b/tools/include/uapi/asm-generic/mman-common.h
@@ -15,9 +15,7 @@
15#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ 15#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
16#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ 16#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
17 17
18#define MAP_SHARED 0x01 /* Share changes */ 18/* 0x01 - 0x03 are defined in linux/mman.h */
19#define MAP_PRIVATE 0x02 /* Changes are private */
20#define MAP_SHARED_VALIDATE 0x03 /* share + validate extension flags */
21#define MAP_TYPE 0x0f /* Mask for type of mapping */ 19#define MAP_TYPE 0x0f /* Mask for type of mapping */
22#define MAP_FIXED 0x10 /* Interpret addr exactly */ 20#define MAP_FIXED 0x10 /* Interpret addr exactly */
23#define MAP_ANONYMOUS 0x20 /* don't use a file */ 21#define MAP_ANONYMOUS 0x20 /* don't use a file */
diff --git a/tools/include/uapi/asm-generic/mman.h b/tools/include/uapi/asm-generic/mman.h
index 653687d9771b..36c197fc44a0 100644
--- a/tools/include/uapi/asm-generic/mman.h
+++ b/tools/include/uapi/asm-generic/mman.h
@@ -2,7 +2,7 @@
2#ifndef __ASM_GENERIC_MMAN_H 2#ifndef __ASM_GENERIC_MMAN_H
3#define __ASM_GENERIC_MMAN_H 3#define __ASM_GENERIC_MMAN_H
4 4
5#include <asm-generic/mman-common.h> 5#include <asm-generic/mman-common-tools.h>
6 6
7#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ 7#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
8#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ 8#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
diff --git a/tools/include/uapi/asm-generic/unistd.h b/tools/include/uapi/asm-generic/unistd.h
index 12cdf611d217..dee7292e1df6 100644
--- a/tools/include/uapi/asm-generic/unistd.h
+++ b/tools/include/uapi/asm-generic/unistd.h
@@ -824,8 +824,17 @@ __SYSCALL(__NR_futex_time64, sys_futex)
824__SYSCALL(__NR_sched_rr_get_interval_time64, sys_sched_rr_get_interval) 824__SYSCALL(__NR_sched_rr_get_interval_time64, sys_sched_rr_get_interval)
825#endif 825#endif
826 826
827#define __NR_pidfd_send_signal 424
828__SYSCALL(__NR_pidfd_send_signal, sys_pidfd_send_signal)
829#define __NR_io_uring_setup 425
830__SYSCALL(__NR_io_uring_setup, sys_io_uring_setup)
831#define __NR_io_uring_enter 426
832__SYSCALL(__NR_io_uring_enter, sys_io_uring_enter)
833#define __NR_io_uring_register 427
834__SYSCALL(__NR_io_uring_register, sys_io_uring_register)
835
827#undef __NR_syscalls 836#undef __NR_syscalls
828#define __NR_syscalls 424 837#define __NR_syscalls 428
829 838
830/* 839/*
831 * 32 bit systems traditionally used different 840 * 32 bit systems traditionally used different
diff --git a/tools/include/uapi/drm/i915_drm.h b/tools/include/uapi/drm/i915_drm.h
index 298b2e197744..397810fa2d33 100644
--- a/tools/include/uapi/drm/i915_drm.h
+++ b/tools/include/uapi/drm/i915_drm.h
@@ -1486,9 +1486,73 @@ struct drm_i915_gem_context_param {
1486#define I915_CONTEXT_MAX_USER_PRIORITY 1023 /* inclusive */ 1486#define I915_CONTEXT_MAX_USER_PRIORITY 1023 /* inclusive */
1487#define I915_CONTEXT_DEFAULT_PRIORITY 0 1487#define I915_CONTEXT_DEFAULT_PRIORITY 0
1488#define I915_CONTEXT_MIN_USER_PRIORITY -1023 /* inclusive */ 1488#define I915_CONTEXT_MIN_USER_PRIORITY -1023 /* inclusive */
1489 /*
1490 * When using the following param, value should be a pointer to
1491 * drm_i915_gem_context_param_sseu.
1492 */
1493#define I915_CONTEXT_PARAM_SSEU 0x7
1489 __u64 value; 1494 __u64 value;
1490}; 1495};
1491 1496
1497/**
1498 * Context SSEU programming
1499 *
1500 * It may be necessary for either functional or performance reason to configure
1501 * a context to run with a reduced number of SSEU (where SSEU stands for Slice/
1502 * Sub-slice/EU).
1503 *
1504 * This is done by configuring SSEU configuration using the below
1505 * @struct drm_i915_gem_context_param_sseu for every supported engine which
1506 * userspace intends to use.
1507 *
1508 * Not all GPUs or engines support this functionality in which case an error
1509 * code -ENODEV will be returned.
1510 *
1511 * Also, flexibility of possible SSEU configuration permutations varies between
1512 * GPU generations and software imposed limitations. Requesting such a
1513 * combination will return an error code of -EINVAL.
1514 *
1515 * NOTE: When perf/OA is active the context's SSEU configuration is ignored in
1516 * favour of a single global setting.
1517 */
1518struct drm_i915_gem_context_param_sseu {
1519 /*
1520 * Engine class & instance to be configured or queried.
1521 */
1522 __u16 engine_class;
1523 __u16 engine_instance;
1524
1525 /*
1526 * Unused for now. Must be cleared to zero.
1527 */
1528 __u32 flags;
1529
1530 /*
1531 * Mask of slices to enable for the context. Valid values are a subset
1532 * of the bitmask value returned for I915_PARAM_SLICE_MASK.
1533 */
1534 __u64 slice_mask;
1535
1536 /*
1537 * Mask of subslices to enable for the context. Valid values are a
1538 * subset of the bitmask value return by I915_PARAM_SUBSLICE_MASK.
1539 */
1540 __u64 subslice_mask;
1541
1542 /*
1543 * Minimum/Maximum number of EUs to enable per subslice for the
1544 * context. min_eus_per_subslice must be inferior or equal to
1545 * max_eus_per_subslice.
1546 */
1547 __u16 min_eus_per_subslice;
1548 __u16 max_eus_per_subslice;
1549
1550 /*
1551 * Unused for now. Must be cleared to zero.
1552 */
1553 __u32 rsvd;
1554};
1555
1492enum drm_i915_oa_format { 1556enum drm_i915_oa_format {
1493 I915_OA_FORMAT_A13 = 1, /* HSW only */ 1557 I915_OA_FORMAT_A13 = 1, /* HSW only */
1494 I915_OA_FORMAT_A29, /* HSW only */ 1558 I915_OA_FORMAT_A29, /* HSW only */
diff --git a/tools/include/uapi/linux/fcntl.h b/tools/include/uapi/linux/fcntl.h
index 6448cdd9a350..a2f8658f1c55 100644
--- a/tools/include/uapi/linux/fcntl.h
+++ b/tools/include/uapi/linux/fcntl.h
@@ -41,6 +41,7 @@
41#define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */ 41#define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */
42#define F_SEAL_GROW 0x0004 /* prevent file from growing */ 42#define F_SEAL_GROW 0x0004 /* prevent file from growing */
43#define F_SEAL_WRITE 0x0008 /* prevent writes */ 43#define F_SEAL_WRITE 0x0008 /* prevent writes */
44#define F_SEAL_FUTURE_WRITE 0x0010 /* prevent future writes while mapped */
44/* (1U << 31) is reserved for signed error codes */ 45/* (1U << 31) is reserved for signed error codes */
45 46
46/* 47/*
diff --git a/tools/include/uapi/linux/mman.h b/tools/include/uapi/linux/mman.h
index d0f515d53299..fc1a64c3447b 100644
--- a/tools/include/uapi/linux/mman.h
+++ b/tools/include/uapi/linux/mman.h
@@ -12,6 +12,10 @@
12#define OVERCOMMIT_ALWAYS 1 12#define OVERCOMMIT_ALWAYS 1
13#define OVERCOMMIT_NEVER 2 13#define OVERCOMMIT_NEVER 2
14 14
15#define MAP_SHARED 0x01 /* Share changes */
16#define MAP_PRIVATE 0x02 /* Changes are private */
17#define MAP_SHARED_VALIDATE 0x03 /* share + validate extension flags */
18
15/* 19/*
16 * Huge page size encoding when MAP_HUGETLB is specified, and a huge page 20 * Huge page size encoding when MAP_HUGETLB is specified, and a huge page
17 * size other than the default is desired. See hugetlb_encode.h. 21 * size other than the default is desired. See hugetlb_encode.h.
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 01f7555fd933..e8c9f77e9010 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -481,8 +481,8 @@ $(madvise_behavior_array): $(madvise_hdr_dir)/mman-common.h $(madvise_behavior_t
481mmap_flags_array := $(beauty_outdir)/mmap_flags_array.c 481mmap_flags_array := $(beauty_outdir)/mmap_flags_array.c
482mmap_flags_tbl := $(srctree)/tools/perf/trace/beauty/mmap_flags.sh 482mmap_flags_tbl := $(srctree)/tools/perf/trace/beauty/mmap_flags.sh
483 483
484$(mmap_flags_array): $(asm_generic_uapi_dir)/mman.h $(asm_generic_uapi_dir)/mman-common.h $(mmap_flags_tbl) 484$(mmap_flags_array): $(linux_uapi_dir)/mman.h $(asm_generic_uapi_dir)/mman.h $(asm_generic_uapi_dir)/mman-common.h $(mmap_flags_tbl)
485 $(Q)$(SHELL) '$(mmap_flags_tbl)' $(asm_generic_uapi_dir) $(arch_asm_uapi_dir) > $@ 485 $(Q)$(SHELL) '$(mmap_flags_tbl)' $(linux_uapi_dir) $(asm_generic_uapi_dir) $(arch_asm_uapi_dir) > $@
486 486
487mount_flags_array := $(beauty_outdir)/mount_flags_array.c 487mount_flags_array := $(beauty_outdir)/mount_flags_array.c
488mount_flags_tbl := $(srctree)/tools/perf/trace/beauty/mount_flags.sh 488mount_flags_tbl := $(srctree)/tools/perf/trace/beauty/mount_flags.sh
diff --git a/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl b/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
index 2ae92fddb6d5..92ee0b4378d4 100644
--- a/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
+++ b/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
@@ -345,6 +345,10 @@
345334 common rseq __x64_sys_rseq 345334 common rseq __x64_sys_rseq
346# don't use numbers 387 through 423, add new calls after the last 346# don't use numbers 387 through 423, add new calls after the last
347# 'common' entry 347# 'common' entry
348424 common pidfd_send_signal __x64_sys_pidfd_send_signal
349425 common io_uring_setup __x64_sys_io_uring_setup
350426 common io_uring_enter __x64_sys_io_uring_enter
351427 common io_uring_register __x64_sys_io_uring_register
348 352
349# 353#
350# x32-specific system call numbers start at 512 to avoid cache impact 354# x32-specific system call numbers start at 512 to avoid cache impact
diff --git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh
index 7b55613924de..c68ee06cae63 100755
--- a/tools/perf/check-headers.sh
+++ b/tools/perf/check-headers.sh
@@ -103,7 +103,7 @@ done
103# diff with extra ignore lines 103# diff with extra ignore lines
104check arch/x86/lib/memcpy_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"' 104check arch/x86/lib/memcpy_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"'
105check arch/x86/lib/memset_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"' 105check arch/x86/lib/memset_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"'
106check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common.h>"' 106check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common\(-tools\)*.h>"'
107check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"' 107check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"'
108 108
109# diff non-symmetric files 109# diff non-symmetric files
diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py
index e38518cdcbc3..74ef92f1d19a 100755
--- a/tools/perf/scripts/python/exported-sql-viewer.py
+++ b/tools/perf/scripts/python/exported-sql-viewer.py
@@ -107,6 +107,7 @@ import os
107from PySide.QtCore import * 107from PySide.QtCore import *
108from PySide.QtGui import * 108from PySide.QtGui import *
109from PySide.QtSql import * 109from PySide.QtSql import *
110pyside_version_1 = True
110from decimal import * 111from decimal import *
111from ctypes import * 112from ctypes import *
112from multiprocessing import Process, Array, Value, Event 113from multiprocessing import Process, Array, Value, Event
@@ -1526,6 +1527,19 @@ def BranchDataPrep(query):
1526 " (" + dsoname(query.value(15)) + ")") 1527 " (" + dsoname(query.value(15)) + ")")
1527 return data 1528 return data
1528 1529
1530def BranchDataPrepWA(query):
1531 data = []
1532 data.append(query.value(0))
1533 # Workaround pyside failing to handle large integers (i.e. time) in python3 by converting to a string
1534 data.append("{:>19}".format(query.value(1)))
1535 for i in xrange(2, 8):
1536 data.append(query.value(i))
1537 data.append(tohex(query.value(8)).rjust(16) + " " + query.value(9) + offstr(query.value(10)) +
1538 " (" + dsoname(query.value(11)) + ")" + " -> " +
1539 tohex(query.value(12)) + " " + query.value(13) + offstr(query.value(14)) +
1540 " (" + dsoname(query.value(15)) + ")")
1541 return data
1542
1529# Branch data model 1543# Branch data model
1530 1544
1531class BranchModel(TreeModel): 1545class BranchModel(TreeModel):
@@ -1553,7 +1567,11 @@ class BranchModel(TreeModel):
1553 " AND evsel_id = " + str(self.event_id) + 1567 " AND evsel_id = " + str(self.event_id) +
1554 " ORDER BY samples.id" 1568 " ORDER BY samples.id"
1555 " LIMIT " + str(glb_chunk_sz)) 1569 " LIMIT " + str(glb_chunk_sz))
1556 self.fetcher = SQLFetcher(glb, sql, BranchDataPrep, self.AddSample) 1570 if pyside_version_1 and sys.version_info[0] == 3:
1571 prep = BranchDataPrepWA
1572 else:
1573 prep = BranchDataPrep
1574 self.fetcher = SQLFetcher(glb, sql, prep, self.AddSample)
1557 self.fetcher.done.connect(self.Update) 1575 self.fetcher.done.connect(self.Update)
1558 self.fetcher.Fetch(glb_chunk_sz) 1576 self.fetcher.Fetch(glb_chunk_sz)
1559 1577
@@ -2079,14 +2097,6 @@ def IsSelectable(db, table, sql = ""):
2079 return False 2097 return False
2080 return True 2098 return True
2081 2099
2082# SQL data preparation
2083
2084def SQLTableDataPrep(query, count):
2085 data = []
2086 for i in xrange(count):
2087 data.append(query.value(i))
2088 return data
2089
2090# SQL table data model item 2100# SQL table data model item
2091 2101
2092class SQLTableItem(): 2102class SQLTableItem():
@@ -2110,7 +2120,7 @@ class SQLTableModel(TableModel):
2110 self.more = True 2120 self.more = True
2111 self.populated = 0 2121 self.populated = 0
2112 self.column_headers = column_headers 2122 self.column_headers = column_headers
2113 self.fetcher = SQLFetcher(glb, sql, lambda x, y=len(column_headers): SQLTableDataPrep(x, y), self.AddSample) 2123 self.fetcher = SQLFetcher(glb, sql, lambda x, y=len(column_headers): self.SQLTableDataPrep(x, y), self.AddSample)
2114 self.fetcher.done.connect(self.Update) 2124 self.fetcher.done.connect(self.Update)
2115 self.fetcher.Fetch(glb_chunk_sz) 2125 self.fetcher.Fetch(glb_chunk_sz)
2116 2126
@@ -2154,6 +2164,12 @@ class SQLTableModel(TableModel):
2154 def columnHeader(self, column): 2164 def columnHeader(self, column):
2155 return self.column_headers[column] 2165 return self.column_headers[column]
2156 2166
2167 def SQLTableDataPrep(self, query, count):
2168 data = []
2169 for i in xrange(count):
2170 data.append(query.value(i))
2171 return data
2172
2157# SQL automatic table data model 2173# SQL automatic table data model
2158 2174
2159class SQLAutoTableModel(SQLTableModel): 2175class SQLAutoTableModel(SQLTableModel):
@@ -2182,8 +2198,32 @@ class SQLAutoTableModel(SQLTableModel):
2182 QueryExec(query, "SELECT column_name FROM information_schema.columns WHERE table_schema = '" + schema + "' and table_name = '" + select_table_name + "'") 2198 QueryExec(query, "SELECT column_name FROM information_schema.columns WHERE table_schema = '" + schema + "' and table_name = '" + select_table_name + "'")
2183 while query.next(): 2199 while query.next():
2184 column_headers.append(query.value(0)) 2200 column_headers.append(query.value(0))
2201 if pyside_version_1 and sys.version_info[0] == 3:
2202 if table_name == "samples_view":
2203 self.SQLTableDataPrep = self.samples_view_DataPrep
2204 if table_name == "samples":
2205 self.SQLTableDataPrep = self.samples_DataPrep
2185 super(SQLAutoTableModel, self).__init__(glb, sql, column_headers, parent) 2206 super(SQLAutoTableModel, self).__init__(glb, sql, column_headers, parent)
2186 2207
2208 def samples_view_DataPrep(self, query, count):
2209 data = []
2210 data.append(query.value(0))
2211 # Workaround pyside failing to handle large integers (i.e. time) in python3 by converting to a string
2212 data.append("{:>19}".format(query.value(1)))
2213 for i in xrange(2, count):
2214 data.append(query.value(i))
2215 return data
2216
2217 def samples_DataPrep(self, query, count):
2218 data = []
2219 for i in xrange(9):
2220 data.append(query.value(i))
2221 # Workaround pyside failing to handle large integers (i.e. time) in python3 by converting to a string
2222 data.append("{:>19}".format(query.value(9)))
2223 for i in xrange(10, count):
2224 data.append(query.value(i))
2225 return data
2226
2187# Base class for custom ResizeColumnsToContents 2227# Base class for custom ResizeColumnsToContents
2188 2228
2189class ResizeColumnsToContentsBase(QObject): 2229class ResizeColumnsToContentsBase(QObject):
@@ -2868,9 +2908,13 @@ class LibXED():
2868 ok = self.xed_format_context(2, inst.xedp, inst.bufferp, sizeof(inst.buffer), ip, 0, 0) 2908 ok = self.xed_format_context(2, inst.xedp, inst.bufferp, sizeof(inst.buffer), ip, 0, 0)
2869 if not ok: 2909 if not ok:
2870 return 0, "" 2910 return 0, ""
2911 if sys.version_info[0] == 2:
2912 result = inst.buffer.value
2913 else:
2914 result = inst.buffer.value.decode()
2871 # Return instruction length and the disassembled instruction text 2915 # Return instruction length and the disassembled instruction text
2872 # For now, assume the length is in byte 166 2916 # For now, assume the length is in byte 166
2873 return inst.xedd[166], inst.buffer.value 2917 return inst.xedd[166], result
2874 2918
2875def TryOpen(file_name): 2919def TryOpen(file_name):
2876 try: 2920 try:
@@ -2886,9 +2930,14 @@ def Is64Bit(f):
2886 header = f.read(7) 2930 header = f.read(7)
2887 f.seek(pos) 2931 f.seek(pos)
2888 magic = header[0:4] 2932 magic = header[0:4]
2889 eclass = ord(header[4]) 2933 if sys.version_info[0] == 2:
2890 encoding = ord(header[5]) 2934 eclass = ord(header[4])
2891 version = ord(header[6]) 2935 encoding = ord(header[5])
2936 version = ord(header[6])
2937 else:
2938 eclass = header[4]
2939 encoding = header[5]
2940 version = header[6]
2892 if magic == chr(127) + "ELF" and eclass > 0 and eclass < 3 and encoding > 0 and encoding < 3 and version == 1: 2941 if magic == chr(127) + "ELF" and eclass > 0 and eclass < 3 and encoding > 0 and encoding < 3 and version == 1:
2893 result = True if eclass == 2 else False 2942 result = True if eclass == 2 else False
2894 return result 2943 return result
diff --git a/tools/perf/trace/beauty/mmap_flags.sh b/tools/perf/trace/beauty/mmap_flags.sh
index 32bac9c0d694..5f5eefcb3c74 100755
--- a/tools/perf/trace/beauty/mmap_flags.sh
+++ b/tools/perf/trace/beauty/mmap_flags.sh
@@ -1,15 +1,18 @@
1#!/bin/sh 1#!/bin/sh
2# SPDX-License-Identifier: LGPL-2.1 2# SPDX-License-Identifier: LGPL-2.1
3 3
4if [ $# -ne 2 ] ; then 4if [ $# -ne 3 ] ; then
5 [ $# -eq 1 ] && hostarch=$1 || hostarch=`uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/` 5 [ $# -eq 1 ] && hostarch=$1 || hostarch=`uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/`
6 linux_header_dir=tools/include/uapi/linux
6 header_dir=tools/include/uapi/asm-generic 7 header_dir=tools/include/uapi/asm-generic
7 arch_header_dir=tools/arch/${hostarch}/include/uapi/asm 8 arch_header_dir=tools/arch/${hostarch}/include/uapi/asm
8else 9else
9 header_dir=$1 10 linux_header_dir=$1
10 arch_header_dir=$2 11 header_dir=$2
12 arch_header_dir=$3
11fi 13fi
12 14
15linux_mman=${linux_header_dir}/mman.h
13arch_mman=${arch_header_dir}/mman.h 16arch_mman=${arch_header_dir}/mman.h
14 17
15# those in egrep -vw are flags, we want just the bits 18# those in egrep -vw are flags, we want just the bits
@@ -20,6 +23,11 @@ egrep -q $regex ${arch_mman} && \
20(egrep $regex ${arch_mman} | \ 23(egrep $regex ${arch_mman} | \
21 sed -r "s/$regex/\2 \1/g" | \ 24 sed -r "s/$regex/\2 \1/g" | \
22 xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n") 25 xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n")
26egrep -q $regex ${linux_mman} && \
27(egrep $regex ${linux_mman} | \
28 egrep -vw 'MAP_(UNINITIALIZED|TYPE|SHARED_VALIDATE)' | \
29 sed -r "s/$regex/\2 \1/g" | \
30 xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n")
23([ ! -f ${arch_mman} ] || egrep -q '#[[:space:]]*include[[:space:]]+<uapi/asm-generic/mman.*' ${arch_mman}) && 31([ ! -f ${arch_mman} ] || egrep -q '#[[:space:]]*include[[:space:]]+<uapi/asm-generic/mman.*' ${arch_mman}) &&
24(egrep $regex ${header_dir}/mman-common.h | \ 32(egrep $regex ${header_dir}/mman-common.h | \
25 egrep -vw 'MAP_(UNINITIALIZED|TYPE|SHARED_VALIDATE)' | \ 33 egrep -vw 'MAP_(UNINITIALIZED|TYPE|SHARED_VALIDATE)' | \
diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
index ba4c623cd8de..39fe21e1cf93 100644
--- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
+++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
@@ -387,6 +387,7 @@ cs_etm_decoder__buffer_range(struct cs_etm_decoder *decoder,
387 break; 387 break;
388 case OCSD_INSTR_ISB: 388 case OCSD_INSTR_ISB:
389 case OCSD_INSTR_DSB_DMB: 389 case OCSD_INSTR_DSB_DMB:
390 case OCSD_INSTR_WFI_WFE:
390 case OCSD_INSTR_OTHER: 391 case OCSD_INSTR_OTHER:
391 default: 392 default:
392 packet->last_instr_taken_branch = false; 393 packet->last_instr_taken_branch = false;
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index ec78e93085de..6689378ee577 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -231,35 +231,6 @@ void perf_evlist__set_leader(struct perf_evlist *evlist)
231 } 231 }
232} 232}
233 233
234void perf_event_attr__set_max_precise_ip(struct perf_event_attr *pattr)
235{
236 struct perf_event_attr attr = {
237 .type = PERF_TYPE_HARDWARE,
238 .config = PERF_COUNT_HW_CPU_CYCLES,
239 .exclude_kernel = 1,
240 .precise_ip = 3,
241 };
242
243 event_attr_init(&attr);
244
245 /*
246 * Unnamed union member, not supported as struct member named
247 * initializer in older compilers such as gcc 4.4.7
248 */
249 attr.sample_period = 1;
250
251 while (attr.precise_ip != 0) {
252 int fd = sys_perf_event_open(&attr, 0, -1, -1, 0);
253 if (fd != -1) {
254 close(fd);
255 break;
256 }
257 --attr.precise_ip;
258 }
259
260 pattr->precise_ip = attr.precise_ip;
261}
262
263int __perf_evlist__add_default(struct perf_evlist *evlist, bool precise) 234int __perf_evlist__add_default(struct perf_evlist *evlist, bool precise)
264{ 235{
265 struct perf_evsel *evsel = perf_evsel__new_cycles(precise); 236 struct perf_evsel *evsel = perf_evsel__new_cycles(precise);
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index dcb68f34d2cd..6a94785b9100 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -315,8 +315,6 @@ void perf_evlist__to_front(struct perf_evlist *evlist,
315void perf_evlist__set_tracking_event(struct perf_evlist *evlist, 315void perf_evlist__set_tracking_event(struct perf_evlist *evlist,
316 struct perf_evsel *tracking_evsel); 316 struct perf_evsel *tracking_evsel);
317 317
318void perf_event_attr__set_max_precise_ip(struct perf_event_attr *attr);
319
320struct perf_evsel * 318struct perf_evsel *
321perf_evlist__find_evsel_by_str(struct perf_evlist *evlist, const char *str); 319perf_evlist__find_evsel_by_str(struct perf_evlist *evlist, const char *str);
322 320
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 7835e05f0c0a..66d066f18b5b 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -295,7 +295,6 @@ struct perf_evsel *perf_evsel__new_cycles(bool precise)
295 if (!precise) 295 if (!precise)
296 goto new_event; 296 goto new_event;
297 297
298 perf_event_attr__set_max_precise_ip(&attr);
299 /* 298 /*
300 * Now let the usual logic to set up the perf_event_attr defaults 299 * Now let the usual logic to set up the perf_event_attr defaults
301 * to kick in when we return and before perf_evsel__open() is called. 300 * to kick in when we return and before perf_evsel__open() is called.
@@ -305,6 +304,8 @@ new_event:
305 if (evsel == NULL) 304 if (evsel == NULL)
306 goto out; 305 goto out;
307 306
307 evsel->precise_max = true;
308
308 /* use asprintf() because free(evsel) assumes name is allocated */ 309 /* use asprintf() because free(evsel) assumes name is allocated */
309 if (asprintf(&evsel->name, "cycles%s%s%.*s", 310 if (asprintf(&evsel->name, "cycles%s%s%.*s",
310 (attr.precise_ip || attr.exclude_kernel) ? ":" : "", 311 (attr.precise_ip || attr.exclude_kernel) ? ":" : "",
@@ -1083,7 +1084,7 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts,
1083 } 1084 }
1084 1085
1085 if (evsel->precise_max) 1086 if (evsel->precise_max)
1086 perf_event_attr__set_max_precise_ip(attr); 1087 attr->precise_ip = 3;
1087 1088
1088 if (opts->all_user) { 1089 if (opts->all_user) {
1089 attr->exclude_kernel = 1; 1090 attr->exclude_kernel = 1;
@@ -1749,6 +1750,59 @@ static bool ignore_missing_thread(struct perf_evsel *evsel,
1749 return true; 1750 return true;
1750} 1751}
1751 1752
1753static void display_attr(struct perf_event_attr *attr)
1754{
1755 if (verbose >= 2) {
1756 fprintf(stderr, "%.60s\n", graph_dotted_line);
1757 fprintf(stderr, "perf_event_attr:\n");
1758 perf_event_attr__fprintf(stderr, attr, __open_attr__fprintf, NULL);
1759 fprintf(stderr, "%.60s\n", graph_dotted_line);
1760 }
1761}
1762
1763static int perf_event_open(struct perf_evsel *evsel,
1764 pid_t pid, int cpu, int group_fd,
1765 unsigned long flags)
1766{
1767 int precise_ip = evsel->attr.precise_ip;
1768 int fd;
1769
1770 while (1) {
1771 pr_debug2("sys_perf_event_open: pid %d cpu %d group_fd %d flags %#lx",
1772 pid, cpu, group_fd, flags);
1773
1774 fd = sys_perf_event_open(&evsel->attr, pid, cpu, group_fd, flags);
1775 if (fd >= 0)
1776 break;
1777
1778 /*
1779 * Do quick precise_ip fallback if:
1780 * - there is precise_ip set in perf_event_attr
1781 * - maximum precise is requested
1782 * - sys_perf_event_open failed with ENOTSUP error,
1783 * which is associated with wrong precise_ip
1784 */
1785 if (!precise_ip || !evsel->precise_max || (errno != ENOTSUP))
1786 break;
1787
1788 /*
1789 * We tried all the precise_ip values, and it's
1790 * still failing, so leave it to standard fallback.
1791 */
1792 if (!evsel->attr.precise_ip) {
1793 evsel->attr.precise_ip = precise_ip;
1794 break;
1795 }
1796
1797 pr_debug2("\nsys_perf_event_open failed, error %d\n", -ENOTSUP);
1798 evsel->attr.precise_ip--;
1799 pr_debug2("decreasing precise_ip by one (%d)\n", evsel->attr.precise_ip);
1800 display_attr(&evsel->attr);
1801 }
1802
1803 return fd;
1804}
1805
1752int perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus, 1806int perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
1753 struct thread_map *threads) 1807 struct thread_map *threads)
1754{ 1808{
@@ -1824,12 +1878,7 @@ retry_sample_id:
1824 if (perf_missing_features.sample_id_all) 1878 if (perf_missing_features.sample_id_all)
1825 evsel->attr.sample_id_all = 0; 1879 evsel->attr.sample_id_all = 0;
1826 1880
1827 if (verbose >= 2) { 1881 display_attr(&evsel->attr);
1828 fprintf(stderr, "%.60s\n", graph_dotted_line);
1829 fprintf(stderr, "perf_event_attr:\n");
1830 perf_event_attr__fprintf(stderr, &evsel->attr, __open_attr__fprintf, NULL);
1831 fprintf(stderr, "%.60s\n", graph_dotted_line);
1832 }
1833 1882
1834 for (cpu = 0; cpu < cpus->nr; cpu++) { 1883 for (cpu = 0; cpu < cpus->nr; cpu++) {
1835 1884
@@ -1841,13 +1890,10 @@ retry_sample_id:
1841 1890
1842 group_fd = get_group_fd(evsel, cpu, thread); 1891 group_fd = get_group_fd(evsel, cpu, thread);
1843retry_open: 1892retry_open:
1844 pr_debug2("sys_perf_event_open: pid %d cpu %d group_fd %d flags %#lx",
1845 pid, cpus->map[cpu], group_fd, flags);
1846
1847 test_attr__ready(); 1893 test_attr__ready();
1848 1894
1849 fd = sys_perf_event_open(&evsel->attr, pid, cpus->map[cpu], 1895 fd = perf_event_open(evsel, pid, cpus->map[cpu],
1850 group_fd, flags); 1896 group_fd, flags);
1851 1897
1852 FD(evsel, cpu, thread) = fd; 1898 FD(evsel, cpu, thread) = fd;
1853 1899
diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
index 6e03db142091..872fab163585 100644
--- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
+++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
@@ -251,19 +251,15 @@ struct intel_pt_decoder *intel_pt_decoder_new(struct intel_pt_params *params)
251 if (!(decoder->tsc_ctc_ratio_n % decoder->tsc_ctc_ratio_d)) 251 if (!(decoder->tsc_ctc_ratio_n % decoder->tsc_ctc_ratio_d))
252 decoder->tsc_ctc_mult = decoder->tsc_ctc_ratio_n / 252 decoder->tsc_ctc_mult = decoder->tsc_ctc_ratio_n /
253 decoder->tsc_ctc_ratio_d; 253 decoder->tsc_ctc_ratio_d;
254
255 /*
256 * Allow for timestamps appearing to backwards because a TSC
257 * packet has slipped past a MTC packet, so allow 2 MTC ticks
258 * or ...
259 */
260 decoder->tsc_slip = multdiv(2 << decoder->mtc_shift,
261 decoder->tsc_ctc_ratio_n,
262 decoder->tsc_ctc_ratio_d);
263 } 254 }
264 /* ... or 0x100 paranoia */ 255
265 if (decoder->tsc_slip < 0x100) 256 /*
266 decoder->tsc_slip = 0x100; 257 * A TSC packet can slip past MTC packets so that the timestamp appears
258 * to go backwards. One estimate is that can be up to about 40 CPU
259 * cycles, which is certainly less than 0x1000 TSC ticks, but accept
260 * slippage an order of magnitude more to be on the safe side.
261 */
262 decoder->tsc_slip = 0x10000;
267 263
268 intel_pt_log("timestamp: mtc_shift %u\n", decoder->mtc_shift); 264 intel_pt_log("timestamp: mtc_shift %u\n", decoder->mtc_shift);
269 intel_pt_log("timestamp: tsc_ctc_ratio_n %u\n", decoder->tsc_ctc_ratio_n); 265 intel_pt_log("timestamp: tsc_ctc_ratio_n %u\n", decoder->tsc_ctc_ratio_n);
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 61959aba7e27..3c520baa198c 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1421,6 +1421,20 @@ static void machine__set_kernel_mmap(struct machine *machine,
1421 machine->vmlinux_map->end = ~0ULL; 1421 machine->vmlinux_map->end = ~0ULL;
1422} 1422}
1423 1423
1424static void machine__update_kernel_mmap(struct machine *machine,
1425 u64 start, u64 end)
1426{
1427 struct map *map = machine__kernel_map(machine);
1428
1429 map__get(map);
1430 map_groups__remove(&machine->kmaps, map);
1431
1432 machine__set_kernel_mmap(machine, start, end);
1433
1434 map_groups__insert(&machine->kmaps, map);
1435 map__put(map);
1436}
1437
1424int machine__create_kernel_maps(struct machine *machine) 1438int machine__create_kernel_maps(struct machine *machine)
1425{ 1439{
1426 struct dso *kernel = machine__get_kernel(machine); 1440 struct dso *kernel = machine__get_kernel(machine);
@@ -1453,17 +1467,11 @@ int machine__create_kernel_maps(struct machine *machine)
1453 goto out_put; 1467 goto out_put;
1454 } 1468 }
1455 1469
1456 /* we have a real start address now, so re-order the kmaps */ 1470 /*
1457 map = machine__kernel_map(machine); 1471 * we have a real start address now, so re-order the kmaps
1458 1472 * assume it's the last in the kmaps
1459 map__get(map); 1473 */
1460 map_groups__remove(&machine->kmaps, map); 1474 machine__update_kernel_mmap(machine, addr, ~0ULL);
1461
1462 /* assume it's the last in the kmaps */
1463 machine__set_kernel_mmap(machine, addr, ~0ULL);
1464
1465 map_groups__insert(&machine->kmaps, map);
1466 map__put(map);
1467 } 1475 }
1468 1476
1469 if (machine__create_extra_kernel_maps(machine, kernel)) 1477 if (machine__create_extra_kernel_maps(machine, kernel))
@@ -1599,7 +1607,7 @@ static int machine__process_kernel_mmap_event(struct machine *machine,
1599 if (strstr(kernel->long_name, "vmlinux")) 1607 if (strstr(kernel->long_name, "vmlinux"))
1600 dso__set_short_name(kernel, "[kernel.vmlinux]", false); 1608 dso__set_short_name(kernel, "[kernel.vmlinux]", false);
1601 1609
1602 machine__set_kernel_mmap(machine, event->mmap.start, 1610 machine__update_kernel_mmap(machine, event->mmap.start,
1603 event->mmap.start + event->mmap.len); 1611 event->mmap.start + event->mmap.len);
1604 1612
1605 /* 1613 /*
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 6199a3174ab9..e0429f4ef335 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -732,10 +732,20 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
732 732
733 if (!is_arm_pmu_core(name)) { 733 if (!is_arm_pmu_core(name)) {
734 pname = pe->pmu ? pe->pmu : "cpu"; 734 pname = pe->pmu ? pe->pmu : "cpu";
735
736 /*
737 * uncore alias may be from different PMU
738 * with common prefix
739 */
740 if (pmu_is_uncore(name) &&
741 !strncmp(pname, name, strlen(pname)))
742 goto new_alias;
743
735 if (strcmp(pname, name)) 744 if (strcmp(pname, name))
736 continue; 745 continue;
737 } 746 }
738 747
748new_alias:
739 /* need type casts to override 'const' */ 749 /* need type casts to override 'const' */
740 __perf_pmu__new_alias(head, NULL, (char *)pe->name, 750 __perf_pmu__new_alias(head, NULL, (char *)pe->name,
741 (char *)pe->desc, (char *)pe->event, 751 (char *)pe->desc, (char *)pe->event,