diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-05 17:37:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-05 17:37:25 -0400 |
commit | 7178fb0b239d1c037876301c116fc9a6c1bd2ac0 (patch) | |
tree | 3d42185646c78eb589a6138a9667a25c447e418f | |
parent | 70c9fb570b7c1c3edb03cbe745cf81ceeef5d484 (diff) | |
parent | 6f55967ad9d9752813e36de6d5fdbd19741adfc7 (diff) |
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Ingo Molnar:
"I'd like to apologize for this very late pull request: I was dithering
through the week whether to send the fixes, and then yesterday Jiri's
crash fix for a regression introduced in this cycle clearly marked
perf/urgent as 'must merge now'.
Most of the commits are tooling fixes, plus there's three kernel fixes
via four commits:
- race fix in the Intel PEBS code
- fix an AUX bug and roll back a previous attempt
- fix AMD family 17h generic HW cache-event perf counters
The largest diffstat contribution comes from the AMD fix - a new event
table is introduced, which is a fairly low risk change but has a large
linecount"
* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
perf/x86/intel: Fix race in intel_pmu_disable_event()
perf/x86/intel/pt: Remove software double buffering PMU capability
perf/ring_buffer: Fix AUX software double buffering
perf tools: Remove needless asm/unistd.h include fixing build in some places
tools arch uapi: Copy missing unistd.h headers for arc, hexagon and riscv
tools build: Add -ldl to the disassembler-four-args feature test
perf cs-etm: Always allocate memory for cs_etm_queue::prev_packet
perf cs-etm: Don't check cs_etm_queue::prev_packet validity
perf report: Report OOM in status line in the GTK UI
perf bench numa: Add define for RUSAGE_THREAD if not present
tools lib traceevent: Change tag string for error
perf annotate: Fix build on 32 bit for BPF annotation
tools uapi x86: Sync vmx.h with the kernel
perf bpf: Return value with unlocking in perf_env__find_btf()
MAINTAINERS: Include vendor specific files under arch/*/events/*
perf/x86/amd: Update generic hardware cache events for Family 17h
-rw-r--r-- | MAINTAINERS | 1 | ||||
-rw-r--r-- | arch/x86/events/amd/core.c | 111 | ||||
-rw-r--r-- | arch/x86/events/intel/core.c | 10 | ||||
-rw-r--r-- | arch/x86/events/intel/pt.c | 3 | ||||
-rw-r--r-- | include/linux/perf_event.h | 1 | ||||
-rw-r--r-- | kernel/events/ring_buffer.c | 3 | ||||
-rw-r--r-- | tools/arch/arc/include/uapi/asm/unistd.h | 51 | ||||
-rw-r--r-- | tools/arch/hexagon/include/uapi/asm/unistd.h | 40 | ||||
-rw-r--r-- | tools/arch/riscv/include/uapi/asm/unistd.h | 42 | ||||
-rw-r--r-- | tools/arch/x86/include/uapi/asm/vmx.h | 1 | ||||
-rw-r--r-- | tools/lib/traceevent/parse-utils.c | 2 | ||||
-rw-r--r-- | tools/perf/Makefile.config | 2 | ||||
-rw-r--r-- | tools/perf/bench/numa.c | 4 | ||||
-rw-r--r-- | tools/perf/util/annotate.c | 8 | ||||
-rw-r--r-- | tools/perf/util/cloexec.c | 1 | ||||
-rw-r--r-- | tools/perf/util/cs-etm.c | 14 | ||||
-rw-r--r-- | tools/perf/util/env.c | 2 | ||||
-rw-r--r-- | tools/perf/util/session.c | 8 |
18 files changed, 272 insertions, 32 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 057a72a85156..2c2fce72e694 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -12176,6 +12176,7 @@ F: arch/*/kernel/*/*/perf_event*.c | |||
12176 | F: arch/*/include/asm/perf_event.h | 12176 | F: arch/*/include/asm/perf_event.h |
12177 | F: arch/*/kernel/perf_callchain.c | 12177 | F: arch/*/kernel/perf_callchain.c |
12178 | F: arch/*/events/* | 12178 | F: arch/*/events/* |
12179 | F: arch/*/events/*/* | ||
12179 | F: tools/perf/ | 12180 | F: tools/perf/ |
12180 | 12181 | ||
12181 | PERSONALITY HANDLING | 12182 | PERSONALITY HANDLING |
diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c index d45f3fbd232e..f15441b07dad 100644 --- a/arch/x86/events/amd/core.c +++ b/arch/x86/events/amd/core.c | |||
@@ -116,6 +116,110 @@ static __initconst const u64 amd_hw_cache_event_ids | |||
116 | }, | 116 | }, |
117 | }; | 117 | }; |
118 | 118 | ||
119 | static __initconst const u64 amd_hw_cache_event_ids_f17h | ||
120 | [PERF_COUNT_HW_CACHE_MAX] | ||
121 | [PERF_COUNT_HW_CACHE_OP_MAX] | ||
122 | [PERF_COUNT_HW_CACHE_RESULT_MAX] = { | ||
123 | [C(L1D)] = { | ||
124 | [C(OP_READ)] = { | ||
125 | [C(RESULT_ACCESS)] = 0x0040, /* Data Cache Accesses */ | ||
126 | [C(RESULT_MISS)] = 0xc860, /* L2$ access from DC Miss */ | ||
127 | }, | ||
128 | [C(OP_WRITE)] = { | ||
129 | [C(RESULT_ACCESS)] = 0, | ||
130 | [C(RESULT_MISS)] = 0, | ||
131 | }, | ||
132 | [C(OP_PREFETCH)] = { | ||
133 | [C(RESULT_ACCESS)] = 0xff5a, /* h/w prefetch DC Fills */ | ||
134 | [C(RESULT_MISS)] = 0, | ||
135 | }, | ||
136 | }, | ||
137 | [C(L1I)] = { | ||
138 | [C(OP_READ)] = { | ||
139 | [C(RESULT_ACCESS)] = 0x0080, /* Instruction cache fetches */ | ||
140 | [C(RESULT_MISS)] = 0x0081, /* Instruction cache misses */ | ||
141 | }, | ||
142 | [C(OP_WRITE)] = { | ||
143 | [C(RESULT_ACCESS)] = -1, | ||
144 | [C(RESULT_MISS)] = -1, | ||
145 | }, | ||
146 | [C(OP_PREFETCH)] = { | ||
147 | [C(RESULT_ACCESS)] = 0, | ||
148 | [C(RESULT_MISS)] = 0, | ||
149 | }, | ||
150 | }, | ||
151 | [C(LL)] = { | ||
152 | [C(OP_READ)] = { | ||
153 | [C(RESULT_ACCESS)] = 0, | ||
154 | [C(RESULT_MISS)] = 0, | ||
155 | }, | ||
156 | [C(OP_WRITE)] = { | ||
157 | [C(RESULT_ACCESS)] = 0, | ||
158 | [C(RESULT_MISS)] = 0, | ||
159 | }, | ||
160 | [C(OP_PREFETCH)] = { | ||
161 | [C(RESULT_ACCESS)] = 0, | ||
162 | [C(RESULT_MISS)] = 0, | ||
163 | }, | ||
164 | }, | ||
165 | [C(DTLB)] = { | ||
166 | [C(OP_READ)] = { | ||
167 | [C(RESULT_ACCESS)] = 0xff45, /* All L2 DTLB accesses */ | ||
168 | [C(RESULT_MISS)] = 0xf045, /* L2 DTLB misses (PT walks) */ | ||
169 | }, | ||
170 | [C(OP_WRITE)] = { | ||
171 | [C(RESULT_ACCESS)] = 0, | ||
172 | [C(RESULT_MISS)] = 0, | ||
173 | }, | ||
174 | [C(OP_PREFETCH)] = { | ||
175 | [C(RESULT_ACCESS)] = 0, | ||
176 | [C(RESULT_MISS)] = 0, | ||
177 | }, | ||
178 | }, | ||
179 | [C(ITLB)] = { | ||
180 | [C(OP_READ)] = { | ||
181 | [C(RESULT_ACCESS)] = 0x0084, /* L1 ITLB misses, L2 ITLB hits */ | ||
182 | [C(RESULT_MISS)] = 0xff85, /* L1 ITLB misses, L2 misses */ | ||
183 | }, | ||
184 | [C(OP_WRITE)] = { | ||
185 | [C(RESULT_ACCESS)] = -1, | ||
186 | [C(RESULT_MISS)] = -1, | ||
187 | }, | ||
188 | [C(OP_PREFETCH)] = { | ||
189 | [C(RESULT_ACCESS)] = -1, | ||
190 | [C(RESULT_MISS)] = -1, | ||
191 | }, | ||
192 | }, | ||
193 | [C(BPU)] = { | ||
194 | [C(OP_READ)] = { | ||
195 | [C(RESULT_ACCESS)] = 0x00c2, /* Retired Branch Instr. */ | ||
196 | [C(RESULT_MISS)] = 0x00c3, /* Retired Mispredicted BI */ | ||
197 | }, | ||
198 | [C(OP_WRITE)] = { | ||
199 | [C(RESULT_ACCESS)] = -1, | ||
200 | [C(RESULT_MISS)] = -1, | ||
201 | }, | ||
202 | [C(OP_PREFETCH)] = { | ||
203 | [C(RESULT_ACCESS)] = -1, | ||
204 | [C(RESULT_MISS)] = -1, | ||
205 | }, | ||
206 | }, | ||
207 | [C(NODE)] = { | ||
208 | [C(OP_READ)] = { | ||
209 | [C(RESULT_ACCESS)] = 0, | ||
210 | [C(RESULT_MISS)] = 0, | ||
211 | }, | ||
212 | [C(OP_WRITE)] = { | ||
213 | [C(RESULT_ACCESS)] = -1, | ||
214 | [C(RESULT_MISS)] = -1, | ||
215 | }, | ||
216 | [C(OP_PREFETCH)] = { | ||
217 | [C(RESULT_ACCESS)] = -1, | ||
218 | [C(RESULT_MISS)] = -1, | ||
219 | }, | ||
220 | }, | ||
221 | }; | ||
222 | |||
119 | /* | 223 | /* |
120 | * AMD Performance Monitor K7 and later, up to and including Family 16h: | 224 | * AMD Performance Monitor K7 and later, up to and including Family 16h: |
121 | */ | 225 | */ |
@@ -865,9 +969,10 @@ __init int amd_pmu_init(void) | |||
865 | x86_pmu.amd_nb_constraints = 0; | 969 | x86_pmu.amd_nb_constraints = 0; |
866 | } | 970 | } |
867 | 971 | ||
868 | /* Events are common for all AMDs */ | 972 | if (boot_cpu_data.x86 >= 0x17) |
869 | memcpy(hw_cache_event_ids, amd_hw_cache_event_ids, | 973 | memcpy(hw_cache_event_ids, amd_hw_cache_event_ids_f17h, sizeof(hw_cache_event_ids)); |
870 | sizeof(hw_cache_event_ids)); | 974 | else |
975 | memcpy(hw_cache_event_ids, amd_hw_cache_event_ids, sizeof(hw_cache_event_ids)); | ||
871 | 976 | ||
872 | return 0; | 977 | return 0; |
873 | } | 978 | } |
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index f9451566cd9b..d35f4775d5f1 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c | |||
@@ -2091,15 +2091,19 @@ static void intel_pmu_disable_event(struct perf_event *event) | |||
2091 | cpuc->intel_ctrl_host_mask &= ~(1ull << hwc->idx); | 2091 | cpuc->intel_ctrl_host_mask &= ~(1ull << hwc->idx); |
2092 | cpuc->intel_cp_status &= ~(1ull << hwc->idx); | 2092 | cpuc->intel_cp_status &= ~(1ull << hwc->idx); |
2093 | 2093 | ||
2094 | if (unlikely(event->attr.precise_ip)) | ||
2095 | intel_pmu_pebs_disable(event); | ||
2096 | |||
2097 | if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL)) { | 2094 | if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL)) { |
2098 | intel_pmu_disable_fixed(hwc); | 2095 | intel_pmu_disable_fixed(hwc); |
2099 | return; | 2096 | return; |
2100 | } | 2097 | } |
2101 | 2098 | ||
2102 | x86_pmu_disable_event(event); | 2099 | x86_pmu_disable_event(event); |
2100 | |||
2101 | /* | ||
2102 | * Needs to be called after x86_pmu_disable_event, | ||
2103 | * so we don't trigger the event without PEBS bit set. | ||
2104 | */ | ||
2105 | if (unlikely(event->attr.precise_ip)) | ||
2106 | intel_pmu_pebs_disable(event); | ||
2103 | } | 2107 | } |
2104 | 2108 | ||
2105 | static void intel_pmu_del_event(struct perf_event *event) | 2109 | static void intel_pmu_del_event(struct perf_event *event) |
diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c index fb3a2f13fc70..339d7628080c 100644 --- a/arch/x86/events/intel/pt.c +++ b/arch/x86/events/intel/pt.c | |||
@@ -1525,8 +1525,7 @@ static __init int pt_init(void) | |||
1525 | } | 1525 | } |
1526 | 1526 | ||
1527 | if (!intel_pt_validate_hw_cap(PT_CAP_topa_multiple_entries)) | 1527 | if (!intel_pt_validate_hw_cap(PT_CAP_topa_multiple_entries)) |
1528 | pt_pmu.pmu.capabilities = | 1528 | pt_pmu.pmu.capabilities = PERF_PMU_CAP_AUX_NO_SG; |
1529 | PERF_PMU_CAP_AUX_NO_SG | PERF_PMU_CAP_AUX_SW_DOUBLEBUF; | ||
1530 | 1529 | ||
1531 | pt_pmu.pmu.capabilities |= PERF_PMU_CAP_EXCLUSIVE | PERF_PMU_CAP_ITRACE; | 1530 | pt_pmu.pmu.capabilities |= PERF_PMU_CAP_EXCLUSIVE | PERF_PMU_CAP_ITRACE; |
1532 | pt_pmu.pmu.attr_groups = pt_attr_groups; | 1531 | pt_pmu.pmu.attr_groups = pt_attr_groups; |
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index e47ef764f613..1f678f023850 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -240,7 +240,6 @@ struct perf_event; | |||
240 | #define PERF_PMU_CAP_NO_INTERRUPT 0x01 | 240 | #define PERF_PMU_CAP_NO_INTERRUPT 0x01 |
241 | #define PERF_PMU_CAP_NO_NMI 0x02 | 241 | #define PERF_PMU_CAP_NO_NMI 0x02 |
242 | #define PERF_PMU_CAP_AUX_NO_SG 0x04 | 242 | #define PERF_PMU_CAP_AUX_NO_SG 0x04 |
243 | #define PERF_PMU_CAP_AUX_SW_DOUBLEBUF 0x08 | ||
244 | #define PERF_PMU_CAP_EXCLUSIVE 0x10 | 243 | #define PERF_PMU_CAP_EXCLUSIVE 0x10 |
245 | #define PERF_PMU_CAP_ITRACE 0x20 | 244 | #define PERF_PMU_CAP_ITRACE 0x20 |
246 | #define PERF_PMU_CAP_HETEROGENEOUS_CPUS 0x40 | 245 | #define PERF_PMU_CAP_HETEROGENEOUS_CPUS 0x40 |
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index 5eedb49a65ea..674b35383491 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c | |||
@@ -610,8 +610,7 @@ int rb_alloc_aux(struct ring_buffer *rb, struct perf_event *event, | |||
610 | * PMU requests more than one contiguous chunks of memory | 610 | * PMU requests more than one contiguous chunks of memory |
611 | * for SW double buffering | 611 | * for SW double buffering |
612 | */ | 612 | */ |
613 | if ((event->pmu->capabilities & PERF_PMU_CAP_AUX_SW_DOUBLEBUF) && | 613 | if (!overwrite) { |
614 | !overwrite) { | ||
615 | if (!max_order) | 614 | if (!max_order) |
616 | return -EINVAL; | 615 | return -EINVAL; |
617 | 616 | ||
diff --git a/tools/arch/arc/include/uapi/asm/unistd.h b/tools/arch/arc/include/uapi/asm/unistd.h new file mode 100644 index 000000000000..5eafa1115162 --- /dev/null +++ b/tools/arch/arc/include/uapi/asm/unistd.h | |||
@@ -0,0 +1,51 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | ||
2 | /* | ||
3 | * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | */ | ||
9 | |||
10 | /******** no-legacy-syscalls-ABI *******/ | ||
11 | |||
12 | /* | ||
13 | * Non-typical guard macro to enable inclusion twice in ARCH sys.c | ||
14 | * That is how the Generic syscall wrapper generator works | ||
15 | */ | ||
16 | #if !defined(_UAPI_ASM_ARC_UNISTD_H) || defined(__SYSCALL) | ||
17 | #define _UAPI_ASM_ARC_UNISTD_H | ||
18 | |||
19 | #define __ARCH_WANT_RENAMEAT | ||
20 | #define __ARCH_WANT_STAT64 | ||
21 | #define __ARCH_WANT_SET_GET_RLIMIT | ||
22 | #define __ARCH_WANT_SYS_EXECVE | ||
23 | #define __ARCH_WANT_SYS_CLONE | ||
24 | #define __ARCH_WANT_SYS_VFORK | ||
25 | #define __ARCH_WANT_SYS_FORK | ||
26 | #define __ARCH_WANT_TIME32_SYSCALLS | ||
27 | |||
28 | #define sys_mmap2 sys_mmap_pgoff | ||
29 | |||
30 | #include <asm-generic/unistd.h> | ||
31 | |||
32 | #define NR_syscalls __NR_syscalls | ||
33 | |||
34 | /* Generic syscall (fs/filesystems.c - lost in asm-generic/unistd.h */ | ||
35 | #define __NR_sysfs (__NR_arch_specific_syscall + 3) | ||
36 | |||
37 | /* ARC specific syscall */ | ||
38 | #define __NR_cacheflush (__NR_arch_specific_syscall + 0) | ||
39 | #define __NR_arc_settls (__NR_arch_specific_syscall + 1) | ||
40 | #define __NR_arc_gettls (__NR_arch_specific_syscall + 2) | ||
41 | #define __NR_arc_usr_cmpxchg (__NR_arch_specific_syscall + 4) | ||
42 | |||
43 | __SYSCALL(__NR_cacheflush, sys_cacheflush) | ||
44 | __SYSCALL(__NR_arc_settls, sys_arc_settls) | ||
45 | __SYSCALL(__NR_arc_gettls, sys_arc_gettls) | ||
46 | __SYSCALL(__NR_arc_usr_cmpxchg, sys_arc_usr_cmpxchg) | ||
47 | __SYSCALL(__NR_sysfs, sys_sysfs) | ||
48 | |||
49 | #undef __SYSCALL | ||
50 | |||
51 | #endif | ||
diff --git a/tools/arch/hexagon/include/uapi/asm/unistd.h b/tools/arch/hexagon/include/uapi/asm/unistd.h new file mode 100644 index 000000000000..432c4db1b623 --- /dev/null +++ b/tools/arch/hexagon/include/uapi/asm/unistd.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | ||
2 | /* | ||
3 | * Syscall support for Hexagon | ||
4 | * | ||
5 | * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 and | ||
9 | * only version 2 as published by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
19 | * 02110-1301, USA. | ||
20 | */ | ||
21 | |||
22 | /* | ||
23 | * The kernel pulls this unistd.h in three different ways: | ||
24 | * 1. the "normal" way which gets all the __NR defines | ||
25 | * 2. with __SYSCALL defined to produce function declarations | ||
26 | * 3. with __SYSCALL defined to produce syscall table initialization | ||
27 | * See also: syscalltab.c | ||
28 | */ | ||
29 | |||
30 | #define sys_mmap2 sys_mmap_pgoff | ||
31 | #define __ARCH_WANT_RENAMEAT | ||
32 | #define __ARCH_WANT_STAT64 | ||
33 | #define __ARCH_WANT_SET_GET_RLIMIT | ||
34 | #define __ARCH_WANT_SYS_EXECVE | ||
35 | #define __ARCH_WANT_SYS_CLONE | ||
36 | #define __ARCH_WANT_SYS_VFORK | ||
37 | #define __ARCH_WANT_SYS_FORK | ||
38 | #define __ARCH_WANT_TIME32_SYSCALLS | ||
39 | |||
40 | #include <asm-generic/unistd.h> | ||
diff --git a/tools/arch/riscv/include/uapi/asm/unistd.h b/tools/arch/riscv/include/uapi/asm/unistd.h new file mode 100644 index 000000000000..0e2eeeb1fd27 --- /dev/null +++ b/tools/arch/riscv/include/uapi/asm/unistd.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | ||
2 | /* | ||
3 | * Copyright (C) 2018 David Abdurachmanov <david.abdurachmanov@gmail.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #ifdef __LP64__ | ||
19 | #define __ARCH_WANT_NEW_STAT | ||
20 | #define __ARCH_WANT_SET_GET_RLIMIT | ||
21 | #endif /* __LP64__ */ | ||
22 | |||
23 | #include <asm-generic/unistd.h> | ||
24 | |||
25 | /* | ||
26 | * Allows the instruction cache to be flushed from userspace. Despite RISC-V | ||
27 | * having a direct 'fence.i' instruction available to userspace (which we | ||
28 | * can't trap!), that's not actually viable when running on Linux because the | ||
29 | * kernel might schedule a process on another hart. There is no way for | ||
30 | * userspace to handle this without invoking the kernel (as it doesn't know the | ||
31 | * thread->hart mappings), so we've defined a RISC-V specific system call to | ||
32 | * flush the instruction cache. | ||
33 | * | ||
34 | * __NR_riscv_flush_icache is defined to flush the instruction cache over an | ||
35 | * address range, with the flush applying to either all threads or just the | ||
36 | * caller. We don't currently do anything with the address range, that's just | ||
37 | * in there for forwards compatibility. | ||
38 | */ | ||
39 | #ifndef __NR_riscv_flush_icache | ||
40 | #define __NR_riscv_flush_icache (__NR_arch_specific_syscall + 15) | ||
41 | #endif | ||
42 | __SYSCALL(__NR_riscv_flush_icache, sys_riscv_flush_icache) | ||
diff --git a/tools/arch/x86/include/uapi/asm/vmx.h b/tools/arch/x86/include/uapi/asm/vmx.h index f0b0c90dd398..d213ec5c3766 100644 --- a/tools/arch/x86/include/uapi/asm/vmx.h +++ b/tools/arch/x86/include/uapi/asm/vmx.h | |||
@@ -146,6 +146,7 @@ | |||
146 | 146 | ||
147 | #define VMX_ABORT_SAVE_GUEST_MSR_FAIL 1 | 147 | #define VMX_ABORT_SAVE_GUEST_MSR_FAIL 1 |
148 | #define VMX_ABORT_LOAD_HOST_PDPTE_FAIL 2 | 148 | #define VMX_ABORT_LOAD_HOST_PDPTE_FAIL 2 |
149 | #define VMX_ABORT_VMCS_CORRUPTED 3 | ||
149 | #define VMX_ABORT_LOAD_HOST_MSR_FAIL 4 | 150 | #define VMX_ABORT_LOAD_HOST_MSR_FAIL 4 |
150 | 151 | ||
151 | #endif /* _UAPIVMX_H */ | 152 | #endif /* _UAPIVMX_H */ |
diff --git a/tools/lib/traceevent/parse-utils.c b/tools/lib/traceevent/parse-utils.c index 77e4ec6402dd..e99867111387 100644 --- a/tools/lib/traceevent/parse-utils.c +++ b/tools/lib/traceevent/parse-utils.c | |||
@@ -14,7 +14,7 @@ | |||
14 | void __vwarning(const char *fmt, va_list ap) | 14 | void __vwarning(const char *fmt, va_list ap) |
15 | { | 15 | { |
16 | if (errno) | 16 | if (errno) |
17 | perror("trace-cmd"); | 17 | perror("libtraceevent"); |
18 | errno = 0; | 18 | errno = 0; |
19 | 19 | ||
20 | fprintf(stderr, " "); | 20 | fprintf(stderr, " "); |
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index fe3f97e342fa..6d65874e16c3 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config | |||
@@ -227,7 +227,7 @@ FEATURE_CHECK_LDFLAGS-libpython-version := $(PYTHON_EMBED_LDOPTS) | |||
227 | 227 | ||
228 | FEATURE_CHECK_LDFLAGS-libaio = -lrt | 228 | FEATURE_CHECK_LDFLAGS-libaio = -lrt |
229 | 229 | ||
230 | FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes | 230 | FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl |
231 | 231 | ||
232 | CFLAGS += -fno-omit-frame-pointer | 232 | CFLAGS += -fno-omit-frame-pointer |
233 | CFLAGS += -ggdb3 | 233 | CFLAGS += -ggdb3 |
diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c index 98ad783efc69..a7784554a80d 100644 --- a/tools/perf/bench/numa.c +++ b/tools/perf/bench/numa.c | |||
@@ -39,6 +39,10 @@ | |||
39 | #include <numa.h> | 39 | #include <numa.h> |
40 | #include <numaif.h> | 40 | #include <numaif.h> |
41 | 41 | ||
42 | #ifndef RUSAGE_THREAD | ||
43 | # define RUSAGE_THREAD 1 | ||
44 | #endif | ||
45 | |||
42 | /* | 46 | /* |
43 | * Regular printout to the terminal, supressed if -q is specified: | 47 | * Regular printout to the terminal, supressed if -q is specified: |
44 | */ | 48 | */ |
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index c8b01176c9e1..09762985c713 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -1714,8 +1714,8 @@ static int symbol__disassemble_bpf(struct symbol *sym, | |||
1714 | if (dso->binary_type != DSO_BINARY_TYPE__BPF_PROG_INFO) | 1714 | if (dso->binary_type != DSO_BINARY_TYPE__BPF_PROG_INFO) |
1715 | return -1; | 1715 | return -1; |
1716 | 1716 | ||
1717 | pr_debug("%s: handling sym %s addr %lx len %lx\n", __func__, | 1717 | pr_debug("%s: handling sym %s addr %" PRIx64 " len %" PRIx64 "\n", __func__, |
1718 | sym->name, sym->start, sym->end - sym->start); | 1718 | sym->name, sym->start, sym->end - sym->start); |
1719 | 1719 | ||
1720 | memset(tpath, 0, sizeof(tpath)); | 1720 | memset(tpath, 0, sizeof(tpath)); |
1721 | perf_exe(tpath, sizeof(tpath)); | 1721 | perf_exe(tpath, sizeof(tpath)); |
@@ -1740,7 +1740,7 @@ static int symbol__disassemble_bpf(struct symbol *sym, | |||
1740 | info_linear = info_node->info_linear; | 1740 | info_linear = info_node->info_linear; |
1741 | sub_id = dso->bpf_prog.sub_id; | 1741 | sub_id = dso->bpf_prog.sub_id; |
1742 | 1742 | ||
1743 | info.buffer = (void *)(info_linear->info.jited_prog_insns); | 1743 | info.buffer = (void *)(uintptr_t)(info_linear->info.jited_prog_insns); |
1744 | info.buffer_length = info_linear->info.jited_prog_len; | 1744 | info.buffer_length = info_linear->info.jited_prog_len; |
1745 | 1745 | ||
1746 | if (info_linear->info.nr_line_info) | 1746 | if (info_linear->info.nr_line_info) |
@@ -1776,7 +1776,7 @@ static int symbol__disassemble_bpf(struct symbol *sym, | |||
1776 | const char *srcline; | 1776 | const char *srcline; |
1777 | u64 addr; | 1777 | u64 addr; |
1778 | 1778 | ||
1779 | addr = pc + ((u64 *)(info_linear->info.jited_ksyms))[sub_id]; | 1779 | addr = pc + ((u64 *)(uintptr_t)(info_linear->info.jited_ksyms))[sub_id]; |
1780 | count = disassemble(pc, &info); | 1780 | count = disassemble(pc, &info); |
1781 | 1781 | ||
1782 | if (prog_linfo) | 1782 | if (prog_linfo) |
diff --git a/tools/perf/util/cloexec.c b/tools/perf/util/cloexec.c index ca0fff6272be..06f48312c5ed 100644 --- a/tools/perf/util/cloexec.c +++ b/tools/perf/util/cloexec.c | |||
@@ -7,7 +7,6 @@ | |||
7 | #include "asm/bug.h" | 7 | #include "asm/bug.h" |
8 | #include "debug.h" | 8 | #include "debug.h" |
9 | #include <unistd.h> | 9 | #include <unistd.h> |
10 | #include <asm/unistd.h> | ||
11 | #include <sys/syscall.h> | 10 | #include <sys/syscall.h> |
12 | 11 | ||
13 | static unsigned long flag = PERF_FLAG_FD_CLOEXEC; | 12 | static unsigned long flag = PERF_FLAG_FD_CLOEXEC; |
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 110804936fc3..de488b43f440 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c | |||
@@ -422,11 +422,9 @@ static struct cs_etm_queue *cs_etm__alloc_queue(struct cs_etm_auxtrace *etm) | |||
422 | if (!etmq->packet) | 422 | if (!etmq->packet) |
423 | goto out_free; | 423 | goto out_free; |
424 | 424 | ||
425 | if (etm->synth_opts.last_branch || etm->sample_branches) { | 425 | etmq->prev_packet = zalloc(szp); |
426 | etmq->prev_packet = zalloc(szp); | 426 | if (!etmq->prev_packet) |
427 | if (!etmq->prev_packet) | 427 | goto out_free; |
428 | goto out_free; | ||
429 | } | ||
430 | 428 | ||
431 | if (etm->synth_opts.last_branch) { | 429 | if (etm->synth_opts.last_branch) { |
432 | size_t sz = sizeof(struct branch_stack); | 430 | size_t sz = sizeof(struct branch_stack); |
@@ -981,7 +979,6 @@ static int cs_etm__sample(struct cs_etm_queue *etmq) | |||
981 | * PREV_PACKET is a branch. | 979 | * PREV_PACKET is a branch. |
982 | */ | 980 | */ |
983 | if (etm->synth_opts.last_branch && | 981 | if (etm->synth_opts.last_branch && |
984 | etmq->prev_packet && | ||
985 | etmq->prev_packet->sample_type == CS_ETM_RANGE && | 982 | etmq->prev_packet->sample_type == CS_ETM_RANGE && |
986 | etmq->prev_packet->last_instr_taken_branch) | 983 | etmq->prev_packet->last_instr_taken_branch) |
987 | cs_etm__update_last_branch_rb(etmq); | 984 | cs_etm__update_last_branch_rb(etmq); |
@@ -1014,7 +1011,7 @@ static int cs_etm__sample(struct cs_etm_queue *etmq) | |||
1014 | etmq->period_instructions = instrs_over; | 1011 | etmq->period_instructions = instrs_over; |
1015 | } | 1012 | } |
1016 | 1013 | ||
1017 | if (etm->sample_branches && etmq->prev_packet) { | 1014 | if (etm->sample_branches) { |
1018 | bool generate_sample = false; | 1015 | bool generate_sample = false; |
1019 | 1016 | ||
1020 | /* Generate sample for tracing on packet */ | 1017 | /* Generate sample for tracing on packet */ |
@@ -1071,9 +1068,6 @@ static int cs_etm__flush(struct cs_etm_queue *etmq) | |||
1071 | struct cs_etm_auxtrace *etm = etmq->etm; | 1068 | struct cs_etm_auxtrace *etm = etmq->etm; |
1072 | struct cs_etm_packet *tmp; | 1069 | struct cs_etm_packet *tmp; |
1073 | 1070 | ||
1074 | if (!etmq->prev_packet) | ||
1075 | return 0; | ||
1076 | |||
1077 | /* Handle start tracing packet */ | 1071 | /* Handle start tracing packet */ |
1078 | if (etmq->prev_packet->sample_type == CS_ETM_EMPTY) | 1072 | if (etmq->prev_packet->sample_type == CS_ETM_EMPTY) |
1079 | goto swap_packet; | 1073 | goto swap_packet; |
diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c index 9494f9dc61ec..6a3eaf7d9353 100644 --- a/tools/perf/util/env.c +++ b/tools/perf/util/env.c | |||
@@ -115,8 +115,8 @@ struct btf_node *perf_env__find_btf(struct perf_env *env, __u32 btf_id) | |||
115 | } | 115 | } |
116 | node = NULL; | 116 | node = NULL; |
117 | 117 | ||
118 | up_read(&env->bpf_progs.lock); | ||
119 | out: | 118 | out: |
119 | up_read(&env->bpf_progs.lock); | ||
120 | return node; | 120 | return node; |
121 | } | 121 | } |
122 | 122 | ||
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index b17f1c9bc965..bad5f87ae001 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -1928,12 +1928,14 @@ more: | |||
1928 | 1928 | ||
1929 | size = event->header.size; | 1929 | size = event->header.size; |
1930 | 1930 | ||
1931 | skip = -EINVAL; | ||
1932 | |||
1931 | if (size < sizeof(struct perf_event_header) || | 1933 | if (size < sizeof(struct perf_event_header) || |
1932 | (skip = rd->process(session, event, file_pos)) < 0) { | 1934 | (skip = rd->process(session, event, file_pos)) < 0) { |
1933 | pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n", | 1935 | pr_err("%#" PRIx64 " [%#x]: failed to process type: %d [%s]\n", |
1934 | file_offset + head, event->header.size, | 1936 | file_offset + head, event->header.size, |
1935 | event->header.type); | 1937 | event->header.type, strerror(-skip)); |
1936 | err = -EINVAL; | 1938 | err = skip; |
1937 | goto out; | 1939 | goto out; |
1938 | } | 1940 | } |
1939 | 1941 | ||