Skip to content

Commit 2b32769

Browse files
author
Ingo Molnar
committed
Merge tag 'perf-urgent-for-mingo-5.4-20190921' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
Pull perf/urgent fixes from Arnaldo Carvalho de Melo: perf tests: Jiri Olsa: - Fix 'make -C tools/perf build-test' static build entry. perf record: Jiri Olsa: - Fix segfault in cpu_cache_level__read() when reading CPU topology. session: Mamatha Inamdar: - Properly propagate error when reading a perf.data file, it may not exist or the user may not have permissions, etc. perf probe: Masami Hiramatsu: - Skip same probe address for a given line. - Clear tev->nargs in clear_probe_trace_event(), fixing segfault. tools headers UAPI: Arnaldo Carvalho de Melo: - Sync headers, among them prctl.h, that introduces two new options that are now supported in the 'perf trace' prctl syscall args beautifiers. Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
2 parents 351a1f5 + 9f014e3 commit 2b32769

31 files changed

+122
-65
lines changed

kernel/events/core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2239,7 +2239,7 @@ static void __perf_event_disable(struct perf_event *event,
22392239
*
22402240
* If event->ctx is a cloned context, callers must make sure that
22412241
* every task struct that event->ctx->task could possibly point to
2242-
* remains valid. This condition is satisifed when called through
2242+
* remains valid. This condition is satisfied when called through
22432243
* perf_event_for_each_child or perf_event_for_each because they
22442244
* hold the top-level event's child_mutex, so any descendant that
22452245
* goes to exit will block in perf_event_exit_event().
@@ -6054,7 +6054,7 @@ static void perf_sample_regs_intr(struct perf_regs *regs_intr,
60546054
* Get remaining task size from user stack pointer.
60556055
*
60566056
* It'd be better to take stack vma map and limit this more
6057-
* precisly, but there's no way to get it safely under interrupt,
6057+
* precisely, but there's no way to get it safely under interrupt,
60586058
* so using TASK_SIZE as limit.
60596059
*/
60606060
static u64 perf_ustack_task_size(struct pt_regs *regs)
@@ -6616,7 +6616,7 @@ void perf_prepare_sample(struct perf_event_header *header,
66166616

66176617
if (sample_type & PERF_SAMPLE_STACK_USER) {
66186618
/*
6619-
* Either we need PERF_SAMPLE_STACK_USER bit to be allways
6619+
* Either we need PERF_SAMPLE_STACK_USER bit to be always
66206620
* processed as the last one or have additional check added
66216621
* in case new sample type is added, because we could eat
66226622
* up the rest of the sample size.

tools/arch/x86/include/asm/cpufeatures.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@
231231
#define X86_FEATURE_VMMCALL ( 8*32+15) /* Prefer VMMCALL to VMCALL */
232232
#define X86_FEATURE_XENPV ( 8*32+16) /* "" Xen paravirtual guest */
233233
#define X86_FEATURE_EPT_AD ( 8*32+17) /* Intel Extended Page Table access-dirty bit */
234+
#define X86_FEATURE_VMCALL ( 8*32+18) /* "" Hypervisor supports the VMCALL instruction */
235+
#define X86_FEATURE_VMW_VMMCALL ( 8*32+19) /* "" VMware prefers VMMCALL hypercall instruction */
234236

235237
/* Intel-defined CPU features, CPUID level 0x00000007:0 (EBX), word 9 */
236238
#define X86_FEATURE_FSGSBASE ( 9*32+ 0) /* RDFSBASE, WRFSBASE, RDGSBASE, WRGSBASE instructions*/
@@ -354,6 +356,7 @@
354356
/* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */
355357
#define X86_FEATURE_AVX512_4VNNIW (18*32+ 2) /* AVX-512 Neural Network Instructions */
356358
#define X86_FEATURE_AVX512_4FMAPS (18*32+ 3) /* AVX-512 Multiply Accumulation Single precision */
359+
#define X86_FEATURE_AVX512_VP2INTERSECT (18*32+ 8) /* AVX-512 Intersect for D/Q */
357360
#define X86_FEATURE_MD_CLEAR (18*32+10) /* VERW clears CPU buffers */
358361
#define X86_FEATURE_TSX_FORCE_ABORT (18*32+13) /* "" TSX_FORCE_ABORT */
359362
#define X86_FEATURE_PCONFIG (18*32+18) /* Intel PCONFIG */

tools/arch/x86/include/uapi/asm/unistd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#define _UAPI_ASM_X86_UNISTD_H
44

55
/* x32 syscall flag bit */
6-
#define __X32_SYSCALL_BIT 0x40000000
6+
#define __X32_SYSCALL_BIT 0x40000000UL
77

88
#ifndef __KERNEL__
99
# ifdef __i386__

tools/include/uapi/asm-generic/unistd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ __SYSCALL(__NR_semget, sys_semget)
569569
__SC_COMP(__NR_semctl, sys_semctl, compat_sys_semctl)
570570
#if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
571571
#define __NR_semtimedop 192
572-
__SC_COMP(__NR_semtimedop, sys_semtimedop, sys_semtimedop_time32)
572+
__SC_3264(__NR_semtimedop, sys_semtimedop_time32, sys_semtimedop)
573573
#endif
574574
#define __NR_semop 193
575575
__SYSCALL(__NR_semop, sys_semop)

tools/include/uapi/linux/prctl.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ struct prctl_mm_map {
181181
#define PR_GET_THP_DISABLE 42
182182

183183
/*
184-
* Tell the kernel to start/stop helping userspace manage bounds tables.
184+
* No longer implemented, but left here to ensure the numbers stay reserved:
185185
*/
186186
#define PR_MPX_ENABLE_MANAGEMENT 43
187187
#define PR_MPX_DISABLE_MANAGEMENT 44
@@ -229,4 +229,9 @@ struct prctl_mm_map {
229229
# define PR_PAC_APDBKEY (1UL << 3)
230230
# define PR_PAC_APGAKEY (1UL << 4)
231231

232+
/* Tagged user address controls for arm64 */
233+
#define PR_SET_TAGGED_ADDR_CTRL 55
234+
#define PR_GET_TAGGED_ADDR_CTRL 56
235+
# define PR_TAGGED_ADDR_ENABLE (1UL << 0)
236+
232237
#endif /* _LINUX_PRCTL_H */

tools/perf/builtin-annotate.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <dlfcn.h>
4141
#include <errno.h>
4242
#include <linux/bitmap.h>
43+
#include <linux/err.h>
4344

4445
struct perf_annotate {
4546
struct perf_tool tool;
@@ -584,8 +585,8 @@ int cmd_annotate(int argc, const char **argv)
584585
data.path = input_name;
585586

586587
annotate.session = perf_session__new(&data, false, &annotate.tool);
587-
if (annotate.session == NULL)
588-
return -1;
588+
if (IS_ERR(annotate.session))
589+
return PTR_ERR(annotate.session);
589590

590591
annotate.has_br_stack = perf_header__has_feat(&annotate.session->header,
591592
HEADER_BRANCH_STACK);

tools/perf/builtin-buildid-cache.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "util/util.h"
2929
#include "util/probe-file.h"
3030
#include <linux/string.h>
31+
#include <linux/err.h>
3132

3233
static int build_id_cache__kcore_buildid(const char *proc_dir, char *sbuildid)
3334
{
@@ -422,8 +423,8 @@ int cmd_buildid_cache(int argc, const char **argv)
422423
data.force = force;
423424

424425
session = perf_session__new(&data, false, NULL);
425-
if (session == NULL)
426-
return -1;
426+
if (IS_ERR(session))
427+
return PTR_ERR(session);
427428
}
428429

429430
if (symbol__init(session ? &session->header.env : NULL) < 0)

tools/perf/builtin-buildid-list.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "util/symbol.h"
1919
#include "util/data.h"
2020
#include <errno.h>
21+
#include <linux/err.h>
2122

2223
static int sysfs__fprintf_build_id(FILE *fp)
2324
{
@@ -65,8 +66,8 @@ static int perf_session__list_build_ids(bool force, bool with_hits)
6566
goto out;
6667

6768
session = perf_session__new(&data, false, &build_id__mark_dso_hit_ops);
68-
if (session == NULL)
69-
return -1;
69+
if (IS_ERR(session))
70+
return PTR_ERR(session);
7071

7172
/*
7273
* We take all buildids when the file contains AUX area tracing data

tools/perf/builtin-c2c.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <errno.h>
1414
#include <inttypes.h>
1515
#include <linux/compiler.h>
16+
#include <linux/err.h>
1617
#include <linux/kernel.h>
1718
#include <linux/stringify.h>
1819
#include <linux/zalloc.h>
@@ -2781,8 +2782,9 @@ static int perf_c2c__report(int argc, const char **argv)
27812782
}
27822783

27832784
session = perf_session__new(&data, 0, &c2c.tool);
2784-
if (session == NULL) {
2785-
pr_debug("No memory for session\n");
2785+
if (IS_ERR(session)) {
2786+
err = PTR_ERR(session);
2787+
pr_debug("Error creating perf session\n");
27862788
goto out;
27872789
}
27882790

tools/perf/builtin-diff.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "util/time-utils.h"
2424
#include "util/annotate.h"
2525
#include "util/map.h"
26+
#include <linux/err.h>
2627
#include <linux/zalloc.h>
2728
#include <subcmd/pager.h>
2829
#include <subcmd/parse-options.h>
@@ -1153,9 +1154,9 @@ static int check_file_brstack(void)
11531154

11541155
data__for_each_file(i, d) {
11551156
d->session = perf_session__new(&d->data, false, &pdiff.tool);
1156-
if (!d->session) {
1157+
if (IS_ERR(d->session)) {
11571158
pr_err("Failed to open %s\n", d->data.path);
1158-
return -1;
1159+
return PTR_ERR(d->session);
11591160
}
11601161

11611162
has_br_stack = perf_header__has_feat(&d->session->header,
@@ -1185,9 +1186,9 @@ static int __cmd_diff(void)
11851186

11861187
data__for_each_file(i, d) {
11871188
d->session = perf_session__new(&d->data, false, &pdiff.tool);
1188-
if (!d->session) {
1189+
if (IS_ERR(d->session)) {
1190+
ret = PTR_ERR(d->session);
11891191
pr_err("Failed to open %s\n", d->data.path);
1190-
ret = -1;
11911192
goto out_delete;
11921193
}
11931194

tools/perf/builtin-evlist.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "util/session.h"
1616
#include "util/data.h"
1717
#include "util/debug.h"
18+
#include <linux/err.h>
1819

1920
static int __cmd_evlist(const char *file_name, struct perf_attr_details *details)
2021
{
@@ -28,8 +29,8 @@ static int __cmd_evlist(const char *file_name, struct perf_attr_details *details
2829
bool has_tracepoint = false;
2930

3031
session = perf_session__new(&data, 0, NULL);
31-
if (session == NULL)
32-
return -1;
32+
if (IS_ERR(session))
33+
return PTR_ERR(session);
3334

3435
evlist__for_each_entry(session->evlist, pos) {
3536
perf_evsel__fprintf(pos, details, stdout);

tools/perf/builtin-inject.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "util/symbol.h"
2424
#include "util/synthetic-events.h"
2525
#include "util/thread.h"
26+
#include <linux/err.h>
2627

2728
#include <subcmd/parse-options.h>
2829

@@ -835,8 +836,8 @@ int cmd_inject(int argc, const char **argv)
835836

836837
data.path = inject.input_name;
837838
inject.session = perf_session__new(&data, true, &inject.tool);
838-
if (inject.session == NULL)
839-
return -1;
839+
if (IS_ERR(inject.session))
840+
return PTR_ERR(inject.session);
840841

841842
if (zstd_init(&(inject.session->zstd_data), 0) < 0)
842843
pr_warning("Decompression initialization failed.\n");

tools/perf/builtin-kmem.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "util/tool.h"
1515
#include "util/callchain.h"
1616
#include "util/time-utils.h"
17+
#include <linux/err.h>
1718

1819
#include <subcmd/pager.h>
1920
#include <subcmd/parse-options.h>
@@ -1956,8 +1957,8 @@ int cmd_kmem(int argc, const char **argv)
19561957
data.path = input_name;
19571958

19581959
kmem_session = session = perf_session__new(&data, false, &perf_kmem);
1959-
if (session == NULL)
1960-
return -1;
1960+
if (IS_ERR(session))
1961+
return PTR_ERR(session);
19611962

19621963
ret = -1;
19631964

tools/perf/builtin-kvm.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <sys/stat.h>
3434
#include <fcntl.h>
3535

36+
#include <linux/err.h>
3637
#include <linux/kernel.h>
3738
#include <linux/string.h>
3839
#include <linux/time64.h>
@@ -1091,9 +1092,9 @@ static int read_events(struct perf_kvm_stat *kvm)
10911092

10921093
kvm->tool = eops;
10931094
kvm->session = perf_session__new(&file, false, &kvm->tool);
1094-
if (!kvm->session) {
1095+
if (IS_ERR(kvm->session)) {
10951096
pr_err("Initializing perf session failed\n");
1096-
return -1;
1097+
return PTR_ERR(kvm->session);
10971098
}
10981099

10991100
symbol__init(&kvm->session->header.env);
@@ -1446,8 +1447,8 @@ static int kvm_events_live(struct perf_kvm_stat *kvm,
14461447
* perf session
14471448
*/
14481449
kvm->session = perf_session__new(&data, false, &kvm->tool);
1449-
if (kvm->session == NULL) {
1450-
err = -1;
1450+
if (IS_ERR(kvm->session)) {
1451+
err = PTR_ERR(kvm->session);
14511452
goto out;
14521453
}
14531454
kvm->session->evlist = kvm->evlist;

tools/perf/builtin-lock.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <linux/hash.h>
3131
#include <linux/kernel.h>
3232
#include <linux/zalloc.h>
33+
#include <linux/err.h>
3334

3435
static struct perf_session *session;
3536

@@ -872,9 +873,9 @@ static int __cmd_report(bool display_info)
872873
};
873874

874875
session = perf_session__new(&data, false, &eops);
875-
if (!session) {
876+
if (IS_ERR(session)) {
876877
pr_err("Initializing perf session failed\n");
877-
return -1;
878+
return PTR_ERR(session);
878879
}
879880

880881
symbol__init(&session->header.env);

tools/perf/builtin-mem.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "util/dso.h"
1818
#include "util/map.h"
1919
#include "util/symbol.h"
20+
#include <linux/err.h>
2021

2122
#define MEM_OPERATION_LOAD 0x1
2223
#define MEM_OPERATION_STORE 0x2
@@ -249,8 +250,8 @@ static int report_raw_events(struct perf_mem *mem)
249250
struct perf_session *session = perf_session__new(&data, false,
250251
&mem->tool);
251252

252-
if (session == NULL)
253-
return -1;
253+
if (IS_ERR(session))
254+
return PTR_ERR(session);
254255

255256
if (mem->cpu_list) {
256257
ret = perf_session__cpu_bitmap(session, mem->cpu_list,

tools/perf/builtin-record.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#include <signal.h>
5555
#include <sys/mman.h>
5656
#include <sys/wait.h>
57+
#include <linux/err.h>
5758
#include <linux/string.h>
5859
#include <linux/time64.h>
5960
#include <linux/zalloc.h>
@@ -1354,9 +1355,9 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
13541355
}
13551356

13561357
session = perf_session__new(data, false, tool);
1357-
if (session == NULL) {
1358+
if (IS_ERR(session)) {
13581359
pr_err("Perf session creation failed.\n");
1359-
return -1;
1360+
return PTR_ERR(session);
13601361
}
13611362

13621363
fd = perf_data__fd(data);

tools/perf/builtin-report.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,8 +1269,8 @@ int cmd_report(int argc, const char **argv)
12691269

12701270
repeat:
12711271
session = perf_session__new(&data, false, &report.tool);
1272-
if (session == NULL)
1273-
return -1;
1272+
if (IS_ERR(session))
1273+
return PTR_ERR(session);
12741274

12751275
ret = evswitch__init(&report.evswitch, session->evlist, stderr);
12761276
if (ret)

tools/perf/builtin-sched.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <api/fs/fs.h>
4141
#include <perf/cpumap.h>
4242
#include <linux/time64.h>
43+
#include <linux/err.h>
4344

4445
#include <linux/ctype.h>
4546

@@ -1797,9 +1798,9 @@ static int perf_sched__read_events(struct perf_sched *sched)
17971798
int rc = -1;
17981799

17991800
session = perf_session__new(&data, false, &sched->tool);
1800-
if (session == NULL) {
1801-
pr_debug("No Memory for session\n");
1802-
return -1;
1801+
if (IS_ERR(session)) {
1802+
pr_debug("Error creating perf session");
1803+
return PTR_ERR(session);
18031804
}
18041805

18051806
symbol__init(&session->header.env);
@@ -2989,8 +2990,8 @@ static int perf_sched__timehist(struct perf_sched *sched)
29892990
symbol_conf.use_callchain = sched->show_callchain;
29902991

29912992
session = perf_session__new(&data, false, &sched->tool);
2992-
if (session == NULL)
2993-
return -ENOMEM;
2993+
if (IS_ERR(session))
2994+
return PTR_ERR(session);
29942995

29952996
evlist = session->evlist;
29962997

0 commit comments

Comments
 (0)