Skip to content

Commit

Permalink
Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/lin…
Browse files Browse the repository at this point in the history
…ux/kernel/git/acme/linux into perf/urgent

Pull perf/urgent fixes from Arnaldo Carvalho de Melo:

  - 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)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Ingo Molnar committed Mar 1, 2015
2 parents 2a6730c + 4861f87 commit 021f5f1
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 8 deletions.
4 changes: 2 additions & 2 deletions tools/perf/bench/mem-memcpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions tools/perf/config/Makefile.arch
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/config/feature-checks/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
18 changes: 15 additions & 3 deletions tools/perf/util/cloexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ static int perf_flag_probe(void)
if (cpu < 0)
cpu = 0;

/*
* Using -1 for the pid is a workaround to avoid gratuitous jump label
* changes.
*/
while (1) {
/* check cloexec flag */
fd = sys_perf_event_open(&attr, pid, cpu, -1,
Expand All @@ -47,16 +51,24 @@ static int perf_flag_probe(void)
err, strerror_r(err, sbuf, sizeof(sbuf)));

/* not supported, confirm error related to PERF_FLAG_FD_CLOEXEC */
fd = sys_perf_event_open(&attr, pid, cpu, -1, 0);
while (1) {
fd = sys_perf_event_open(&attr, pid, cpu, -1, 0);
if (fd < 0 && pid == -1 && errno == EACCES) {
pid = 0;
continue;
}
break;
}
err = errno;

if (fd >= 0)
close(fd);

if (WARN_ONCE(fd < 0 && err != EBUSY,
"perf_event_open(..., 0) failed unexpectedly with error %d (%s)\n",
err, strerror_r(err, sbuf, sizeof(sbuf))))
return -1;

close(fd);

return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion tools/perf/util/evlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions tools/perf/util/symbol-elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 021f5f1

Please sign in to comment.