Skip to content

Commit

Permalink
Merge tag 'perf-urgent-for-mingo-5.4-20190921' of git://git.kernel.or…
Browse files Browse the repository at this point in the history
…g/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 <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Ingo Molnar committed Sep 22, 2019
2 parents 351a1f5 + 9f014e3 commit 2b32769
Show file tree
Hide file tree
Showing 31 changed files with 122 additions and 65 deletions.
6 changes: 3 additions & 3 deletions kernel/events/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2239,7 +2239,7 @@ static void __perf_event_disable(struct perf_event *event,
*
* If event->ctx is a cloned context, callers must make sure that
* every task struct that event->ctx->task could possibly point to
* remains valid. This condition is satisifed when called through
* remains valid. This condition is satisfied when called through
* perf_event_for_each_child or perf_event_for_each because they
* hold the top-level event's child_mutex, so any descendant that
* goes to exit will block in perf_event_exit_event().
Expand Down Expand Up @@ -6054,7 +6054,7 @@ static void perf_sample_regs_intr(struct perf_regs *regs_intr,
* Get remaining task size from user stack pointer.
*
* It'd be better to take stack vma map and limit this more
* precisly, but there's no way to get it safely under interrupt,
* precisely, but there's no way to get it safely under interrupt,
* so using TASK_SIZE as limit.
*/
static u64 perf_ustack_task_size(struct pt_regs *regs)
Expand Down Expand Up @@ -6616,7 +6616,7 @@ void perf_prepare_sample(struct perf_event_header *header,

if (sample_type & PERF_SAMPLE_STACK_USER) {
/*
* Either we need PERF_SAMPLE_STACK_USER bit to be allways
* Either we need PERF_SAMPLE_STACK_USER bit to be always
* processed as the last one or have additional check added
* in case new sample type is added, because we could eat
* up the rest of the sample size.
Expand Down
3 changes: 3 additions & 0 deletions tools/arch/x86/include/asm/cpufeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@
#define X86_FEATURE_VMMCALL ( 8*32+15) /* Prefer VMMCALL to VMCALL */
#define X86_FEATURE_XENPV ( 8*32+16) /* "" Xen paravirtual guest */
#define X86_FEATURE_EPT_AD ( 8*32+17) /* Intel Extended Page Table access-dirty bit */
#define X86_FEATURE_VMCALL ( 8*32+18) /* "" Hypervisor supports the VMCALL instruction */
#define X86_FEATURE_VMW_VMMCALL ( 8*32+19) /* "" VMware prefers VMMCALL hypercall instruction */

/* Intel-defined CPU features, CPUID level 0x00000007:0 (EBX), word 9 */
#define X86_FEATURE_FSGSBASE ( 9*32+ 0) /* RDFSBASE, WRFSBASE, RDGSBASE, WRGSBASE instructions*/
Expand Down Expand Up @@ -354,6 +356,7 @@
/* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */
#define X86_FEATURE_AVX512_4VNNIW (18*32+ 2) /* AVX-512 Neural Network Instructions */
#define X86_FEATURE_AVX512_4FMAPS (18*32+ 3) /* AVX-512 Multiply Accumulation Single precision */
#define X86_FEATURE_AVX512_VP2INTERSECT (18*32+ 8) /* AVX-512 Intersect for D/Q */
#define X86_FEATURE_MD_CLEAR (18*32+10) /* VERW clears CPU buffers */
#define X86_FEATURE_TSX_FORCE_ABORT (18*32+13) /* "" TSX_FORCE_ABORT */
#define X86_FEATURE_PCONFIG (18*32+18) /* Intel PCONFIG */
Expand Down
2 changes: 1 addition & 1 deletion tools/arch/x86/include/uapi/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#define _UAPI_ASM_X86_UNISTD_H

/* x32 syscall flag bit */
#define __X32_SYSCALL_BIT 0x40000000
#define __X32_SYSCALL_BIT 0x40000000UL

#ifndef __KERNEL__
# ifdef __i386__
Expand Down
2 changes: 1 addition & 1 deletion tools/include/uapi/asm-generic/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ __SYSCALL(__NR_semget, sys_semget)
__SC_COMP(__NR_semctl, sys_semctl, compat_sys_semctl)
#if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
#define __NR_semtimedop 192
__SC_COMP(__NR_semtimedop, sys_semtimedop, sys_semtimedop_time32)
__SC_3264(__NR_semtimedop, sys_semtimedop_time32, sys_semtimedop)
#endif
#define __NR_semop 193
__SYSCALL(__NR_semop, sys_semop)
Expand Down
7 changes: 6 additions & 1 deletion tools/include/uapi/linux/prctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ struct prctl_mm_map {
#define PR_GET_THP_DISABLE 42

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

/* Tagged user address controls for arm64 */
#define PR_SET_TAGGED_ADDR_CTRL 55
#define PR_GET_TAGGED_ADDR_CTRL 56
# define PR_TAGGED_ADDR_ENABLE (1UL << 0)

#endif /* _LINUX_PRCTL_H */
5 changes: 3 additions & 2 deletions tools/perf/builtin-annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <dlfcn.h>
#include <errno.h>
#include <linux/bitmap.h>
#include <linux/err.h>

struct perf_annotate {
struct perf_tool tool;
Expand Down Expand Up @@ -584,8 +585,8 @@ int cmd_annotate(int argc, const char **argv)
data.path = input_name;

annotate.session = perf_session__new(&data, false, &annotate.tool);
if (annotate.session == NULL)
return -1;
if (IS_ERR(annotate.session))
return PTR_ERR(annotate.session);

annotate.has_br_stack = perf_header__has_feat(&annotate.session->header,
HEADER_BRANCH_STACK);
Expand Down
5 changes: 3 additions & 2 deletions tools/perf/builtin-buildid-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "util/util.h"
#include "util/probe-file.h"
#include <linux/string.h>
#include <linux/err.h>

static int build_id_cache__kcore_buildid(const char *proc_dir, char *sbuildid)
{
Expand Down Expand Up @@ -422,8 +423,8 @@ int cmd_buildid_cache(int argc, const char **argv)
data.force = force;

session = perf_session__new(&data, false, NULL);
if (session == NULL)
return -1;
if (IS_ERR(session))
return PTR_ERR(session);
}

if (symbol__init(session ? &session->header.env : NULL) < 0)
Expand Down
5 changes: 3 additions & 2 deletions tools/perf/builtin-buildid-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "util/symbol.h"
#include "util/data.h"
#include <errno.h>
#include <linux/err.h>

static int sysfs__fprintf_build_id(FILE *fp)
{
Expand Down Expand Up @@ -65,8 +66,8 @@ static int perf_session__list_build_ids(bool force, bool with_hits)
goto out;

session = perf_session__new(&data, false, &build_id__mark_dso_hit_ops);
if (session == NULL)
return -1;
if (IS_ERR(session))
return PTR_ERR(session);

/*
* We take all buildids when the file contains AUX area tracing data
Expand Down
6 changes: 4 additions & 2 deletions tools/perf/builtin-c2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <errno.h>
#include <inttypes.h>
#include <linux/compiler.h>
#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/stringify.h>
#include <linux/zalloc.h>
Expand Down Expand Up @@ -2781,8 +2782,9 @@ static int perf_c2c__report(int argc, const char **argv)
}

session = perf_session__new(&data, 0, &c2c.tool);
if (session == NULL) {
pr_debug("No memory for session\n");
if (IS_ERR(session)) {
err = PTR_ERR(session);
pr_debug("Error creating perf session\n");
goto out;
}

Expand Down
9 changes: 5 additions & 4 deletions tools/perf/builtin-diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "util/time-utils.h"
#include "util/annotate.h"
#include "util/map.h"
#include <linux/err.h>
#include <linux/zalloc.h>
#include <subcmd/pager.h>
#include <subcmd/parse-options.h>
Expand Down Expand Up @@ -1153,9 +1154,9 @@ static int check_file_brstack(void)

data__for_each_file(i, d) {
d->session = perf_session__new(&d->data, false, &pdiff.tool);
if (!d->session) {
if (IS_ERR(d->session)) {
pr_err("Failed to open %s\n", d->data.path);
return -1;
return PTR_ERR(d->session);
}

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

data__for_each_file(i, d) {
d->session = perf_session__new(&d->data, false, &pdiff.tool);
if (!d->session) {
if (IS_ERR(d->session)) {
ret = PTR_ERR(d->session);
pr_err("Failed to open %s\n", d->data.path);
ret = -1;
goto out_delete;
}

Expand Down
5 changes: 3 additions & 2 deletions tools/perf/builtin-evlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "util/session.h"
#include "util/data.h"
#include "util/debug.h"
#include <linux/err.h>

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

session = perf_session__new(&data, 0, NULL);
if (session == NULL)
return -1;
if (IS_ERR(session))
return PTR_ERR(session);

evlist__for_each_entry(session->evlist, pos) {
perf_evsel__fprintf(pos, details, stdout);
Expand Down
5 changes: 3 additions & 2 deletions tools/perf/builtin-inject.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "util/symbol.h"
#include "util/synthetic-events.h"
#include "util/thread.h"
#include <linux/err.h>

#include <subcmd/parse-options.h>

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

data.path = inject.input_name;
inject.session = perf_session__new(&data, true, &inject.tool);
if (inject.session == NULL)
return -1;
if (IS_ERR(inject.session))
return PTR_ERR(inject.session);

if (zstd_init(&(inject.session->zstd_data), 0) < 0)
pr_warning("Decompression initialization failed.\n");
Expand Down
5 changes: 3 additions & 2 deletions tools/perf/builtin-kmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "util/tool.h"
#include "util/callchain.h"
#include "util/time-utils.h"
#include <linux/err.h>

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

kmem_session = session = perf_session__new(&data, false, &perf_kmem);
if (session == NULL)
return -1;
if (IS_ERR(session))
return PTR_ERR(session);

ret = -1;

Expand Down
9 changes: 5 additions & 4 deletions tools/perf/builtin-kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <sys/stat.h>
#include <fcntl.h>

#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/time64.h>
Expand Down Expand Up @@ -1091,9 +1092,9 @@ static int read_events(struct perf_kvm_stat *kvm)

kvm->tool = eops;
kvm->session = perf_session__new(&file, false, &kvm->tool);
if (!kvm->session) {
if (IS_ERR(kvm->session)) {
pr_err("Initializing perf session failed\n");
return -1;
return PTR_ERR(kvm->session);
}

symbol__init(&kvm->session->header.env);
Expand Down Expand Up @@ -1446,8 +1447,8 @@ static int kvm_events_live(struct perf_kvm_stat *kvm,
* perf session
*/
kvm->session = perf_session__new(&data, false, &kvm->tool);
if (kvm->session == NULL) {
err = -1;
if (IS_ERR(kvm->session)) {
err = PTR_ERR(kvm->session);
goto out;
}
kvm->session->evlist = kvm->evlist;
Expand Down
5 changes: 3 additions & 2 deletions tools/perf/builtin-lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <linux/hash.h>
#include <linux/kernel.h>
#include <linux/zalloc.h>
#include <linux/err.h>

static struct perf_session *session;

Expand Down Expand Up @@ -872,9 +873,9 @@ static int __cmd_report(bool display_info)
};

session = perf_session__new(&data, false, &eops);
if (!session) {
if (IS_ERR(session)) {
pr_err("Initializing perf session failed\n");
return -1;
return PTR_ERR(session);
}

symbol__init(&session->header.env);
Expand Down
5 changes: 3 additions & 2 deletions tools/perf/builtin-mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "util/dso.h"
#include "util/map.h"
#include "util/symbol.h"
#include <linux/err.h>

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

if (session == NULL)
return -1;
if (IS_ERR(session))
return PTR_ERR(session);

if (mem->cpu_list) {
ret = perf_session__cpu_bitmap(session, mem->cpu_list,
Expand Down
5 changes: 3 additions & 2 deletions tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#include <signal.h>
#include <sys/mman.h>
#include <sys/wait.h>
#include <linux/err.h>
#include <linux/string.h>
#include <linux/time64.h>
#include <linux/zalloc.h>
Expand Down Expand Up @@ -1354,9 +1355,9 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
}

session = perf_session__new(data, false, tool);
if (session == NULL) {
if (IS_ERR(session)) {
pr_err("Perf session creation failed.\n");
return -1;
return PTR_ERR(session);
}

fd = perf_data__fd(data);
Expand Down
4 changes: 2 additions & 2 deletions tools/perf/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -1269,8 +1269,8 @@ int cmd_report(int argc, const char **argv)

repeat:
session = perf_session__new(&data, false, &report.tool);
if (session == NULL)
return -1;
if (IS_ERR(session))
return PTR_ERR(session);

ret = evswitch__init(&report.evswitch, session->evlist, stderr);
if (ret)
Expand Down
11 changes: 6 additions & 5 deletions tools/perf/builtin-sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <api/fs/fs.h>
#include <perf/cpumap.h>
#include <linux/time64.h>
#include <linux/err.h>

#include <linux/ctype.h>

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

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

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

session = perf_session__new(&data, false, &sched->tool);
if (session == NULL)
return -ENOMEM;
if (IS_ERR(session))
return PTR_ERR(session);

evlist = session->evlist;

Expand Down
Loading

0 comments on commit 2b32769

Please sign in to comment.