diff options
author | Ingo Molnar <mingo@kernel.org> | 2016-09-20 17:32:02 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-09-20 17:32:02 -0400 |
commit | 89f1c2c59c4aef8e26edbc7db5175e6ffb0e9ec7 (patch) | |
tree | a87f3a07009fd14cb446f9ed35d9fe8f8269ff40 /tools | |
parent | 8ee83b2ab3d1987cbd80c9f2c6f2b12fed87b51e (diff) | |
parent | 3c028a0cb5b71f47d523bc8ad2c597cb257f41fb (diff) |
Merge tag 'perf-core-for-mingo-20160920' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
User visible changes:
- Support event group view with hierarchy mode in 'perf top' and 'perf report'
(Namhyung Kim)
e.g.:
$ perf record -e '{cycles,instructions}' make
$ perf report --hierarchy --stdio
...
# Overhead Command / Shared Object / Symbol
# ...................... ..................................
...
25.74% 27.18% sh
19.96% 24.14% libc-2.24.so
9.55% 14.64% [.] __strcmp_sse2
1.54% 0.00% [.] __tfind
1.07% 1.13% [.] _int_malloc
0.95% 0.00% [.] __strchr_sse2
0.89% 1.39% [.] __tsearch
0.76% 0.00% [.] strlen
- Fix the dwarf regs table for x86_64, adding a missing % to the "%di"
register, noticed with a failing 'perf test bpf' (Arnaldo Carvalho de Melo)
- Fix handling of mmap parameters in the 'perf trace' beautifier in
architectures that don't have the same mappings as x86_64 (Wang Nan)
- Handle hugetbl mappings in older systems running new kernels (Wang Nan)
- Resolve 'call' operands in 'annotate', that when using /proc/kcore
were appearing just as hexadecimal addresses, to function names
(Arnaldo Carvalho de Melo)
- Fix width computation for srcline sort entry (Jiri Olsa)
- Do not ignore call instruction with indirect target in 'annotate'
(Ravi Bangoria)
- Handle MADV_FREE in the madvise 'trace' beautifier (Wang Nan)
- Fix build of 'perf trace' mman beautifier in !x86_64 (Wang Nan)
Infrastructure changes:
- Add infrastructure for PMU specific configuration, allowing to pass
config variables directly to the kernel PMU driver, prefixing those
variables with a '@', part of a larger series to support Coresight (Mathieu Poirier)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools')
46 files changed, 698 insertions, 131 deletions
diff --git a/tools/arch/alpha/include/uapi/asm/mman.h b/tools/arch/alpha/include/uapi/asm/mman.h new file mode 100644 index 000000000000..e38b64c82b97 --- /dev/null +++ b/tools/arch/alpha/include/uapi/asm/mman.h | |||
@@ -0,0 +1,47 @@ | |||
1 | #ifndef TOOLS_ARCH_ALPHA_UAPI_ASM_MMAN_FIX_H | ||
2 | #define TOOLS_ARCH_ALPHA_UAPI_ASM_MMAN_FIX_H | ||
3 | #define MADV_DODUMP 17 | ||
4 | #define MADV_DOFORK 11 | ||
5 | #define MADV_DONTDUMP 16 | ||
6 | #define MADV_DONTFORK 10 | ||
7 | #define MADV_DONTNEED 6 | ||
8 | #define MADV_FREE 8 | ||
9 | #define MADV_HUGEPAGE 14 | ||
10 | #define MADV_MERGEABLE 12 | ||
11 | #define MADV_NOHUGEPAGE 15 | ||
12 | #define MADV_NORMAL 0 | ||
13 | #define MADV_RANDOM 1 | ||
14 | #define MADV_REMOVE 9 | ||
15 | #define MADV_SEQUENTIAL 2 | ||
16 | #define MADV_UNMERGEABLE 13 | ||
17 | #define MADV_WILLNEED 3 | ||
18 | #define MAP_ANONYMOUS 0x10 | ||
19 | #define MAP_DENYWRITE 0x02000 | ||
20 | #define MAP_EXECUTABLE 0x04000 | ||
21 | #define MAP_FILE 0 | ||
22 | #define MAP_FIXED 0x100 | ||
23 | #define MAP_GROWSDOWN 0x01000 | ||
24 | #define MAP_HUGETLB 0x100000 | ||
25 | #define MAP_LOCKED 0x08000 | ||
26 | #define MAP_NONBLOCK 0x40000 | ||
27 | #define MAP_NORESERVE 0x10000 | ||
28 | #define MAP_POPULATE 0x20000 | ||
29 | #define MAP_PRIVATE 0x02 | ||
30 | #define MAP_SHARED 0x01 | ||
31 | #define MAP_STACK 0x80000 | ||
32 | #define PROT_EXEC 0x4 | ||
33 | #define PROT_GROWSDOWN 0x01000000 | ||
34 | #define PROT_GROWSUP 0x02000000 | ||
35 | #define PROT_NONE 0x0 | ||
36 | #define PROT_READ 0x1 | ||
37 | #define PROT_SEM 0x8 | ||
38 | #define PROT_WRITE 0x2 | ||
39 | /* MADV_HWPOISON is undefined on alpha, fix it for perf */ | ||
40 | #define MADV_HWPOISON 100 | ||
41 | /* MADV_SOFT_OFFLINE is undefined on alpha, fix it for perf */ | ||
42 | #define MADV_SOFT_OFFLINE 101 | ||
43 | /* MAP_32BIT is undefined on alpha, fix it for perf */ | ||
44 | #define MAP_32BIT 0 | ||
45 | /* MAP_UNINITIALIZED is undefined on alpha, fix it for perf */ | ||
46 | #define MAP_UNINITIALIZED 0 | ||
47 | #endif | ||
diff --git a/tools/arch/arc/include/uapi/asm/mman.h b/tools/arch/arc/include/uapi/asm/mman.h new file mode 100644 index 000000000000..aa3acd2aa9af --- /dev/null +++ b/tools/arch/arc/include/uapi/asm/mman.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef TOOLS_ARCH_ARC_UAPI_ASM_MMAN_FIX_H | ||
2 | #define TOOLS_ARCH_ARC_UAPI_ASM_MMAN_FIX_H | ||
3 | #include <uapi/asm-generic/mman.h> | ||
4 | /* MAP_32BIT is undefined on arc, fix it for perf */ | ||
5 | #define MAP_32BIT 0 | ||
6 | #endif | ||
diff --git a/tools/arch/arm/include/uapi/asm/mman.h b/tools/arch/arm/include/uapi/asm/mman.h new file mode 100644 index 000000000000..478f699f56fd --- /dev/null +++ b/tools/arch/arm/include/uapi/asm/mman.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef TOOLS_ARCH_ARM_UAPI_ASM_MMAN_FIX_H | ||
2 | #define TOOLS_ARCH_ARM_UAPI_ASM_MMAN_FIX_H | ||
3 | #include <uapi/asm-generic/mman.h> | ||
4 | /* MAP_32BIT is undefined on arm, fix it for perf */ | ||
5 | #define MAP_32BIT 0 | ||
6 | #endif | ||
diff --git a/tools/arch/arm64/include/uapi/asm/mman.h b/tools/arch/arm64/include/uapi/asm/mman.h new file mode 100644 index 000000000000..70fd3113710a --- /dev/null +++ b/tools/arch/arm64/include/uapi/asm/mman.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef TOOLS_ARCH_ARM64_UAPI_ASM_MMAN_FIX_H | ||
2 | #define TOOLS_ARCH_ARM64_UAPI_ASM_MMAN_FIX_H | ||
3 | #include <uapi/asm-generic/mman.h> | ||
4 | /* MAP_32BIT is undefined on arm64, fix it for perf */ | ||
5 | #define MAP_32BIT 0 | ||
6 | #endif | ||
diff --git a/tools/arch/frv/include/uapi/asm/mman.h b/tools/arch/frv/include/uapi/asm/mman.h new file mode 100644 index 000000000000..5be78ac12464 --- /dev/null +++ b/tools/arch/frv/include/uapi/asm/mman.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef TOOLS_ARCH_FRV_UAPI_ASM_MMAN_FIX_H | ||
2 | #define TOOLS_ARCH_FRV_UAPI_ASM_MMAN_FIX_H | ||
3 | #include <uapi/asm-generic/mman.h> | ||
4 | /* MAP_32BIT is undefined on frv, fix it for perf */ | ||
5 | #define MAP_32BIT 0 | ||
6 | #endif | ||
diff --git a/tools/arch/h8300/include/uapi/asm/mman.h b/tools/arch/h8300/include/uapi/asm/mman.h new file mode 100644 index 000000000000..9d9ac54d3c5a --- /dev/null +++ b/tools/arch/h8300/include/uapi/asm/mman.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef TOOLS_ARCH_H8300_UAPI_ASM_MMAN_FIX_H | ||
2 | #define TOOLS_ARCH_H8300_UAPI_ASM_MMAN_FIX_H | ||
3 | #include <uapi/asm-generic/mman.h> | ||
4 | /* MAP_32BIT is undefined on h8300, fix it for perf */ | ||
5 | #define MAP_32BIT 0 | ||
6 | #endif | ||
diff --git a/tools/arch/hexagon/include/uapi/asm/mman.h b/tools/arch/hexagon/include/uapi/asm/mman.h new file mode 100644 index 000000000000..102f3fae6085 --- /dev/null +++ b/tools/arch/hexagon/include/uapi/asm/mman.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef TOOLS_ARCH_HEXAGON_UAPI_ASM_MMAN_FIX_H | ||
2 | #define TOOLS_ARCH_HEXAGON_UAPI_ASM_MMAN_FIX_H | ||
3 | #include <uapi/asm-generic/mman.h> | ||
4 | /* MAP_32BIT is undefined on hexagon, fix it for perf */ | ||
5 | #define MAP_32BIT 0 | ||
6 | #endif | ||
diff --git a/tools/arch/ia64/include/uapi/asm/mman.h b/tools/arch/ia64/include/uapi/asm/mman.h new file mode 100644 index 000000000000..1d6e5ac6442d --- /dev/null +++ b/tools/arch/ia64/include/uapi/asm/mman.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef TOOLS_ARCH_IA64_UAPI_ASM_MMAN_FIX_H | ||
2 | #define TOOLS_ARCH_IA64_UAPI_ASM_MMAN_FIX_H | ||
3 | #include <uapi/asm-generic/mman.h> | ||
4 | /* MAP_32BIT is undefined on ia64, fix it for perf */ | ||
5 | #define MAP_32BIT 0 | ||
6 | #endif | ||
diff --git a/tools/arch/m32r/include/uapi/asm/mman.h b/tools/arch/m32r/include/uapi/asm/mman.h new file mode 100644 index 000000000000..1c29635bb73b --- /dev/null +++ b/tools/arch/m32r/include/uapi/asm/mman.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef TOOLS_ARCH_M32R_UAPI_ASM_MMAN_FIX_H | ||
2 | #define TOOLS_ARCH_M32R_UAPI_ASM_MMAN_FIX_H | ||
3 | #include <uapi/asm-generic/mman.h> | ||
4 | /* MAP_32BIT is undefined on m32r, fix it for perf */ | ||
5 | #define MAP_32BIT 0 | ||
6 | #endif | ||
diff --git a/tools/arch/microblaze/include/uapi/asm/mman.h b/tools/arch/microblaze/include/uapi/asm/mman.h new file mode 100644 index 000000000000..005cd50b50e1 --- /dev/null +++ b/tools/arch/microblaze/include/uapi/asm/mman.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef TOOLS_ARCH_MICROBLAZE_UAPI_ASM_MMAN_FIX_H | ||
2 | #define TOOLS_ARCH_MICROBLAZE_UAPI_ASM_MMAN_FIX_H | ||
3 | #include <uapi/asm-generic/mman.h> | ||
4 | /* MAP_32BIT is undefined on microblaze, fix it for perf */ | ||
5 | #define MAP_32BIT 0 | ||
6 | #endif | ||
diff --git a/tools/arch/mips/include/uapi/asm/mman.h b/tools/arch/mips/include/uapi/asm/mman.h new file mode 100644 index 000000000000..c02052965d50 --- /dev/null +++ b/tools/arch/mips/include/uapi/asm/mman.h | |||
@@ -0,0 +1,46 @@ | |||
1 | #ifndef TOOLS_ARCH_MIPS_UAPI_ASM_MMAN_FIX_H | ||
2 | #define TOOLS_ARCH_MIPS_UAPI_ASM_MMAN_FIX_H | ||
3 | #define MADV_DODUMP 17 | ||
4 | #define MADV_DOFORK 11 | ||
5 | #define MADV_DONTDUMP 16 | ||
6 | #define MADV_DONTFORK 10 | ||
7 | #define MADV_DONTNEED 4 | ||
8 | #define MADV_FREE 8 | ||
9 | #define MADV_HUGEPAGE 14 | ||
10 | #define MADV_HWPOISON 100 | ||
11 | #define MADV_MERGEABLE 12 | ||
12 | #define MADV_NOHUGEPAGE 15 | ||
13 | #define MADV_NORMAL 0 | ||
14 | #define MADV_RANDOM 1 | ||
15 | #define MADV_REMOVE 9 | ||
16 | #define MADV_SEQUENTIAL 2 | ||
17 | #define MADV_UNMERGEABLE 13 | ||
18 | #define MADV_WILLNEED 3 | ||
19 | #define MAP_ANONYMOUS 0x0800 | ||
20 | #define MAP_DENYWRITE 0x2000 | ||
21 | #define MAP_EXECUTABLE 0x4000 | ||
22 | #define MAP_FILE 0 | ||
23 | #define MAP_FIXED 0x010 | ||
24 | #define MAP_GROWSDOWN 0x1000 | ||
25 | #define MAP_HUGETLB 0x80000 | ||
26 | #define MAP_LOCKED 0x8000 | ||
27 | #define MAP_NONBLOCK 0x20000 | ||
28 | #define MAP_NORESERVE 0x0400 | ||
29 | #define MAP_POPULATE 0x10000 | ||
30 | #define MAP_PRIVATE 0x002 | ||
31 | #define MAP_SHARED 0x001 | ||
32 | #define MAP_STACK 0x40000 | ||
33 | #define PROT_EXEC 0x04 | ||
34 | #define PROT_GROWSDOWN 0x01000000 | ||
35 | #define PROT_GROWSUP 0x02000000 | ||
36 | #define PROT_NONE 0x00 | ||
37 | #define PROT_READ 0x01 | ||
38 | #define PROT_SEM 0x10 | ||
39 | #define PROT_WRITE 0x02 | ||
40 | /* MADV_SOFT_OFFLINE is undefined on mips, fix it for perf */ | ||
41 | #define MADV_SOFT_OFFLINE 101 | ||
42 | /* MAP_32BIT is undefined on mips, fix it for perf */ | ||
43 | #define MAP_32BIT 0 | ||
44 | /* MAP_UNINITIALIZED is undefined on mips, fix it for perf */ | ||
45 | #define MAP_UNINITIALIZED 0 | ||
46 | #endif | ||
diff --git a/tools/arch/mn10300/include/uapi/asm/mman.h b/tools/arch/mn10300/include/uapi/asm/mman.h new file mode 100644 index 000000000000..c1ea36d83acc --- /dev/null +++ b/tools/arch/mn10300/include/uapi/asm/mman.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef TOOLS_ARCH_MN10300_UAPI_ASM_MMAN_FIX_H | ||
2 | #define TOOLS_ARCH_MN10300_UAPI_ASM_MMAN_FIX_H | ||
3 | #include <uapi/asm-generic/mman.h> | ||
4 | /* MAP_32BIT is undefined on mn10300, fix it for perf */ | ||
5 | #define MAP_32BIT 0 | ||
6 | #endif | ||
diff --git a/tools/arch/parisc/include/uapi/asm/mman.h b/tools/arch/parisc/include/uapi/asm/mman.h new file mode 100644 index 000000000000..03d8d5b7ae7f --- /dev/null +++ b/tools/arch/parisc/include/uapi/asm/mman.h | |||
@@ -0,0 +1,47 @@ | |||
1 | #ifndef TOOLS_ARCH_PARISC_UAPI_ASM_MMAN_FIX_H | ||
2 | #define TOOLS_ARCH_PARISC_UAPI_ASM_MMAN_FIX_H | ||
3 | #define MADV_DODUMP 70 | ||
4 | #define MADV_DOFORK 11 | ||
5 | #define MADV_DONTDUMP 69 | ||
6 | #define MADV_DONTFORK 10 | ||
7 | #define MADV_DONTNEED 4 | ||
8 | #define MADV_FREE 8 | ||
9 | #define MADV_HUGEPAGE 67 | ||
10 | #define MADV_MERGEABLE 65 | ||
11 | #define MADV_NOHUGEPAGE 68 | ||
12 | #define MADV_NORMAL 0 | ||
13 | #define MADV_RANDOM 1 | ||
14 | #define MADV_REMOVE 9 | ||
15 | #define MADV_SEQUENTIAL 2 | ||
16 | #define MADV_UNMERGEABLE 66 | ||
17 | #define MADV_WILLNEED 3 | ||
18 | #define MAP_ANONYMOUS 0x10 | ||
19 | #define MAP_DENYWRITE 0x0800 | ||
20 | #define MAP_EXECUTABLE 0x1000 | ||
21 | #define MAP_FILE 0 | ||
22 | #define MAP_FIXED 0x04 | ||
23 | #define MAP_GROWSDOWN 0x8000 | ||
24 | #define MAP_HUGETLB 0x80000 | ||
25 | #define MAP_LOCKED 0x2000 | ||
26 | #define MAP_NONBLOCK 0x20000 | ||
27 | #define MAP_NORESERVE 0x4000 | ||
28 | #define MAP_POPULATE 0x10000 | ||
29 | #define MAP_PRIVATE 0x02 | ||
30 | #define MAP_SHARED 0x01 | ||
31 | #define MAP_STACK 0x40000 | ||
32 | #define PROT_EXEC 0x4 | ||
33 | #define PROT_GROWSDOWN 0x01000000 | ||
34 | #define PROT_GROWSUP 0x02000000 | ||
35 | #define PROT_NONE 0x0 | ||
36 | #define PROT_READ 0x1 | ||
37 | #define PROT_SEM 0x8 | ||
38 | #define PROT_WRITE 0x2 | ||
39 | /* MADV_HWPOISON is undefined on parisc, fix it for perf */ | ||
40 | #define MADV_HWPOISON 100 | ||
41 | /* MADV_SOFT_OFFLINE is undefined on parisc, fix it for perf */ | ||
42 | #define MADV_SOFT_OFFLINE 101 | ||
43 | /* MAP_32BIT is undefined on parisc, fix it for perf */ | ||
44 | #define MAP_32BIT 0 | ||
45 | /* MAP_UNINITIALIZED is undefined on parisc, fix it for perf */ | ||
46 | #define MAP_UNINITIALIZED 0 | ||
47 | #endif | ||
diff --git a/tools/arch/powerpc/include/uapi/asm/mman.h b/tools/arch/powerpc/include/uapi/asm/mman.h new file mode 100644 index 000000000000..761db43172fe --- /dev/null +++ b/tools/arch/powerpc/include/uapi/asm/mman.h | |||
@@ -0,0 +1,15 @@ | |||
1 | #ifndef TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H | ||
2 | #define TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H | ||
3 | #define MAP_DENYWRITE 0x0800 | ||
4 | #define MAP_EXECUTABLE 0x1000 | ||
5 | #define MAP_GROWSDOWN 0x0100 | ||
6 | #define MAP_HUGETLB 0x40000 | ||
7 | #define MAP_LOCKED 0x80 | ||
8 | #define MAP_NONBLOCK 0x10000 | ||
9 | #define MAP_NORESERVE 0x40 | ||
10 | #define MAP_POPULATE 0x8000 | ||
11 | #define MAP_STACK 0x20000 | ||
12 | #include <uapi/asm-generic/mman-common.h> | ||
13 | /* MAP_32BIT is undefined on powerpc, fix it for perf */ | ||
14 | #define MAP_32BIT 0 | ||
15 | #endif | ||
diff --git a/tools/arch/s390/include/uapi/asm/mman.h b/tools/arch/s390/include/uapi/asm/mman.h new file mode 100644 index 000000000000..b03dea9e1f56 --- /dev/null +++ b/tools/arch/s390/include/uapi/asm/mman.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef TOOLS_ARCH_S390_UAPI_ASM_MMAN_FIX_H | ||
2 | #define TOOLS_ARCH_S390_UAPI_ASM_MMAN_FIX_H | ||
3 | #include <uapi/asm-generic/mman.h> | ||
4 | /* MAP_32BIT is undefined on s390, fix it for perf */ | ||
5 | #define MAP_32BIT 0 | ||
6 | #endif | ||
diff --git a/tools/arch/score/include/uapi/asm/mman.h b/tools/arch/score/include/uapi/asm/mman.h new file mode 100644 index 000000000000..2f8fb89944fd --- /dev/null +++ b/tools/arch/score/include/uapi/asm/mman.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef TOOLS_ARCH_SCORE_UAPI_ASM_MMAN_FIX_H | ||
2 | #define TOOLS_ARCH_SCORE_UAPI_ASM_MMAN_FIX_H | ||
3 | #include <uapi/asm-generic/mman.h> | ||
4 | /* MAP_32BIT is undefined on score, fix it for perf */ | ||
5 | #define MAP_32BIT 0 | ||
6 | #endif | ||
diff --git a/tools/arch/sh/include/uapi/asm/mman.h b/tools/arch/sh/include/uapi/asm/mman.h new file mode 100644 index 000000000000..26504f6f060e --- /dev/null +++ b/tools/arch/sh/include/uapi/asm/mman.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef TOOLS_ARCH_SH_UAPI_ASM_MMAN_FIX_H | ||
2 | #define TOOLS_ARCH_SH_UAPI_ASM_MMAN_FIX_H | ||
3 | #include <uapi/asm-generic/mman.h> | ||
4 | /* MAP_32BIT is undefined on sh, fix it for perf */ | ||
5 | #define MAP_32BIT 0 | ||
6 | #endif | ||
diff --git a/tools/arch/sparc/include/uapi/asm/mman.h b/tools/arch/sparc/include/uapi/asm/mman.h new file mode 100644 index 000000000000..8640525de991 --- /dev/null +++ b/tools/arch/sparc/include/uapi/asm/mman.h | |||
@@ -0,0 +1,15 @@ | |||
1 | #ifndef TOOLS_ARCH_SPARC_UAPI_ASM_MMAN_FIX_H | ||
2 | #define TOOLS_ARCH_SPARC_UAPI_ASM_MMAN_FIX_H | ||
3 | #define MAP_DENYWRITE 0x0800 | ||
4 | #define MAP_EXECUTABLE 0x1000 | ||
5 | #define MAP_GROWSDOWN 0x0200 | ||
6 | #define MAP_HUGETLB 0x40000 | ||
7 | #define MAP_LOCKED 0x100 | ||
8 | #define MAP_NONBLOCK 0x10000 | ||
9 | #define MAP_NORESERVE 0x40 | ||
10 | #define MAP_POPULATE 0x8000 | ||
11 | #define MAP_STACK 0x20000 | ||
12 | #include <uapi/asm-generic/mman-common.h> | ||
13 | /* MAP_32BIT is undefined on sparc, fix it for perf */ | ||
14 | #define MAP_32BIT 0 | ||
15 | #endif | ||
diff --git a/tools/arch/tile/include/uapi/asm/mman.h b/tools/arch/tile/include/uapi/asm/mman.h new file mode 100644 index 000000000000..7116c4b928b3 --- /dev/null +++ b/tools/arch/tile/include/uapi/asm/mman.h | |||
@@ -0,0 +1,15 @@ | |||
1 | #ifndef TOOLS_ARCH_TILE_UAPI_ASM_MMAN_FIX_H | ||
2 | #define TOOLS_ARCH_TILE_UAPI_ASM_MMAN_FIX_H | ||
3 | #define MAP_DENYWRITE 0x0800 | ||
4 | #define MAP_EXECUTABLE 0x1000 | ||
5 | #define MAP_GROWSDOWN 0x0100 | ||
6 | #define MAP_HUGETLB 0x4000 | ||
7 | #define MAP_LOCKED 0x0200 | ||
8 | #define MAP_NONBLOCK 0x0080 | ||
9 | #define MAP_NORESERVE 0x0400 | ||
10 | #define MAP_POPULATE 0x0040 | ||
11 | #define MAP_STACK MAP_GROWSDOWN | ||
12 | #include <uapi/asm-generic/mman-common.h> | ||
13 | /* MAP_32BIT is undefined on tile, fix it for perf */ | ||
14 | #define MAP_32BIT 0 | ||
15 | #endif | ||
diff --git a/tools/arch/x86/include/uapi/asm/mman.h b/tools/arch/x86/include/uapi/asm/mman.h new file mode 100644 index 000000000000..b73c1af8b1dd --- /dev/null +++ b/tools/arch/x86/include/uapi/asm/mman.h | |||
@@ -0,0 +1,5 @@ | |||
1 | #ifndef TOOLS_ARCH_X86_UAPI_ASM_MMAN_FIX_H | ||
2 | #define TOOLS_ARCH_X86_UAPI_ASM_MMAN_FIX_H | ||
3 | #define MAP_32BIT 0x40 | ||
4 | #include <uapi/asm-generic/mman.h> | ||
5 | #endif | ||
diff --git a/tools/arch/xtensa/include/uapi/asm/mman.h b/tools/arch/xtensa/include/uapi/asm/mman.h new file mode 100644 index 000000000000..4453195c450c --- /dev/null +++ b/tools/arch/xtensa/include/uapi/asm/mman.h | |||
@@ -0,0 +1,47 @@ | |||
1 | #ifndef TOOLS_ARCH_XTENSA_UAPI_ASM_MMAN_FIX_H | ||
2 | #define TOOLS_ARCH_XTENSA_UAPI_ASM_MMAN_FIX_H | ||
3 | #define MADV_DODUMP 17 | ||
4 | #define MADV_DOFORK 11 | ||
5 | #define MADV_DONTDUMP 16 | ||
6 | #define MADV_DONTFORK 10 | ||
7 | #define MADV_DONTNEED 4 | ||
8 | #define MADV_FREE 8 | ||
9 | #define MADV_HUGEPAGE 14 | ||
10 | #define MADV_MERGEABLE 12 | ||
11 | #define MADV_NOHUGEPAGE 15 | ||
12 | #define MADV_NORMAL 0 | ||
13 | #define MADV_RANDOM 1 | ||
14 | #define MADV_REMOVE 9 | ||
15 | #define MADV_SEQUENTIAL 2 | ||
16 | #define MADV_UNMERGEABLE 13 | ||
17 | #define MADV_WILLNEED 3 | ||
18 | #define MAP_ANONYMOUS 0x0800 | ||
19 | #define MAP_DENYWRITE 0x2000 | ||
20 | #define MAP_EXECUTABLE 0x4000 | ||
21 | #define MAP_FILE 0 | ||
22 | #define MAP_FIXED 0x010 | ||
23 | #define MAP_GROWSDOWN 0x1000 | ||
24 | #define MAP_HUGETLB 0x80000 | ||
25 | #define MAP_LOCKED 0x8000 | ||
26 | #define MAP_NONBLOCK 0x20000 | ||
27 | #define MAP_NORESERVE 0x0400 | ||
28 | #define MAP_POPULATE 0x10000 | ||
29 | #define MAP_PRIVATE 0x002 | ||
30 | #define MAP_SHARED 0x001 | ||
31 | #define MAP_STACK 0x40000 | ||
32 | #define PROT_EXEC 0x4 | ||
33 | #define PROT_GROWSDOWN 0x01000000 | ||
34 | #define PROT_GROWSUP 0x02000000 | ||
35 | #define PROT_NONE 0x0 | ||
36 | #define PROT_READ 0x1 | ||
37 | #define PROT_SEM 0x10 | ||
38 | #define PROT_WRITE 0x2 | ||
39 | /* MADV_HWPOISON is undefined on xtensa, fix it for perf */ | ||
40 | #define MADV_HWPOISON 100 | ||
41 | /* MADV_SOFT_OFFLINE is undefined on xtensa, fix it for perf */ | ||
42 | #define MADV_SOFT_OFFLINE 101 | ||
43 | /* MAP_32BIT is undefined on xtensa, fix it for perf */ | ||
44 | #define MAP_32BIT 0 | ||
45 | /* MAP_UNINITIALIZED is undefined on xtensa, fix it for perf */ | ||
46 | #define MAP_UNINITIALIZED 0 | ||
47 | #endif | ||
diff --git a/tools/include/uapi/asm-generic/mman-common.h b/tools/include/uapi/asm-generic/mman-common.h new file mode 100644 index 000000000000..58274382a616 --- /dev/null +++ b/tools/include/uapi/asm-generic/mman-common.h | |||
@@ -0,0 +1,75 @@ | |||
1 | #ifndef __ASM_GENERIC_MMAN_COMMON_H | ||
2 | #define __ASM_GENERIC_MMAN_COMMON_H | ||
3 | |||
4 | /* | ||
5 | Author: Michael S. Tsirkin <mst@mellanox.co.il>, Mellanox Technologies Ltd. | ||
6 | Based on: asm-xxx/mman.h | ||
7 | */ | ||
8 | |||
9 | #define PROT_READ 0x1 /* page can be read */ | ||
10 | #define PROT_WRITE 0x2 /* page can be written */ | ||
11 | #define PROT_EXEC 0x4 /* page can be executed */ | ||
12 | #define PROT_SEM 0x8 /* page may be used for atomic ops */ | ||
13 | #define PROT_NONE 0x0 /* page can not be accessed */ | ||
14 | #define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ | ||
15 | #define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ | ||
16 | |||
17 | #define MAP_SHARED 0x01 /* Share changes */ | ||
18 | #define MAP_PRIVATE 0x02 /* Changes are private */ | ||
19 | #define MAP_TYPE 0x0f /* Mask for type of mapping */ | ||
20 | #define MAP_FIXED 0x10 /* Interpret addr exactly */ | ||
21 | #define MAP_ANONYMOUS 0x20 /* don't use a file */ | ||
22 | #ifdef CONFIG_MMAP_ALLOW_UNINITIALIZED | ||
23 | # define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be uninitialized */ | ||
24 | #else | ||
25 | # define MAP_UNINITIALIZED 0x0 /* Don't support this flag */ | ||
26 | #endif | ||
27 | |||
28 | /* | ||
29 | * Flags for mlock | ||
30 | */ | ||
31 | #define MLOCK_ONFAULT 0x01 /* Lock pages in range after they are faulted in, do not prefault */ | ||
32 | |||
33 | #define MS_ASYNC 1 /* sync memory asynchronously */ | ||
34 | #define MS_INVALIDATE 2 /* invalidate the caches */ | ||
35 | #define MS_SYNC 4 /* synchronous memory sync */ | ||
36 | |||
37 | #define MADV_NORMAL 0 /* no further special treatment */ | ||
38 | #define MADV_RANDOM 1 /* expect random page references */ | ||
39 | #define MADV_SEQUENTIAL 2 /* expect sequential page references */ | ||
40 | #define MADV_WILLNEED 3 /* will need these pages */ | ||
41 | #define MADV_DONTNEED 4 /* don't need these pages */ | ||
42 | |||
43 | /* common parameters: try to keep these consistent across architectures */ | ||
44 | #define MADV_FREE 8 /* free pages only if memory pressure */ | ||
45 | #define MADV_REMOVE 9 /* remove these pages & resources */ | ||
46 | #define MADV_DONTFORK 10 /* don't inherit across fork */ | ||
47 | #define MADV_DOFORK 11 /* do inherit across fork */ | ||
48 | #define MADV_HWPOISON 100 /* poison a page for testing */ | ||
49 | #define MADV_SOFT_OFFLINE 101 /* soft offline page for testing */ | ||
50 | |||
51 | #define MADV_MERGEABLE 12 /* KSM may merge identical pages */ | ||
52 | #define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */ | ||
53 | |||
54 | #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ | ||
55 | #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ | ||
56 | |||
57 | #define MADV_DONTDUMP 16 /* Explicity exclude from the core dump, | ||
58 | overrides the coredump filter bits */ | ||
59 | #define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag */ | ||
60 | |||
61 | /* compatibility flags */ | ||
62 | #define MAP_FILE 0 | ||
63 | |||
64 | /* | ||
65 | * When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size. | ||
66 | * This gives us 6 bits, which is enough until someone invents 128 bit address | ||
67 | * spaces. | ||
68 | * | ||
69 | * Assume these are all power of twos. | ||
70 | * When 0 use the default page size. | ||
71 | */ | ||
72 | #define MAP_HUGE_SHIFT 26 | ||
73 | #define MAP_HUGE_MASK 0x3f | ||
74 | |||
75 | #endif /* __ASM_GENERIC_MMAN_COMMON_H */ | ||
diff --git a/tools/include/uapi/asm-generic/mman.h b/tools/include/uapi/asm-generic/mman.h new file mode 100644 index 000000000000..10fa7857777f --- /dev/null +++ b/tools/include/uapi/asm-generic/mman.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #ifndef __ASM_GENERIC_MMAN_H | ||
2 | #define __ASM_GENERIC_MMAN_H | ||
3 | |||
4 | #include <uapi/asm-generic/mman-common.h> | ||
5 | |||
6 | #define MAP_GROWSDOWN 0x0100 /* stack-like segment */ | ||
7 | #define MAP_DENYWRITE 0x0800 /* ETXTBSY */ | ||
8 | #define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ | ||
9 | #define MAP_LOCKED 0x2000 /* pages are locked */ | ||
10 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ | ||
11 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ | ||
12 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ | ||
13 | #define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ | ||
14 | #define MAP_HUGETLB 0x40000 /* create a huge page mapping */ | ||
15 | |||
16 | /* Bits [26:31] are reserved, see mman-common.h for MAP_HUGETLB usage */ | ||
17 | |||
18 | #define MCL_CURRENT 1 /* lock all current mappings */ | ||
19 | #define MCL_FUTURE 2 /* lock all future mappings */ | ||
20 | #define MCL_ONFAULT 4 /* lock all pages that are faulted in */ | ||
21 | |||
22 | #endif /* __ASM_GENERIC_MMAN_H */ | ||
diff --git a/tools/include/uapi/linux/mman.h b/tools/include/uapi/linux/mman.h new file mode 100644 index 000000000000..81d8edf11789 --- /dev/null +++ b/tools/include/uapi/linux/mman.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef _UAPI_LINUX_MMAN_H | ||
2 | #define _UAPI_LINUX_MMAN_H | ||
3 | |||
4 | #include <uapi/asm/mman.h> | ||
5 | |||
6 | #define MREMAP_MAYMOVE 1 | ||
7 | #define MREMAP_FIXED 2 | ||
8 | |||
9 | #define OVERCOMMIT_GUESS 0 | ||
10 | #define OVERCOMMIT_ALWAYS 1 | ||
11 | #define OVERCOMMIT_NEVER 2 | ||
12 | |||
13 | #endif /* _UAPI_LINUX_MMAN_H */ | ||
diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt index 379a2bed07c0..1a24f4d64328 100644 --- a/tools/perf/Documentation/perf-record.txt +++ b/tools/perf/Documentation/perf-record.txt | |||
@@ -60,6 +60,18 @@ OPTIONS | |||
60 | Note: If user explicitly sets options which conflict with the params, | 60 | Note: If user explicitly sets options which conflict with the params, |
61 | the value set by the params will be overridden. | 61 | the value set by the params will be overridden. |
62 | 62 | ||
63 | Also not defined in .../<pmu>/format/* are PMU driver specific | ||
64 | configuration parameters. Any configuration parameter preceded by | ||
65 | the letter '@' is not interpreted in user space and sent down directly | ||
66 | to the PMU driver. For example: | ||
67 | |||
68 | perf record -e some_event/@cfg1,@cfg2=config/ ... | ||
69 | |||
70 | will see 'cfg1' and 'cfg2=config' pushed to the PMU driver associated | ||
71 | with the event for further processing. There is no restriction on | ||
72 | what the configuration parameters are, as long as their semantic is | ||
73 | understood and supported by the PMU driver. | ||
74 | |||
63 | - a hardware breakpoint event in the form of '\mem:addr[/len][:access]' | 75 | - a hardware breakpoint event in the form of '\mem:addr[/len][:access]' |
64 | where addr is the address in memory you want to break in. | 76 | where addr is the address in memory you want to break in. |
65 | Access is the memory access type (read, write, execute) it can | 77 | Access is the memory access type (read, write, execute) it can |
diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST index ff200c6cb790..0bda2cca2b3a 100644 --- a/tools/perf/MANIFEST +++ b/tools/perf/MANIFEST | |||
@@ -66,9 +66,12 @@ tools/include/linux/hash.h | |||
66 | tools/include/linux/kernel.h | 66 | tools/include/linux/kernel.h |
67 | tools/include/linux/list.h | 67 | tools/include/linux/list.h |
68 | tools/include/linux/log2.h | 68 | tools/include/linux/log2.h |
69 | tools/include/uapi/asm-generic/mman-common.h | ||
70 | tools/include/uapi/asm-generic/mman.h | ||
69 | tools/include/uapi/linux/bpf.h | 71 | tools/include/uapi/linux/bpf.h |
70 | tools/include/uapi/linux/bpf_common.h | 72 | tools/include/uapi/linux/bpf_common.h |
71 | tools/include/uapi/linux/hw_breakpoint.h | 73 | tools/include/uapi/linux/hw_breakpoint.h |
74 | tools/include/uapi/linux/mman.h | ||
72 | tools/include/uapi/linux/perf_event.h | 75 | tools/include/uapi/linux/perf_event.h |
73 | tools/include/linux/poison.h | 76 | tools/include/linux/poison.h |
74 | tools/include/linux/rbtree.h | 77 | tools/include/linux/rbtree.h |
@@ -79,4 +82,5 @@ tools/include/linux/types.h | |||
79 | tools/include/linux/err.h | 82 | tools/include/linux/err.h |
80 | tools/include/linux/bitmap.h | 83 | tools/include/linux/bitmap.h |
81 | tools/include/linux/time64.h | 84 | tools/include/linux/time64.h |
85 | tools/arch/*/include/uapi/asm/mman.h | ||
82 | tools/arch/*/include/uapi/asm/perf_regs.h | 86 | tools/arch/*/include/uapi/asm/perf_regs.h |
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 828cfd766e31..d710db16b963 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf | |||
@@ -432,6 +432,15 @@ $(PERF_IN): prepare FORCE | |||
432 | @(test -f ../../include/linux/coresight-pmu.h && ( \ | 432 | @(test -f ../../include/linux/coresight-pmu.h && ( \ |
433 | (diff -B ../include/linux/coresight-pmu.h ../../include/linux/coresight-pmu.h >/dev/null) \ | 433 | (diff -B ../include/linux/coresight-pmu.h ../../include/linux/coresight-pmu.h >/dev/null) \ |
434 | || echo "Warning: tools/include/linux/coresight-pmu.h differs from kernel" >&2 )) || true | 434 | || echo "Warning: tools/include/linux/coresight-pmu.h differs from kernel" >&2 )) || true |
435 | @(test -f ../../include/uapi/asm-generic/mman-common.h && ( \ | ||
436 | (diff -B ../include/uapi/asm-generic/mman-common.h ../../include/uapi/asm-generic/mman-common.h >/dev/null) \ | ||
437 | || echo "Warning: tools/include/uapi/asm-generic/mman-common.h differs from kernel" >&2 )) || true | ||
438 | @(test -f ../../include/uapi/asm-generic/mman.h && ( \ | ||
439 | (diff -B -I "^#include <\(uapi/\)*asm-generic/mman-common.h>$$" ../include/uapi/asm-generic/mman.h ../../include/uapi/asm-generic/mman.h >/dev/null) \ | ||
440 | || echo "Warning: tools/include/uapi/asm-generic/mman.h differs from kernel" >&2 )) || true | ||
441 | @(test -f ../../include/uapi/linux/mman.h && ( \ | ||
442 | (diff -B -I "^#include <\(uapi/\)*asm/mman.h>$$" ../include/uapi/linux/mman.h ../../include/uapi/linux/mman.h >/dev/null) \ | ||
443 | || echo "Warning: tools/include/uapi/linux/mman.h differs from kernel" >&2 )) || true | ||
435 | $(Q)$(MAKE) $(build)=perf | 444 | $(Q)$(MAKE) $(build)=perf |
436 | 445 | ||
437 | $(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) $(LIBTRACEEVENT_DYNAMIC_LIST) | 446 | $(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) $(LIBTRACEEVENT_DYNAMIC_LIST) |
diff --git a/tools/perf/arch/x86/include/dwarf-regs-table.h b/tools/perf/arch/x86/include/dwarf-regs-table.h index 39ac7cbb525b..9b5e5cbb4209 100644 --- a/tools/perf/arch/x86/include/dwarf-regs-table.h +++ b/tools/perf/arch/x86/include/dwarf-regs-table.h | |||
@@ -7,7 +7,7 @@ static const char * const x86_32_regstr_tbl[] = { | |||
7 | }; | 7 | }; |
8 | 8 | ||
9 | static const char * const x86_64_regstr_tbl[] = { | 9 | static const char * const x86_64_regstr_tbl[] = { |
10 | "%ax", "dx", "%cx", "%bx", "%si", "%di", | 10 | "%ax", "%dx", "%cx", "%bx", "%si", "%di", |
11 | "%bp", "%sp", "%r8", "%r9", "%r10", "%r11", | 11 | "%bp", "%sp", "%r8", "%r9", "%r10", "%r11", |
12 | "%r12", "%r13", "%r14", "%r15", | 12 | "%r12", "%r13", "%r14", "%r15", |
13 | }; | 13 | }; |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 1a07c4cdf6ed..6e88460cd13d 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -935,7 +935,6 @@ repeat: | |||
935 | 935 | ||
936 | if (symbol_conf.report_hierarchy) { | 936 | if (symbol_conf.report_hierarchy) { |
937 | /* disable incompatible options */ | 937 | /* disable incompatible options */ |
938 | symbol_conf.event_group = false; | ||
939 | symbol_conf.cumulate_callchain = false; | 938 | symbol_conf.cumulate_callchain = false; |
940 | 939 | ||
941 | if (field_order) { | 940 | if (field_order) { |
diff --git a/tools/perf/trace/beauty/mmap.c b/tools/perf/trace/beauty/mmap.c index d0a3a8e402e7..fd710ab33684 100644 --- a/tools/perf/trace/beauty/mmap.c +++ b/tools/perf/trace/beauty/mmap.c | |||
@@ -1,8 +1,4 @@ | |||
1 | #include <sys/mman.h> | 1 | #include <uapi/linux/mman.h> |
2 | |||
3 | #ifndef PROT_SEM | ||
4 | #define PROT_SEM 0x8 | ||
5 | #endif | ||
6 | 2 | ||
7 | static size_t syscall_arg__scnprintf_mmap_prot(char *bf, size_t size, | 3 | static size_t syscall_arg__scnprintf_mmap_prot(char *bf, size_t size, |
8 | struct syscall_arg *arg) | 4 | struct syscall_arg *arg) |
@@ -33,31 +29,6 @@ static size_t syscall_arg__scnprintf_mmap_prot(char *bf, size_t size, | |||
33 | 29 | ||
34 | #define SCA_MMAP_PROT syscall_arg__scnprintf_mmap_prot | 30 | #define SCA_MMAP_PROT syscall_arg__scnprintf_mmap_prot |
35 | 31 | ||
36 | #ifndef MAP_FIXED | ||
37 | #define MAP_FIXED 0x10 | ||
38 | #endif | ||
39 | |||
40 | #ifndef MAP_ANONYMOUS | ||
41 | #define MAP_ANONYMOUS 0x20 | ||
42 | #endif | ||
43 | |||
44 | #ifndef MAP_32BIT | ||
45 | #define MAP_32BIT 0x40 | ||
46 | #endif | ||
47 | |||
48 | #ifndef MAP_STACK | ||
49 | #define MAP_STACK 0x20000 | ||
50 | #endif | ||
51 | |||
52 | #ifndef MAP_HUGETLB | ||
53 | #define MAP_HUGETLB 0x40000 | ||
54 | #endif | ||
55 | |||
56 | #ifndef MAP_UNINITIALIZED | ||
57 | #define MAP_UNINITIALIZED 0x4000000 | ||
58 | #endif | ||
59 | |||
60 | |||
61 | static size_t syscall_arg__scnprintf_mmap_flags(char *bf, size_t size, | 32 | static size_t syscall_arg__scnprintf_mmap_flags(char *bf, size_t size, |
62 | struct syscall_arg *arg) | 33 | struct syscall_arg *arg) |
63 | { | 34 | { |
@@ -95,13 +66,6 @@ static size_t syscall_arg__scnprintf_mmap_flags(char *bf, size_t size, | |||
95 | 66 | ||
96 | #define SCA_MMAP_FLAGS syscall_arg__scnprintf_mmap_flags | 67 | #define SCA_MMAP_FLAGS syscall_arg__scnprintf_mmap_flags |
97 | 68 | ||
98 | #ifndef MREMAP_MAYMOVE | ||
99 | #define MREMAP_MAYMOVE 1 | ||
100 | #endif | ||
101 | #ifndef MREMAP_FIXED | ||
102 | #define MREMAP_FIXED 2 | ||
103 | #endif | ||
104 | |||
105 | static size_t syscall_arg__scnprintf_mremap_flags(char *bf, size_t size, | 69 | static size_t syscall_arg__scnprintf_mremap_flags(char *bf, size_t size, |
106 | struct syscall_arg *arg) | 70 | struct syscall_arg *arg) |
107 | { | 71 | { |
@@ -125,39 +89,6 @@ static size_t syscall_arg__scnprintf_mremap_flags(char *bf, size_t size, | |||
125 | 89 | ||
126 | #define SCA_MREMAP_FLAGS syscall_arg__scnprintf_mremap_flags | 90 | #define SCA_MREMAP_FLAGS syscall_arg__scnprintf_mremap_flags |
127 | 91 | ||
128 | #ifndef MADV_HWPOISON | ||
129 | #define MADV_HWPOISON 100 | ||
130 | #endif | ||
131 | |||
132 | #ifndef MADV_SOFT_OFFLINE | ||
133 | #define MADV_SOFT_OFFLINE 101 | ||
134 | #endif | ||
135 | |||
136 | #ifndef MADV_MERGEABLE | ||
137 | #define MADV_MERGEABLE 12 | ||
138 | #endif | ||
139 | |||
140 | #ifndef MADV_UNMERGEABLE | ||
141 | #define MADV_UNMERGEABLE 13 | ||
142 | #endif | ||
143 | |||
144 | #ifndef MADV_HUGEPAGE | ||
145 | #define MADV_HUGEPAGE 14 | ||
146 | #endif | ||
147 | |||
148 | #ifndef MADV_NOHUGEPAGE | ||
149 | #define MADV_NOHUGEPAGE 15 | ||
150 | #endif | ||
151 | |||
152 | #ifndef MADV_DONTDUMP | ||
153 | #define MADV_DONTDUMP 16 | ||
154 | #endif | ||
155 | |||
156 | #ifndef MADV_DODUMP | ||
157 | #define MADV_DODUMP 17 | ||
158 | #endif | ||
159 | |||
160 | |||
161 | static size_t syscall_arg__scnprintf_madvise_behavior(char *bf, size_t size, | 92 | static size_t syscall_arg__scnprintf_madvise_behavior(char *bf, size_t size, |
162 | struct syscall_arg *arg) | 93 | struct syscall_arg *arg) |
163 | { | 94 | { |
@@ -170,6 +101,7 @@ static size_t syscall_arg__scnprintf_madvise_behavior(char *bf, size_t size, | |||
170 | P_MADV_BHV(SEQUENTIAL); | 101 | P_MADV_BHV(SEQUENTIAL); |
171 | P_MADV_BHV(WILLNEED); | 102 | P_MADV_BHV(WILLNEED); |
172 | P_MADV_BHV(DONTNEED); | 103 | P_MADV_BHV(DONTNEED); |
104 | P_MADV_BHV(FREE); | ||
173 | P_MADV_BHV(REMOVE); | 105 | P_MADV_BHV(REMOVE); |
174 | P_MADV_BHV(DONTFORK); | 106 | P_MADV_BHV(DONTFORK); |
175 | P_MADV_BHV(DOFORK); | 107 | P_MADV_BHV(DOFORK); |
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index f0611c937d4b..a6d5d248b8fb 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -1097,7 +1097,6 @@ static int __hpp__slsmg_color_printf(struct perf_hpp *hpp, const char *fmt, ...) | |||
1097 | ret = scnprintf(hpp->buf, hpp->size, fmt, len, percent); | 1097 | ret = scnprintf(hpp->buf, hpp->size, fmt, len, percent); |
1098 | ui_browser__printf(arg->b, "%s", hpp->buf); | 1098 | ui_browser__printf(arg->b, "%s", hpp->buf); |
1099 | 1099 | ||
1100 | advance_hpp(hpp, ret); | ||
1101 | return ret; | 1100 | return ret; |
1102 | } | 1101 | } |
1103 | 1102 | ||
@@ -2076,10 +2075,10 @@ void hist_browser__init(struct hist_browser *browser, | |||
2076 | browser->b.use_navkeypressed = true; | 2075 | browser->b.use_navkeypressed = true; |
2077 | browser->show_headers = symbol_conf.show_hist_headers; | 2076 | browser->show_headers = symbol_conf.show_hist_headers; |
2078 | 2077 | ||
2079 | hists__for_each_format(hists, fmt) { | 2078 | hists__for_each_format(hists, fmt) |
2080 | perf_hpp__reset_width(fmt, hists); | ||
2081 | ++browser->b.columns; | 2079 | ++browser->b.columns; |
2082 | } | 2080 | |
2081 | hists__reset_column_width(hists); | ||
2083 | } | 2082 | } |
2084 | 2083 | ||
2085 | struct hist_browser *hist_browser__new(struct hists *hists) | 2084 | struct hist_browser *hist_browser__new(struct hists *hists) |
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index b47fafc8ee2a..60c4a4d08374 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c | |||
@@ -699,6 +699,21 @@ void perf_hpp__reset_width(struct perf_hpp_fmt *fmt, struct hists *hists) | |||
699 | } | 699 | } |
700 | } | 700 | } |
701 | 701 | ||
702 | void hists__reset_column_width(struct hists *hists) | ||
703 | { | ||
704 | struct perf_hpp_fmt *fmt; | ||
705 | struct perf_hpp_list_node *node; | ||
706 | |||
707 | hists__for_each_format(hists, fmt) | ||
708 | perf_hpp__reset_width(fmt, hists); | ||
709 | |||
710 | /* hierarchy entries have their own hpp list */ | ||
711 | list_for_each_entry(node, &hists->hpp_formats, list) { | ||
712 | perf_hpp_list__for_each_format(&node->hpp, fmt) | ||
713 | perf_hpp__reset_width(fmt, hists); | ||
714 | } | ||
715 | } | ||
716 | |||
702 | void perf_hpp__set_user_width(const char *width_list_str) | 717 | void perf_hpp__set_user_width(const char *width_list_str) |
703 | { | 718 | { |
704 | struct perf_hpp_fmt *fmt; | 719 | struct perf_hpp_fmt *fmt; |
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c index 9b65f4a6b35a..8e1840bff29d 100644 --- a/tools/perf/ui/stdio/hist.c +++ b/tools/perf/ui/stdio/hist.c | |||
@@ -528,8 +528,8 @@ static int print_hierarchy_indent(const char *sep, int indent, | |||
528 | return fprintf(fp, "%-.*s", (indent - 2) * HIERARCHY_INDENT, line); | 528 | return fprintf(fp, "%-.*s", (indent - 2) * HIERARCHY_INDENT, line); |
529 | } | 529 | } |
530 | 530 | ||
531 | static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp, | 531 | static int hists__fprintf_hierarchy_headers(struct hists *hists, |
532 | const char *sep, FILE *fp) | 532 | struct perf_hpp *hpp, FILE *fp) |
533 | { | 533 | { |
534 | bool first_node, first_col; | 534 | bool first_node, first_col; |
535 | int indent; | 535 | int indent; |
@@ -538,6 +538,7 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp, | |||
538 | unsigned header_width = 0; | 538 | unsigned header_width = 0; |
539 | struct perf_hpp_fmt *fmt; | 539 | struct perf_hpp_fmt *fmt; |
540 | struct perf_hpp_list_node *fmt_node; | 540 | struct perf_hpp_list_node *fmt_node; |
541 | const char *sep = symbol_conf.field_sep; | ||
541 | 542 | ||
542 | indent = hists->nr_hpp_node; | 543 | indent = hists->nr_hpp_node; |
543 | 544 | ||
@@ -623,22 +624,6 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp, | |||
623 | return 2; | 624 | return 2; |
624 | } | 625 | } |
625 | 626 | ||
626 | static int | ||
627 | hists__fprintf_hierarchy_headers(struct hists *hists, | ||
628 | struct perf_hpp *hpp, | ||
629 | FILE *fp) | ||
630 | { | ||
631 | struct perf_hpp_list_node *fmt_node; | ||
632 | struct perf_hpp_fmt *fmt; | ||
633 | |||
634 | list_for_each_entry(fmt_node, &hists->hpp_formats, list) { | ||
635 | perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) | ||
636 | perf_hpp__reset_width(fmt, hists); | ||
637 | } | ||
638 | |||
639 | return print_hierarchy_header(hists, hpp, symbol_conf.field_sep, fp); | ||
640 | } | ||
641 | |||
642 | static void fprintf_line(struct hists *hists, struct perf_hpp *hpp, | 627 | static void fprintf_line(struct hists *hists, struct perf_hpp *hpp, |
643 | int line, FILE *fp) | 628 | int line, FILE *fp) |
644 | { | 629 | { |
@@ -732,7 +717,6 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows, | |||
732 | int max_cols, float min_pcnt, FILE *fp, | 717 | int max_cols, float min_pcnt, FILE *fp, |
733 | bool use_callchain) | 718 | bool use_callchain) |
734 | { | 719 | { |
735 | struct perf_hpp_fmt *fmt; | ||
736 | struct rb_node *nd; | 720 | struct rb_node *nd; |
737 | size_t ret = 0; | 721 | size_t ret = 0; |
738 | const char *sep = symbol_conf.field_sep; | 722 | const char *sep = symbol_conf.field_sep; |
@@ -743,8 +727,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows, | |||
743 | 727 | ||
744 | init_rem_hits(); | 728 | init_rem_hits(); |
745 | 729 | ||
746 | hists__for_each_format(hists, fmt) | 730 | hists__reset_column_width(hists); |
747 | perf_hpp__reset_width(fmt, hists); | ||
748 | 731 | ||
749 | if (symbol_conf.col_width_list_str) | 732 | if (symbol_conf.col_width_list_str) |
750 | perf_hpp__set_user_width(symbol_conf.col_width_list_str); | 733 | perf_hpp__set_user_width(symbol_conf.col_width_list_str); |
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 7a80c7362a03..aeb5a441bd74 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -54,7 +54,7 @@ int ins__scnprintf(struct ins *ins, char *bf, size_t size, | |||
54 | return ins__raw_scnprintf(ins, bf, size, ops); | 54 | return ins__raw_scnprintf(ins, bf, size, ops); |
55 | } | 55 | } |
56 | 56 | ||
57 | static int call__parse(struct ins_operands *ops) | 57 | static int call__parse(struct ins_operands *ops, struct map *map) |
58 | { | 58 | { |
59 | char *endptr, *tok, *name; | 59 | char *endptr, *tok, *name; |
60 | 60 | ||
@@ -82,16 +82,16 @@ static int call__parse(struct ins_operands *ops) | |||
82 | return ops->target.name == NULL ? -1 : 0; | 82 | return ops->target.name == NULL ? -1 : 0; |
83 | 83 | ||
84 | indirect_call: | 84 | indirect_call: |
85 | tok = strchr(endptr, '('); | 85 | tok = strchr(endptr, '*'); |
86 | if (tok != NULL) { | 86 | if (tok == NULL) { |
87 | ops->target.addr = 0; | 87 | struct symbol *sym = map__find_symbol(map, map->map_ip(map, ops->target.addr)); |
88 | if (sym != NULL) | ||
89 | ops->target.name = strdup(sym->name); | ||
90 | else | ||
91 | ops->target.addr = 0; | ||
88 | return 0; | 92 | return 0; |
89 | } | 93 | } |
90 | 94 | ||
91 | tok = strchr(endptr, '*'); | ||
92 | if (tok == NULL) | ||
93 | return -1; | ||
94 | |||
95 | ops->target.addr = strtoull(tok + 1, NULL, 16); | 95 | ops->target.addr = strtoull(tok + 1, NULL, 16); |
96 | return 0; | 96 | return 0; |
97 | } | 97 | } |
@@ -118,7 +118,7 @@ bool ins__is_call(const struct ins *ins) | |||
118 | return ins->ops == &call_ops; | 118 | return ins->ops == &call_ops; |
119 | } | 119 | } |
120 | 120 | ||
121 | static int jump__parse(struct ins_operands *ops) | 121 | static int jump__parse(struct ins_operands *ops, struct map *map __maybe_unused) |
122 | { | 122 | { |
123 | const char *s = strchr(ops->raw, '+'); | 123 | const char *s = strchr(ops->raw, '+'); |
124 | 124 | ||
@@ -173,7 +173,7 @@ static int comment__symbol(char *raw, char *comment, u64 *addrp, char **namep) | |||
173 | return 0; | 173 | return 0; |
174 | } | 174 | } |
175 | 175 | ||
176 | static int lock__parse(struct ins_operands *ops) | 176 | static int lock__parse(struct ins_operands *ops, struct map *map) |
177 | { | 177 | { |
178 | char *name; | 178 | char *name; |
179 | 179 | ||
@@ -194,7 +194,7 @@ static int lock__parse(struct ins_operands *ops) | |||
194 | return 0; | 194 | return 0; |
195 | 195 | ||
196 | if (ops->locked.ins->ops->parse && | 196 | if (ops->locked.ins->ops->parse && |
197 | ops->locked.ins->ops->parse(ops->locked.ops) < 0) | 197 | ops->locked.ins->ops->parse(ops->locked.ops, map) < 0) |
198 | goto out_free_ops; | 198 | goto out_free_ops; |
199 | 199 | ||
200 | return 0; | 200 | return 0; |
@@ -237,7 +237,7 @@ static struct ins_ops lock_ops = { | |||
237 | .scnprintf = lock__scnprintf, | 237 | .scnprintf = lock__scnprintf, |
238 | }; | 238 | }; |
239 | 239 | ||
240 | static int mov__parse(struct ins_operands *ops) | 240 | static int mov__parse(struct ins_operands *ops, struct map *map __maybe_unused) |
241 | { | 241 | { |
242 | char *s = strchr(ops->raw, ','), *target, *comment, prev; | 242 | char *s = strchr(ops->raw, ','), *target, *comment, prev; |
243 | 243 | ||
@@ -304,7 +304,7 @@ static struct ins_ops mov_ops = { | |||
304 | .scnprintf = mov__scnprintf, | 304 | .scnprintf = mov__scnprintf, |
305 | }; | 305 | }; |
306 | 306 | ||
307 | static int dec__parse(struct ins_operands *ops) | 307 | static int dec__parse(struct ins_operands *ops, struct map *map __maybe_unused) |
308 | { | 308 | { |
309 | char *target, *comment, *s, prev; | 309 | char *target, *comment, *s, prev; |
310 | 310 | ||
@@ -709,7 +709,7 @@ int hist_entry__inc_addr_samples(struct hist_entry *he, int evidx, u64 ip) | |||
709 | return symbol__inc_addr_samples(he->ms.sym, he->ms.map, evidx, ip); | 709 | return symbol__inc_addr_samples(he->ms.sym, he->ms.map, evidx, ip); |
710 | } | 710 | } |
711 | 711 | ||
712 | static void disasm_line__init_ins(struct disasm_line *dl) | 712 | static void disasm_line__init_ins(struct disasm_line *dl, struct map *map) |
713 | { | 713 | { |
714 | dl->ins = ins__find(dl->name); | 714 | dl->ins = ins__find(dl->name); |
715 | 715 | ||
@@ -719,7 +719,7 @@ static void disasm_line__init_ins(struct disasm_line *dl) | |||
719 | if (!dl->ins->ops) | 719 | if (!dl->ins->ops) |
720 | return; | 720 | return; |
721 | 721 | ||
722 | if (dl->ins->ops->parse && dl->ins->ops->parse(&dl->ops) < 0) | 722 | if (dl->ins->ops->parse && dl->ins->ops->parse(&dl->ops, map) < 0) |
723 | dl->ins = NULL; | 723 | dl->ins = NULL; |
724 | } | 724 | } |
725 | 725 | ||
@@ -761,7 +761,8 @@ out_free_name: | |||
761 | } | 761 | } |
762 | 762 | ||
763 | static struct disasm_line *disasm_line__new(s64 offset, char *line, | 763 | static struct disasm_line *disasm_line__new(s64 offset, char *line, |
764 | size_t privsize, int line_nr) | 764 | size_t privsize, int line_nr, |
765 | struct map *map) | ||
765 | { | 766 | { |
766 | struct disasm_line *dl = zalloc(sizeof(*dl) + privsize); | 767 | struct disasm_line *dl = zalloc(sizeof(*dl) + privsize); |
767 | 768 | ||
@@ -776,7 +777,7 @@ static struct disasm_line *disasm_line__new(s64 offset, char *line, | |||
776 | if (disasm_line__parse(dl->line, &dl->name, &dl->ops.raw) < 0) | 777 | if (disasm_line__parse(dl->line, &dl->name, &dl->ops.raw) < 0) |
777 | goto out_free_line; | 778 | goto out_free_line; |
778 | 779 | ||
779 | disasm_line__init_ins(dl); | 780 | disasm_line__init_ins(dl, map); |
780 | } | 781 | } |
781 | } | 782 | } |
782 | 783 | ||
@@ -1148,7 +1149,7 @@ static int symbol__parse_objdump_line(struct symbol *sym, struct map *map, | |||
1148 | parsed_line = tmp2 + 1; | 1149 | parsed_line = tmp2 + 1; |
1149 | } | 1150 | } |
1150 | 1151 | ||
1151 | dl = disasm_line__new(offset, parsed_line, privsize, *line_nr); | 1152 | dl = disasm_line__new(offset, parsed_line, privsize, *line_nr, map); |
1152 | free(line); | 1153 | free(line); |
1153 | (*line_nr)++; | 1154 | (*line_nr)++; |
1154 | 1155 | ||
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index ea44e4ff19c6..5bbcec173b82 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h | |||
@@ -36,7 +36,7 @@ struct ins_operands { | |||
36 | 36 | ||
37 | struct ins_ops { | 37 | struct ins_ops { |
38 | void (*free)(struct ins_operands *ops); | 38 | void (*free)(struct ins_operands *ops); |
39 | int (*parse)(struct ins_operands *ops); | 39 | int (*parse)(struct ins_operands *ops, struct map *map); |
40 | int (*scnprintf)(struct ins *ins, char *bf, size_t size, | 40 | int (*scnprintf)(struct ins *ins, char *bf, size_t size, |
41 | struct ins_operands *ops); | 41 | struct ins_operands *ops); |
42 | }; | 42 | }; |
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index 774f6ec884d5..d2c6cdd9d42b 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c | |||
@@ -363,6 +363,9 @@ static int __open_dso(struct dso *dso, struct machine *machine) | |||
363 | return -EINVAL; | 363 | return -EINVAL; |
364 | } | 364 | } |
365 | 365 | ||
366 | if (!is_regular_file(name)) | ||
367 | return -EINVAL; | ||
368 | |||
366 | fd = do_open(name); | 369 | fd = do_open(name); |
367 | free(name); | 370 | free(name); |
368 | return fd; | 371 | return fd; |
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 6c3017139c67..2880e2226fdb 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -1,5 +1,5 @@ | |||
1 | #include <linux/types.h> | 1 | #include <linux/types.h> |
2 | #include <sys/mman.h> | 2 | #include <uapi/linux/mman.h> /* To get things like MAP_HUGETLB even on older libc headers */ |
3 | #include <api/fs/fs.h> | 3 | #include <api/fs/fs.h> |
4 | #include "event.h" | 4 | #include "event.h" |
5 | #include "debug.h" | 5 | #include "debug.h" |
@@ -249,10 +249,8 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool, | |||
249 | bool truncation = false; | 249 | bool truncation = false; |
250 | unsigned long long timeout = proc_map_timeout * 1000000ULL; | 250 | unsigned long long timeout = proc_map_timeout * 1000000ULL; |
251 | int rc = 0; | 251 | int rc = 0; |
252 | #ifdef MAP_HUGETLB | ||
253 | const char *hugetlbfs_mnt = hugetlbfs__mountpoint(); | 252 | const char *hugetlbfs_mnt = hugetlbfs__mountpoint(); |
254 | int hugetlbfs_mnt_len = hugetlbfs_mnt ? strlen(hugetlbfs_mnt) : 0; | 253 | int hugetlbfs_mnt_len = hugetlbfs_mnt ? strlen(hugetlbfs_mnt) : 0; |
255 | #endif | ||
256 | 254 | ||
257 | if (machine__is_default_guest(machine)) | 255 | if (machine__is_default_guest(machine)) |
258 | return 0; | 256 | return 0; |
@@ -347,12 +345,11 @@ out: | |||
347 | 345 | ||
348 | if (!strcmp(execname, "")) | 346 | if (!strcmp(execname, "")) |
349 | strcpy(execname, anonstr); | 347 | strcpy(execname, anonstr); |
350 | #ifdef MAP_HUGETLB | 348 | |
351 | if (!strncmp(execname, hugetlbfs_mnt, hugetlbfs_mnt_len)) { | 349 | if (!strncmp(execname, hugetlbfs_mnt, hugetlbfs_mnt_len)) { |
352 | strcpy(execname, anonstr); | 350 | strcpy(execname, anonstr); |
353 | event->mmap2.flags |= MAP_HUGETLB; | 351 | event->mmap2.flags |= MAP_HUGETLB; |
354 | } | 352 | } |
355 | #endif | ||
356 | 353 | ||
357 | size = strlen(execname) + 1; | 354 | size = strlen(execname) + 1; |
358 | memcpy(event->mmap2.filename, execname, size); | 355 | memcpy(event->mmap2.filename, execname, size); |
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index 4d44129e050b..323806082c58 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h | |||
@@ -46,6 +46,7 @@ enum { | |||
46 | PERF_EVSEL__CONFIG_TERM_INHERIT, | 46 | PERF_EVSEL__CONFIG_TERM_INHERIT, |
47 | PERF_EVSEL__CONFIG_TERM_MAX_STACK, | 47 | PERF_EVSEL__CONFIG_TERM_MAX_STACK, |
48 | PERF_EVSEL__CONFIG_TERM_OVERWRITE, | 48 | PERF_EVSEL__CONFIG_TERM_OVERWRITE, |
49 | PERF_EVSEL__CONFIG_TERM_DRV_CFG, | ||
49 | PERF_EVSEL__CONFIG_TERM_MAX, | 50 | PERF_EVSEL__CONFIG_TERM_MAX, |
50 | }; | 51 | }; |
51 | 52 | ||
@@ -57,6 +58,7 @@ struct perf_evsel_config_term { | |||
57 | u64 freq; | 58 | u64 freq; |
58 | bool time; | 59 | bool time; |
59 | char *callgraph; | 60 | char *callgraph; |
61 | char *drv_cfg; | ||
60 | u64 stack_user; | 62 | u64 stack_user; |
61 | int max_stack; | 63 | int max_stack; |
62 | bool inherit; | 64 | bool inherit; |
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index de15dbcdcecf..b02992efb513 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -177,8 +177,10 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h) | |||
177 | hists__new_col_len(hists, HISTC_LOCAL_WEIGHT, 12); | 177 | hists__new_col_len(hists, HISTC_LOCAL_WEIGHT, 12); |
178 | hists__new_col_len(hists, HISTC_GLOBAL_WEIGHT, 12); | 178 | hists__new_col_len(hists, HISTC_GLOBAL_WEIGHT, 12); |
179 | 179 | ||
180 | if (h->srcline) | 180 | if (h->srcline) { |
181 | hists__new_col_len(hists, HISTC_SRCLINE, strlen(h->srcline)); | 181 | len = MAX(strlen(h->srcline), strlen(sort_srcline.se_header)); |
182 | hists__new_col_len(hists, HISTC_SRCLINE, len); | ||
183 | } | ||
182 | 184 | ||
183 | if (h->srcfile) | 185 | if (h->srcfile) |
184 | hists__new_col_len(hists, HISTC_SRCFILE, strlen(h->srcfile)); | 186 | hists__new_col_len(hists, HISTC_SRCFILE, strlen(h->srcfile)); |
@@ -417,6 +419,8 @@ static int hist_entry__init(struct hist_entry *he, | |||
417 | } | 419 | } |
418 | INIT_LIST_HEAD(&he->pairs.node); | 420 | INIT_LIST_HEAD(&he->pairs.node); |
419 | thread__get(he->thread); | 421 | thread__get(he->thread); |
422 | he->hroot_in = RB_ROOT; | ||
423 | he->hroot_out = RB_ROOT; | ||
420 | 424 | ||
421 | if (!symbol_conf.report_hierarchy) | 425 | if (!symbol_conf.report_hierarchy) |
422 | he->leaf = true; | 426 | he->leaf = true; |
@@ -2149,6 +2153,50 @@ out: | |||
2149 | return he; | 2153 | return he; |
2150 | } | 2154 | } |
2151 | 2155 | ||
2156 | static struct hist_entry *add_dummy_hierarchy_entry(struct hists *hists, | ||
2157 | struct rb_root *root, | ||
2158 | struct hist_entry *pair) | ||
2159 | { | ||
2160 | struct rb_node **p; | ||
2161 | struct rb_node *parent = NULL; | ||
2162 | struct hist_entry *he; | ||
2163 | struct perf_hpp_fmt *fmt; | ||
2164 | |||
2165 | p = &root->rb_node; | ||
2166 | while (*p != NULL) { | ||
2167 | int64_t cmp = 0; | ||
2168 | |||
2169 | parent = *p; | ||
2170 | he = rb_entry(parent, struct hist_entry, rb_node_in); | ||
2171 | |||
2172 | perf_hpp_list__for_each_sort_list(he->hpp_list, fmt) { | ||
2173 | cmp = fmt->collapse(fmt, he, pair); | ||
2174 | if (cmp) | ||
2175 | break; | ||
2176 | } | ||
2177 | if (!cmp) | ||
2178 | goto out; | ||
2179 | |||
2180 | if (cmp < 0) | ||
2181 | p = &parent->rb_left; | ||
2182 | else | ||
2183 | p = &parent->rb_right; | ||
2184 | } | ||
2185 | |||
2186 | he = hist_entry__new(pair, true); | ||
2187 | if (he) { | ||
2188 | rb_link_node(&he->rb_node_in, parent, p); | ||
2189 | rb_insert_color(&he->rb_node_in, root); | ||
2190 | |||
2191 | he->dummy = true; | ||
2192 | he->hists = hists; | ||
2193 | memset(&he->stat, 0, sizeof(he->stat)); | ||
2194 | hists__inc_stats(hists, he); | ||
2195 | } | ||
2196 | out: | ||
2197 | return he; | ||
2198 | } | ||
2199 | |||
2152 | static struct hist_entry *hists__find_entry(struct hists *hists, | 2200 | static struct hist_entry *hists__find_entry(struct hists *hists, |
2153 | struct hist_entry *he) | 2201 | struct hist_entry *he) |
2154 | { | 2202 | { |
@@ -2174,6 +2222,51 @@ static struct hist_entry *hists__find_entry(struct hists *hists, | |||
2174 | return NULL; | 2222 | return NULL; |
2175 | } | 2223 | } |
2176 | 2224 | ||
2225 | static struct hist_entry *hists__find_hierarchy_entry(struct rb_root *root, | ||
2226 | struct hist_entry *he) | ||
2227 | { | ||
2228 | struct rb_node *n = root->rb_node; | ||
2229 | |||
2230 | while (n) { | ||
2231 | struct hist_entry *iter; | ||
2232 | struct perf_hpp_fmt *fmt; | ||
2233 | int64_t cmp = 0; | ||
2234 | |||
2235 | iter = rb_entry(n, struct hist_entry, rb_node_in); | ||
2236 | perf_hpp_list__for_each_sort_list(he->hpp_list, fmt) { | ||
2237 | cmp = fmt->collapse(fmt, iter, he); | ||
2238 | if (cmp) | ||
2239 | break; | ||
2240 | } | ||
2241 | |||
2242 | if (cmp < 0) | ||
2243 | n = n->rb_left; | ||
2244 | else if (cmp > 0) | ||
2245 | n = n->rb_right; | ||
2246 | else | ||
2247 | return iter; | ||
2248 | } | ||
2249 | |||
2250 | return NULL; | ||
2251 | } | ||
2252 | |||
2253 | static void hists__match_hierarchy(struct rb_root *leader_root, | ||
2254 | struct rb_root *other_root) | ||
2255 | { | ||
2256 | struct rb_node *nd; | ||
2257 | struct hist_entry *pos, *pair; | ||
2258 | |||
2259 | for (nd = rb_first(leader_root); nd; nd = rb_next(nd)) { | ||
2260 | pos = rb_entry(nd, struct hist_entry, rb_node_in); | ||
2261 | pair = hists__find_hierarchy_entry(other_root, pos); | ||
2262 | |||
2263 | if (pair) { | ||
2264 | hist_entry__add_pair(pair, pos); | ||
2265 | hists__match_hierarchy(&pos->hroot_in, &pair->hroot_in); | ||
2266 | } | ||
2267 | } | ||
2268 | } | ||
2269 | |||
2177 | /* | 2270 | /* |
2178 | * Look for pairs to link to the leader buckets (hist_entries): | 2271 | * Look for pairs to link to the leader buckets (hist_entries): |
2179 | */ | 2272 | */ |
@@ -2183,6 +2276,12 @@ void hists__match(struct hists *leader, struct hists *other) | |||
2183 | struct rb_node *nd; | 2276 | struct rb_node *nd; |
2184 | struct hist_entry *pos, *pair; | 2277 | struct hist_entry *pos, *pair; |
2185 | 2278 | ||
2279 | if (symbol_conf.report_hierarchy) { | ||
2280 | /* hierarchy report always collapses entries */ | ||
2281 | return hists__match_hierarchy(&leader->entries_collapsed, | ||
2282 | &other->entries_collapsed); | ||
2283 | } | ||
2284 | |||
2186 | if (hists__has(leader, need_collapse)) | 2285 | if (hists__has(leader, need_collapse)) |
2187 | root = &leader->entries_collapsed; | 2286 | root = &leader->entries_collapsed; |
2188 | else | 2287 | else |
@@ -2197,6 +2296,50 @@ void hists__match(struct hists *leader, struct hists *other) | |||
2197 | } | 2296 | } |
2198 | } | 2297 | } |
2199 | 2298 | ||
2299 | static int hists__link_hierarchy(struct hists *leader_hists, | ||
2300 | struct hist_entry *parent, | ||
2301 | struct rb_root *leader_root, | ||
2302 | struct rb_root *other_root) | ||
2303 | { | ||
2304 | struct rb_node *nd; | ||
2305 | struct hist_entry *pos, *leader; | ||
2306 | |||
2307 | for (nd = rb_first(other_root); nd; nd = rb_next(nd)) { | ||
2308 | pos = rb_entry(nd, struct hist_entry, rb_node_in); | ||
2309 | |||
2310 | if (hist_entry__has_pairs(pos)) { | ||
2311 | bool found = false; | ||
2312 | |||
2313 | list_for_each_entry(leader, &pos->pairs.head, pairs.node) { | ||
2314 | if (leader->hists == leader_hists) { | ||
2315 | found = true; | ||
2316 | break; | ||
2317 | } | ||
2318 | } | ||
2319 | if (!found) | ||
2320 | return -1; | ||
2321 | } else { | ||
2322 | leader = add_dummy_hierarchy_entry(leader_hists, | ||
2323 | leader_root, pos); | ||
2324 | if (leader == NULL) | ||
2325 | return -1; | ||
2326 | |||
2327 | /* do not point parent in the pos */ | ||
2328 | leader->parent_he = parent; | ||
2329 | |||
2330 | hist_entry__add_pair(pos, leader); | ||
2331 | } | ||
2332 | |||
2333 | if (!pos->leaf) { | ||
2334 | if (hists__link_hierarchy(leader_hists, leader, | ||
2335 | &leader->hroot_in, | ||
2336 | &pos->hroot_in) < 0) | ||
2337 | return -1; | ||
2338 | } | ||
2339 | } | ||
2340 | return 0; | ||
2341 | } | ||
2342 | |||
2200 | /* | 2343 | /* |
2201 | * Look for entries in the other hists that are not present in the leader, if | 2344 | * Look for entries in the other hists that are not present in the leader, if |
2202 | * we find them, just add a dummy entry on the leader hists, with period=0, | 2345 | * we find them, just add a dummy entry on the leader hists, with period=0, |
@@ -2208,6 +2351,13 @@ int hists__link(struct hists *leader, struct hists *other) | |||
2208 | struct rb_node *nd; | 2351 | struct rb_node *nd; |
2209 | struct hist_entry *pos, *pair; | 2352 | struct hist_entry *pos, *pair; |
2210 | 2353 | ||
2354 | if (symbol_conf.report_hierarchy) { | ||
2355 | /* hierarchy report always collapses entries */ | ||
2356 | return hists__link_hierarchy(leader, NULL, | ||
2357 | &leader->entries_collapsed, | ||
2358 | &other->entries_collapsed); | ||
2359 | } | ||
2360 | |||
2211 | if (hists__has(other, need_collapse)) | 2361 | if (hists__has(other, need_collapse)) |
2212 | root = &other->entries_collapsed; | 2362 | root = &other->entries_collapsed; |
2213 | else | 2363 | else |
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index a002c93fe422..defa957f27df 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
@@ -368,6 +368,7 @@ static inline bool perf_hpp__should_skip(struct perf_hpp_fmt *format, | |||
368 | void perf_hpp__reset_width(struct perf_hpp_fmt *fmt, struct hists *hists); | 368 | void perf_hpp__reset_width(struct perf_hpp_fmt *fmt, struct hists *hists); |
369 | void perf_hpp__reset_sort_width(struct perf_hpp_fmt *fmt, struct hists *hists); | 369 | void perf_hpp__reset_sort_width(struct perf_hpp_fmt *fmt, struct hists *hists); |
370 | void perf_hpp__set_user_width(const char *width_list_str); | 370 | void perf_hpp__set_user_width(const char *width_list_str); |
371 | void hists__reset_column_width(struct hists *hists); | ||
371 | 372 | ||
372 | typedef u64 (*hpp_field_fn)(struct hist_entry *he); | 373 | typedef u64 (*hpp_field_fn)(struct hist_entry *he); |
373 | typedef int (*hpp_callback_fn)(struct perf_hpp *hpp, bool front); | 374 | typedef int (*hpp_callback_fn)(struct perf_hpp *hpp, bool front); |
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index d51a1257973b..c662fef95d14 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c | |||
@@ -6,7 +6,7 @@ | |||
6 | #include <string.h> | 6 | #include <string.h> |
7 | #include <stdio.h> | 7 | #include <stdio.h> |
8 | #include <unistd.h> | 8 | #include <unistd.h> |
9 | #include <sys/mman.h> | 9 | #include <uapi/linux/mman.h> /* To get things like MAP_HUGETLB even on older libc headers */ |
10 | #include "map.h" | 10 | #include "map.h" |
11 | #include "thread.h" | 11 | #include "thread.h" |
12 | #include "strlist.h" | 12 | #include "strlist.h" |
@@ -27,12 +27,7 @@ const char *map_type__name[MAP__NR_TYPES] = { | |||
27 | 27 | ||
28 | static inline int is_anon_memory(const char *filename, u32 flags) | 28 | static inline int is_anon_memory(const char *filename, u32 flags) |
29 | { | 29 | { |
30 | u32 anon_flags = 0; | 30 | return flags & MAP_HUGETLB || |
31 | |||
32 | #ifdef MAP_HUGETLB | ||
33 | anon_flags |= MAP_HUGETLB; | ||
34 | #endif | ||
35 | return flags & anon_flags || | ||
36 | !strcmp(filename, "//anon") || | 31 | !strcmp(filename, "//anon") || |
37 | !strncmp(filename, "/dev/zero", sizeof("/dev/zero") - 1) || | 32 | !strncmp(filename, "/dev/zero", sizeof("/dev/zero") - 1) || |
38 | !strncmp(filename, "/anon_hugepage", sizeof("/anon_hugepage") - 1); | 33 | !strncmp(filename, "/anon_hugepage", sizeof("/anon_hugepage") - 1); |
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 6c913c3914fb..2eb8b1ed4cc8 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -904,6 +904,7 @@ static const char *config_term_names[__PARSE_EVENTS__TERM_TYPE_NR] = { | |||
904 | [PARSE_EVENTS__TERM_TYPE_MAX_STACK] = "max-stack", | 904 | [PARSE_EVENTS__TERM_TYPE_MAX_STACK] = "max-stack", |
905 | [PARSE_EVENTS__TERM_TYPE_OVERWRITE] = "overwrite", | 905 | [PARSE_EVENTS__TERM_TYPE_OVERWRITE] = "overwrite", |
906 | [PARSE_EVENTS__TERM_TYPE_NOOVERWRITE] = "no-overwrite", | 906 | [PARSE_EVENTS__TERM_TYPE_NOOVERWRITE] = "no-overwrite", |
907 | [PARSE_EVENTS__TERM_TYPE_DRV_CFG] = "driver-config", | ||
907 | }; | 908 | }; |
908 | 909 | ||
909 | static bool config_term_shrinked; | 910 | static bool config_term_shrinked; |
@@ -1034,7 +1035,8 @@ static int config_term_pmu(struct perf_event_attr *attr, | |||
1034 | struct parse_events_term *term, | 1035 | struct parse_events_term *term, |
1035 | struct parse_events_error *err) | 1036 | struct parse_events_error *err) |
1036 | { | 1037 | { |
1037 | if (term->type_term == PARSE_EVENTS__TERM_TYPE_USER) | 1038 | if (term->type_term == PARSE_EVENTS__TERM_TYPE_USER || |
1039 | term->type_term == PARSE_EVENTS__TERM_TYPE_DRV_CFG) | ||
1038 | /* | 1040 | /* |
1039 | * Always succeed for sysfs terms, as we dont know | 1041 | * Always succeed for sysfs terms, as we dont know |
1040 | * at this point what type they need to have. | 1042 | * at this point what type they need to have. |
@@ -1134,6 +1136,9 @@ do { \ | |||
1134 | case PARSE_EVENTS__TERM_TYPE_NOOVERWRITE: | 1136 | case PARSE_EVENTS__TERM_TYPE_NOOVERWRITE: |
1135 | ADD_CONFIG_TERM(OVERWRITE, overwrite, term->val.num ? 0 : 1); | 1137 | ADD_CONFIG_TERM(OVERWRITE, overwrite, term->val.num ? 0 : 1); |
1136 | break; | 1138 | break; |
1139 | case PARSE_EVENTS__TERM_TYPE_DRV_CFG: | ||
1140 | ADD_CONFIG_TERM(DRV_CFG, drv_cfg, term->val.str); | ||
1141 | break; | ||
1137 | default: | 1142 | default: |
1138 | break; | 1143 | break; |
1139 | } | 1144 | } |
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index d1edbf8cc66a..8d09a976fca8 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h | |||
@@ -71,6 +71,7 @@ enum { | |||
71 | PARSE_EVENTS__TERM_TYPE_MAX_STACK, | 71 | PARSE_EVENTS__TERM_TYPE_MAX_STACK, |
72 | PARSE_EVENTS__TERM_TYPE_NOOVERWRITE, | 72 | PARSE_EVENTS__TERM_TYPE_NOOVERWRITE, |
73 | PARSE_EVENTS__TERM_TYPE_OVERWRITE, | 73 | PARSE_EVENTS__TERM_TYPE_OVERWRITE, |
74 | PARSE_EVENTS__TERM_TYPE_DRV_CFG, | ||
74 | __PARSE_EVENTS__TERM_TYPE_NR, | 75 | __PARSE_EVENTS__TERM_TYPE_NR, |
75 | }; | 76 | }; |
76 | 77 | ||
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l index 7a2519435da0..9f43fda2570f 100644 --- a/tools/perf/util/parse-events.l +++ b/tools/perf/util/parse-events.l | |||
@@ -53,6 +53,26 @@ static int str(yyscan_t scanner, int token) | |||
53 | return token; | 53 | return token; |
54 | } | 54 | } |
55 | 55 | ||
56 | /* | ||
57 | * This function is called when the parser gets two kind of input: | ||
58 | * | ||
59 | * @cfg1 or @cfg2=config | ||
60 | * | ||
61 | * The leading '@' is stripped off before 'cfg1' and 'cfg2=config' are given to | ||
62 | * bison. In the latter case it is necessary to keep the string intact so that | ||
63 | * the PMU kernel driver can determine what configurable is associated to | ||
64 | * 'config'. | ||
65 | */ | ||
66 | static int drv_str(yyscan_t scanner, int token) | ||
67 | { | ||
68 | YYSTYPE *yylval = parse_events_get_lval(scanner); | ||
69 | char *text = parse_events_get_text(scanner); | ||
70 | |||
71 | /* Strip off the '@' */ | ||
72 | yylval->str = strdup(text + 1); | ||
73 | return token; | ||
74 | } | ||
75 | |||
56 | #define REWIND(__alloc) \ | 76 | #define REWIND(__alloc) \ |
57 | do { \ | 77 | do { \ |
58 | YYSTYPE *__yylval = parse_events_get_lval(yyscanner); \ | 78 | YYSTYPE *__yylval = parse_events_get_lval(yyscanner); \ |
@@ -124,6 +144,7 @@ num_hex 0x[a-fA-F0-9]+ | |||
124 | num_raw_hex [a-fA-F0-9]+ | 144 | num_raw_hex [a-fA-F0-9]+ |
125 | name [a-zA-Z_*?][a-zA-Z0-9_*?.]* | 145 | name [a-zA-Z_*?][a-zA-Z0-9_*?.]* |
126 | name_minus [a-zA-Z_*?][a-zA-Z0-9\-_*?.:]* | 146 | name_minus [a-zA-Z_*?][a-zA-Z0-9\-_*?.:]* |
147 | drv_cfg_term [a-zA-Z0-9_\.]+(=[a-zA-Z0-9_*?\.:]+)? | ||
127 | /* If you add a modifier you need to update check_modifier() */ | 148 | /* If you add a modifier you need to update check_modifier() */ |
128 | modifier_event [ukhpPGHSDI]+ | 149 | modifier_event [ukhpPGHSDI]+ |
129 | modifier_bp [rwx]{1,3} | 150 | modifier_bp [rwx]{1,3} |
@@ -209,6 +230,7 @@ no-overwrite { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_NOOVERWRITE); } | |||
209 | {name_minus} { return str(yyscanner, PE_NAME); } | 230 | {name_minus} { return str(yyscanner, PE_NAME); } |
210 | \[all\] { return PE_ARRAY_ALL; } | 231 | \[all\] { return PE_ARRAY_ALL; } |
211 | "[" { BEGIN(array); return '['; } | 232 | "[" { BEGIN(array); return '['; } |
233 | @{drv_cfg_term} { return drv_str(yyscanner, PE_DRV_CFG_TERM); } | ||
212 | } | 234 | } |
213 | 235 | ||
214 | <mem>{ | 236 | <mem>{ |
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y index 5be4a5f216d6..879115f93edc 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y | |||
@@ -49,6 +49,7 @@ static void inc_group_count(struct list_head *list, | |||
49 | %token PE_ERROR | 49 | %token PE_ERROR |
50 | %token PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT | 50 | %token PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT |
51 | %token PE_ARRAY_ALL PE_ARRAY_RANGE | 51 | %token PE_ARRAY_ALL PE_ARRAY_RANGE |
52 | %token PE_DRV_CFG_TERM | ||
52 | %type <num> PE_VALUE | 53 | %type <num> PE_VALUE |
53 | %type <num> PE_VALUE_SYM_HW | 54 | %type <num> PE_VALUE_SYM_HW |
54 | %type <num> PE_VALUE_SYM_SW | 55 | %type <num> PE_VALUE_SYM_SW |
@@ -63,6 +64,7 @@ static void inc_group_count(struct list_head *list, | |||
63 | %type <str> PE_MODIFIER_BP | 64 | %type <str> PE_MODIFIER_BP |
64 | %type <str> PE_EVENT_NAME | 65 | %type <str> PE_EVENT_NAME |
65 | %type <str> PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT | 66 | %type <str> PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT |
67 | %type <str> PE_DRV_CFG_TERM | ||
66 | %type <num> value_sym | 68 | %type <num> value_sym |
67 | %type <head> event_config | 69 | %type <head> event_config |
68 | %type <head> opt_event_config | 70 | %type <head> opt_event_config |
@@ -599,6 +601,15 @@ PE_NAME array '=' PE_VALUE | |||
599 | term->array = $2; | 601 | term->array = $2; |
600 | $$ = term; | 602 | $$ = term; |
601 | } | 603 | } |
604 | | | ||
605 | PE_DRV_CFG_TERM | ||
606 | { | ||
607 | struct parse_events_term *term; | ||
608 | |||
609 | ABORT_ON(parse_events_term__str(&term, PARSE_EVENTS__TERM_TYPE_DRV_CFG, | ||
610 | $1, $1, &@1, NULL)); | ||
611 | $$ = term; | ||
612 | } | ||
602 | 613 | ||
603 | array: | 614 | array: |
604 | '[' array_terms ']' | 615 | '[' array_terms ']' |
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h index 28c0524c8702..9505483cb95c 100644 --- a/tools/perf/util/sort.h +++ b/tools/perf/util/sort.h | |||
@@ -40,6 +40,7 @@ extern struct sort_entry sort_dso_from; | |||
40 | extern struct sort_entry sort_dso_to; | 40 | extern struct sort_entry sort_dso_to; |
41 | extern struct sort_entry sort_sym_from; | 41 | extern struct sort_entry sort_sym_from; |
42 | extern struct sort_entry sort_sym_to; | 42 | extern struct sort_entry sort_sym_to; |
43 | extern struct sort_entry sort_srcline; | ||
43 | extern enum sort_type sort__first_dimension; | 44 | extern enum sort_type sort__first_dimension; |
44 | extern const char default_mem_sort_order[]; | 45 | extern const char default_mem_sort_order[]; |
45 | 46 | ||