diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-03-01 14:56:13 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-03-01 14:56:13 -0500 |
commit | d7b48fec3520da075a4093d3aa37ce4daff7510b (patch) | |
tree | e67cf00d4c3712e41b2e97e45507de0467b5c44d /tools | |
parent | 2ea51b884b07ac7fbb49eb91860eb05c13161ad2 (diff) | |
parent | 021f5f12f2ab44874193c68fb19eea154493f83a (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:
"Two kprobes fixes and a handful of tooling fixes"
* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
perf tools: Make sparc64 arch point to sparc
perf symbols: Define EM_AARCH64 for older OSes
perf top: Fix SIGBUS on sparc64
perf tools: Fix probing for PERF_FLAG_FD_CLOEXEC flag
perf tools: Fix pthread_attr_setaffinity_np build error
perf tools: Define _GNU_SOURCE on pthread_attr_setaffinity_np feature check
perf bench: Fix order of arguments to memcpy_alloc_mem
kprobes/x86: Check for invalid ftrace location in __recover_probed_insn()
kprobes/x86: Use 5-byte NOP when the code might be modified by ftrace
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/bench/mem-memcpy.c | 4 | ||||
-rw-r--r-- | tools/perf/config/Makefile.arch | 4 | ||||
-rw-r--r-- | tools/perf/config/feature-checks/Makefile | 2 | ||||
-rw-r--r-- | tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c | 3 | ||||
-rw-r--r-- | tools/perf/util/cloexec.c | 18 | ||||
-rw-r--r-- | tools/perf/util/evlist.h | 2 | ||||
-rw-r--r-- | tools/perf/util/symbol-elf.c | 5 |
7 files changed, 30 insertions, 8 deletions
diff --git a/tools/perf/bench/mem-memcpy.c b/tools/perf/bench/mem-memcpy.c index 6c14afe8c1b1..db1d3a29d97f 100644 --- a/tools/perf/bench/mem-memcpy.c +++ b/tools/perf/bench/mem-memcpy.c | |||
@@ -289,7 +289,7 @@ static u64 do_memcpy_cycle(const struct routine *r, size_t len, bool prefault) | |||
289 | memcpy_t fn = r->fn.memcpy; | 289 | memcpy_t fn = r->fn.memcpy; |
290 | int i; | 290 | int i; |
291 | 291 | ||
292 | memcpy_alloc_mem(&src, &dst, len); | 292 | memcpy_alloc_mem(&dst, &src, len); |
293 | 293 | ||
294 | if (prefault) | 294 | if (prefault) |
295 | fn(dst, src, len); | 295 | fn(dst, src, len); |
@@ -312,7 +312,7 @@ static double do_memcpy_gettimeofday(const struct routine *r, size_t len, | |||
312 | void *src = NULL, *dst = NULL; | 312 | void *src = NULL, *dst = NULL; |
313 | int i; | 313 | int i; |
314 | 314 | ||
315 | memcpy_alloc_mem(&src, &dst, len); | 315 | memcpy_alloc_mem(&dst, &src, len); |
316 | 316 | ||
317 | if (prefault) | 317 | if (prefault) |
318 | fn(dst, src, len); | 318 | fn(dst, src, len); |
diff --git a/tools/perf/config/Makefile.arch b/tools/perf/config/Makefile.arch index ff95a68741d1..ac8721ffa6c8 100644 --- a/tools/perf/config/Makefile.arch +++ b/tools/perf/config/Makefile.arch | |||
@@ -21,6 +21,10 @@ ifeq ($(RAW_ARCH),x86_64) | |||
21 | endif | 21 | endif |
22 | endif | 22 | endif |
23 | 23 | ||
24 | ifeq ($(RAW_ARCH),sparc64) | ||
25 | ARCH ?= sparc | ||
26 | endif | ||
27 | |||
24 | ARCH ?= $(RAW_ARCH) | 28 | ARCH ?= $(RAW_ARCH) |
25 | 29 | ||
26 | LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1) | 30 | LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1) |
diff --git a/tools/perf/config/feature-checks/Makefile b/tools/perf/config/feature-checks/Makefile index 42ac05aaf8ac..b32ff3372514 100644 --- a/tools/perf/config/feature-checks/Makefile +++ b/tools/perf/config/feature-checks/Makefile | |||
@@ -49,7 +49,7 @@ test-hello.bin: | |||
49 | $(BUILD) | 49 | $(BUILD) |
50 | 50 | ||
51 | test-pthread-attr-setaffinity-np.bin: | 51 | test-pthread-attr-setaffinity-np.bin: |
52 | $(BUILD) -Werror -lpthread | 52 | $(BUILD) -D_GNU_SOURCE -Werror -lpthread |
53 | 53 | ||
54 | test-stackprotector-all.bin: | 54 | test-stackprotector-all.bin: |
55 | $(BUILD) -Werror -fstack-protector-all | 55 | $(BUILD) -Werror -fstack-protector-all |
diff --git a/tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c b/tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c index 0a0d3ecb4e8a..2b81b72eca23 100644 --- a/tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c +++ b/tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c | |||
@@ -5,10 +5,11 @@ int main(void) | |||
5 | { | 5 | { |
6 | int ret = 0; | 6 | int ret = 0; |
7 | pthread_attr_t thread_attr; | 7 | pthread_attr_t thread_attr; |
8 | cpu_set_t cs; | ||
8 | 9 | ||
9 | pthread_attr_init(&thread_attr); | 10 | pthread_attr_init(&thread_attr); |
10 | /* don't care abt exact args, just the API itself in libpthread */ | 11 | /* don't care abt exact args, just the API itself in libpthread */ |
11 | ret = pthread_attr_setaffinity_np(&thread_attr, 0, NULL); | 12 | ret = pthread_attr_setaffinity_np(&thread_attr, sizeof(cs), &cs); |
12 | 13 | ||
13 | return ret; | 14 | return ret; |
14 | } | 15 | } |
diff --git a/tools/perf/util/cloexec.c b/tools/perf/util/cloexec.c index 47b78b3f0325..6da965bdbc2c 100644 --- a/tools/perf/util/cloexec.c +++ b/tools/perf/util/cloexec.c | |||
@@ -25,6 +25,10 @@ static int perf_flag_probe(void) | |||
25 | if (cpu < 0) | 25 | if (cpu < 0) |
26 | cpu = 0; | 26 | cpu = 0; |
27 | 27 | ||
28 | /* | ||
29 | * Using -1 for the pid is a workaround to avoid gratuitous jump label | ||
30 | * changes. | ||
31 | */ | ||
28 | while (1) { | 32 | while (1) { |
29 | /* check cloexec flag */ | 33 | /* check cloexec flag */ |
30 | fd = sys_perf_event_open(&attr, pid, cpu, -1, | 34 | fd = sys_perf_event_open(&attr, pid, cpu, -1, |
@@ -47,16 +51,24 @@ static int perf_flag_probe(void) | |||
47 | err, strerror_r(err, sbuf, sizeof(sbuf))); | 51 | err, strerror_r(err, sbuf, sizeof(sbuf))); |
48 | 52 | ||
49 | /* not supported, confirm error related to PERF_FLAG_FD_CLOEXEC */ | 53 | /* not supported, confirm error related to PERF_FLAG_FD_CLOEXEC */ |
50 | fd = sys_perf_event_open(&attr, pid, cpu, -1, 0); | 54 | while (1) { |
55 | fd = sys_perf_event_open(&attr, pid, cpu, -1, 0); | ||
56 | if (fd < 0 && pid == -1 && errno == EACCES) { | ||
57 | pid = 0; | ||
58 | continue; | ||
59 | } | ||
60 | break; | ||
61 | } | ||
51 | err = errno; | 62 | err = errno; |
52 | 63 | ||
64 | if (fd >= 0) | ||
65 | close(fd); | ||
66 | |||
53 | if (WARN_ONCE(fd < 0 && err != EBUSY, | 67 | if (WARN_ONCE(fd < 0 && err != EBUSY, |
54 | "perf_event_open(..., 0) failed unexpectedly with error %d (%s)\n", | 68 | "perf_event_open(..., 0) failed unexpectedly with error %d (%s)\n", |
55 | err, strerror_r(err, sbuf, sizeof(sbuf)))) | 69 | err, strerror_r(err, sbuf, sizeof(sbuf)))) |
56 | return -1; | 70 | return -1; |
57 | 71 | ||
58 | close(fd); | ||
59 | |||
60 | return 0; | 72 | return 0; |
61 | } | 73 | } |
62 | 74 | ||
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index c94a9e03ecf1..e99a67632831 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h | |||
@@ -28,7 +28,7 @@ struct perf_mmap { | |||
28 | int mask; | 28 | int mask; |
29 | int refcnt; | 29 | int refcnt; |
30 | unsigned int prev; | 30 | unsigned int prev; |
31 | char event_copy[PERF_SAMPLE_MAX_SIZE]; | 31 | char event_copy[PERF_SAMPLE_MAX_SIZE] __attribute__((aligned(8))); |
32 | }; | 32 | }; |
33 | 33 | ||
34 | struct perf_evlist { | 34 | struct perf_evlist { |
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index b24f9d8727a8..33b7a2aef713 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c | |||
@@ -11,6 +11,11 @@ | |||
11 | #include <symbol/kallsyms.h> | 11 | #include <symbol/kallsyms.h> |
12 | #include "debug.h" | 12 | #include "debug.h" |
13 | 13 | ||
14 | #ifndef EM_AARCH64 | ||
15 | #define EM_AARCH64 183 /* ARM 64 bit */ | ||
16 | #endif | ||
17 | |||
18 | |||
14 | #ifdef HAVE_CPLUS_DEMANGLE_SUPPORT | 19 | #ifdef HAVE_CPLUS_DEMANGLE_SUPPORT |
15 | extern char *cplus_demangle(const char *, int); | 20 | extern char *cplus_demangle(const char *, int); |
16 | 21 | ||