perf/urgent fixes
Arnaldo Carvalho de Melo
maintainerHi Ingo,
Please consider pulling,
- Arnaldo
The following changes since commit 2a6730c8b6e075adf826a89a3e2caa705807afdb:
kprobes/x86: Check for invalid ftrace location in __recover_probed_insn() (2015-02-21 10:33:31 +0100)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo
for you to fetch changes up to 4861f87cd3d133f03e3b39b6650f4e12f1a9e421:
perf tools: Make sparc64 arch point to sparc (2015-02-25 17:39:17 -0300)
----------------------------------------------------------------
perf/urgent fixes:
Infrastructure:
- pthread_attr_setaffinity_np feature detection build fixes (Adrian Hunter, Josh Boyer)
- Fix probing for PERF_FLAG_FD_CLOEXEC flag (Adrian Hunter)
- Fix order of arguments to memcpy_alloc_mem in 'perf bench' (Bruce Merry)
- Sparc64 and Aarch64 build and segfault fixes (David Ahern)
----------------------------------------------------------------
Adrian Hunter (2):
perf tools: Fix pthread_attr_setaffinity_np build error perf tools: Fix probing for PERF_FLAG_FD_CLOEXEC flag
Bruce Merry (1):
perf bench: Fix order of arguments to memcpy_alloc_mem
David Ahern (3):
perf top: Fix SIGBUS on sparc64
perf symbols: Define EM_AARCH64 for older OSes perf tools: Make sparc64 arch point to sparc
Josh Boyer (1):
perf tools: Define _GNU_SOURCE on pthread_attr_setaffinity_np feature check
tools/perf/bench/mem-memcpy.c | 4 ++-- tools/perf/config/Makefile.arch | 4 ++++ tools/perf/config/feature-checks/Makefile | 2 +- .../feature-checks/test-pthread-attr-setaffinity-np.c | 3 ++- tools/perf/util/cloexec.c | 18 +++++++++++++++--- tools/perf/util/evlist.h | 2 +- tools/perf/util/symbol-elf.c | 5 +++++ 7 files changed, 30 insertions(+), 8 deletions(-)
Arnaldo Carvalho de Melo
maintainerPATCH 1/7 perf bench: Fix order of arguments to memcpy_alloc_mem
From: Bruce Merry <[email protected]>
This was causing the destination instead of the source to be filled. As a result, the source was typically all mapped to one zero page, and hence very cacheable.
--- tools/perf/bench/mem-memcpy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/bench/mem-memcpy.c +2 -2
@@ -289,7 +289,7 @@ static u64 do_memcpy_cycle(const struct routine *r, size_t len, bool prefault)memcpy_t fn = r->fn.memcpy;int i; -memcpy_alloc_mem (&src, &dst, len); +memcpy_alloc_mem (&dst, &src, len);if (prefault)fn (dst, src, len);
@@ -312,7 +312,7 @@ static double do_memcpy_gettimeofday(const struct routine *r, size_t len,void *src =NULL , *dst =NULL ;int i; -memcpy_alloc_mem (&src, &dst, len); +memcpy_alloc_mem (&dst, &src, len);if (prefault)fn (dst, src, len);
Signature · 1 line
1.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 2/7 perf tools: Define _GNU_SOURCE on pthread_attr_setaffinity_np feature check
In reply to Arnaldo Carvalho de MeloFrom: Josh Boyer <[email protected]>
The man page for pthread_attr_set_affinity_np states that _GNU_SOURCE must be defined before pthread.h is included in order to get the proper function declaration. Define this in the Makefile.
Without this defined, the feature check fails on a Fedora system with gcc5 and then the perf build later fails with conflicting prototypes for the function.
--- tools/perf/config/feature-checks/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/config/feature-checks/Makefile +1 -1
@@ -49,7 +49,7 @@ test-hello.bin: $(BUILD) test-pthread-attr-setaffinity-np.bin: - $(BUILD) -Werror -lpthread + $(BUILD) -D_GNU_SOURCE -Werror -lpthread test-stackprotector-all.bin: $(BUILD) -Werror -fstack-protector-all
Signature · 1 line
1.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 3/7 perf tools: Fix pthread_attr_setaffinity_np build error
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Feature detection for pthread_attr_setaffinity_np was failing, producing this error:
In file included from bench/futex-hash.c:17:0:
bench/futex.h:73:19: error: conflicting types for ‘pthread_attr_setaffinity_np’
static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr,
^
In file included from bench/futex.h:72:0,
from bench/futex-hash.c:17:
/usr/include/pthread.h:407:12: note: previous declaration of ‘pthread_attr_setaffinity_np’ was here
extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
^ make[3]: *** [bench/futex-hash.o] Error 1
make[2]: *** [bench] Error 2
make[2]: *** Waiting for unfinished jobs....
This was because compiling test-pthread-attr-setaffinity-np.c failed due to the function arguments:
test-pthread-attr-setaffinity-np.c: In function ‘main’:
test-pthread-attr-setaffinity-np.c:11:2: warning: null argument where non-null required (argument 3) [-Wnonnull]
ret = pthread_attr_setaffinity_np(&thread_attr, 0, NULL);
^So fix the arguments.
--- tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c +2 -1
@@ -5,10 +5,11 @@ int main(void) {int ret =0 ;pthread_attr_t thread_attr; +cpu_set_t cs;pthread_attr_init (&thread_attr);/* don't care abt exact args, just the API itself in libpthread */ - ret =pthread_attr_setaffinity_np (&thread_attr,0 ,NULL ); + ret =pthread_attr_setaffinity_np (&thread_attr,sizeof (cs), &cs);return ret; }
Signature · 1 line
1.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 5/7 perf top: Fix SIGBUS on sparc64
In reply to Arnaldo Carvalho de MeloFrom: David Ahern <[email protected]>
perf-top is terminating due to SIGBUS on sparc64. git bisect points to:
commit 82396986032915c1572bfb74b224fcc2e4e8ba7c
Author: Arnaldo Carvalho de Melo <[email protected]>
Date: Mon Sep 8 13:26:35 2014 -0300
perf evlist: Refcount mmaps
We need to know how many fds are using a perf mmap via PERF_EVENT_IOC_SET_OUTPUT, so that we can know when to ditch an mmap, refcount it.
This commit added 'int refcnt' to struct perf_mmap and the addition makes the event_copy element no longer 8-byte aligned.
Fix by adding __attribute__((aligned(8))) to the event_copy struct member.
--- tools/perf/util/evlist.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/evlist.h +1 -1
@@ -28,7 +28,7 @@ struct perf_mmap {int mask;int refcnt;unsigned int prev; -char event_copy[PERF_SAMPLE_MAX_SIZE ]; + char event_copy[PERF_SAMPLE_MAX_SIZE] __attribute__((aligned(8))); };struct perf_evlist {
Signature · 1 line
1.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 6/7 perf symbols: Define EM_AARCH64 for older OSes
In reply to Arnaldo Carvalho de MeloFrom: David Ahern <[email protected]>
4886f2ca19f6f added an arm-64 check, but the EM_AARCH64 macro is not defined in older releases (e.g., RHEL6). Define if it is not defined.
--- tools/perf/util/symbol-elf.c | 5 +++++ 1 file changed, 5 insertions(+)
tools/perf/util/symbol-elf.c +5 -0
@@ -11,6 +11,11 @@#include <symbol/kallsyms.h> #include "debug.h" +#ifndef EM_AARCH64 +#define EM_AARCH64 183/* ARM 64 bit */ +#endif + +#ifdef HAVE_CPLUS_DEMANGLE_SUPPORT extern char *cplus_demangle (const char *,int );
Signature · 1 line
1.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 7/7 perf tools: Make sparc64 arch point to sparc
In reply to Arnaldo Carvalho de MeloFrom: David Ahern <[email protected]>
The recent build changes cause perf to not compile for sparc64 since the arch/sparc64/Build file does not exist:
/home/dahern/kernels/linux.git/tools/build/Makefile.build:40: arch/sparc64/Build: No such file or directory
Fix by converting the sparc64 RAW_ARCH to sparc ARCH -- similar to what is done for x86_64.
--- tools/perf/config/Makefile.arch | 4 ++++ 1 file changed, 4 insertions(+)
tools/perf/config/Makefile.arch +4 -0
@@ -21,6 +21,10 @@ ifeq ($(RAW_ARCH),x86_64) endif endif +ifeq ($(RAW_ARCH),sparc64) + ARCH ?= sparc +endif + ARCH ?= $(RAW_ARCH) LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
Signature · 1 line
1.9.3