perf/urgent fixes:
User visible: - When handling perf_event_open() returning EBUSY and not being able to opendir the procfs mount point we would tell the user that the oprofile daemon was found by returning -1 on as the return for a bool function, oops, fix it, found with Coccinelle (Peter Senna Tschudin). - Fix per-pkg event reporting bug in 'perf stat' (Stephane Eranian) Developer visible: - Fix missing prototype for function provided when it isn't present in the libelf present, fixing the build on RHEL/CentOS 5.1 systems, for instance (Arnaldo Carvalho de Melo) - Detect if the gcc and libnuma have the features needed to avoid requiring the use of NO_LIBNUMA and/or NO_AUXTRACE to build on older systems (Arnaldo Carvalho de Melo) Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJV+wq3AAoJENZQFvNTUqpA6l0P/jyymIC3TfV7tEIQpA5Q9+y4 Mex2UL++XFy4TCxFKPqs8H0v4JwCE5Hy7C7XOisrujWcabPxfL1Rd1n/oWkCaSRB FxmvxrnRDHAjF9/PpOhzGSSWbj9NA35l8Z4i15wYRC68T+j6Xxnwd6eQvdxpEY/7 iaTI9vReyu4o8HTVO4mJFg+Ylo1QI/7r4UxBdaq5xnA+/pUhq4uDyus0e8R30Ix+ uFlpOA7Izn7QMwQ40KIFfLZNnTFrhDrbXcCruHoVEYx+vb9ytn3CgaqkXwY42lvz F2RSLryCg7PMoVwWXgeEV+cPFGnkLX0Go3GTQ09OFksewh8lQkxq6OfdF62xKpa8 J7owPMTFwXHjEDwHfvohEwzzianiqE1KQsZoVVztfCXcnblHY2PGQAQ27JrQGy+K W5emgXgqSKGin/8VBeqkhOpwBRcWdy5EBNoXKkWS1FGkZqWylIjpd9d7x8MKKB/Z 8rc5H3mJ/strF75CmUeIu1TDwhSJsZ8DQQNo6Y82YO89SpLojUznJEERsrI4KN0e pDlI4prCBoMj7euSRCkCETymQUdWsJlFlmmJFJhI87/E+M4G6paH4vL/bET3Z2yt aYDDIapPGPB1xUryCaBd++qqSZsTxKPu1qTdQ1CkDM0SkrzQwP6dKLSlmKpBtbUS TGOR3QWI45xInbkw73fa =k6ND -----END PGP SIGNATURE----- Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent Pull perf/urgent fixes from Arnaldo Carvalho de Melo: User visible changes: - When handling perf_event_open() returning EBUSY and not being able to opendir the procfs mount point we would tell the user that the oprofile daemon was found by returning -1 on as the return for a bool function, oops, fix it, found with Coccinelle. (Peter Senna Tschudin). - Fix per-pkg event reporting bug in 'perf stat'. (Stephane Eranian) Developer visible changes: - Fix missing prototype for function provided when it isn't present in the libelf present, fixing the build on RHEL/CentOS 5.1 systems, for instance. (Arnaldo Carvalho de Melo) - Detect if the gcc and libnuma have the features needed to avoid requiring the use of NO_LIBNUMA and/or NO_AUXTRACE to build on older systems. (Arnaldo Carvalho de Melo) Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
commit
a6f83f00ad
@ -41,6 +41,7 @@ FEATURE_TESTS ?= \
|
||||
libelf-getphdrnum \
|
||||
libelf-mmap \
|
||||
libnuma \
|
||||
numa_num_possible_cpus \
|
||||
libperl \
|
||||
libpython \
|
||||
libpython-version \
|
||||
@ -51,7 +52,8 @@ FEATURE_TESTS ?= \
|
||||
timerfd \
|
||||
libdw-dwarf-unwind \
|
||||
zlib \
|
||||
lzma
|
||||
lzma \
|
||||
get_cpuid
|
||||
|
||||
FEATURE_DISPLAY ?= \
|
||||
dwarf \
|
||||
@ -61,13 +63,15 @@ FEATURE_DISPLAY ?= \
|
||||
libbfd \
|
||||
libelf \
|
||||
libnuma \
|
||||
numa_num_possible_cpus \
|
||||
libperl \
|
||||
libpython \
|
||||
libslang \
|
||||
libunwind \
|
||||
libdw-dwarf-unwind \
|
||||
zlib \
|
||||
lzma
|
||||
lzma \
|
||||
get_cpuid
|
||||
|
||||
# Set FEATURE_CHECK_(C|LD)FLAGS-all for all FEATURE_TESTS features.
|
||||
# If in the future we need per-feature checks/flags for features not
|
||||
|
@ -19,6 +19,7 @@ FILES= \
|
||||
test-libelf-getphdrnum.bin \
|
||||
test-libelf-mmap.bin \
|
||||
test-libnuma.bin \
|
||||
test-numa_num_possible_cpus.bin \
|
||||
test-libperl.bin \
|
||||
test-libpython.bin \
|
||||
test-libpython-version.bin \
|
||||
@ -34,7 +35,8 @@ FILES= \
|
||||
test-compile-x32.bin \
|
||||
test-zlib.bin \
|
||||
test-lzma.bin \
|
||||
test-bpf.bin
|
||||
test-bpf.bin \
|
||||
test-get_cpuid.bin
|
||||
|
||||
CC := $(CROSS_COMPILE)gcc -MD
|
||||
PKG_CONFIG := $(CROSS_COMPILE)pkg-config
|
||||
@ -87,6 +89,9 @@ test-libelf-getphdrnum.bin:
|
||||
test-libnuma.bin:
|
||||
$(BUILD) -lnuma
|
||||
|
||||
test-numa_num_possible_cpus.bin:
|
||||
$(BUILD) -lnuma
|
||||
|
||||
test-libunwind.bin:
|
||||
$(BUILD) -lelf
|
||||
|
||||
@ -162,6 +167,9 @@ test-zlib.bin:
|
||||
test-lzma.bin:
|
||||
$(BUILD) -llzma
|
||||
|
||||
test-get_cpuid.bin:
|
||||
$(BUILD)
|
||||
|
||||
test-bpf.bin:
|
||||
$(BUILD)
|
||||
|
||||
|
@ -77,6 +77,10 @@
|
||||
# include "test-libnuma.c"
|
||||
#undef main
|
||||
|
||||
#define main main_test_numa_num_possible_cpus
|
||||
# include "test-numa_num_possible_cpus.c"
|
||||
#undef main
|
||||
|
||||
#define main main_test_timerfd
|
||||
# include "test-timerfd.c"
|
||||
#undef main
|
||||
@ -117,6 +121,10 @@
|
||||
# include "test-lzma.c"
|
||||
#undef main
|
||||
|
||||
#define main main_test_get_cpuid
|
||||
# include "test-get_cpuid.c"
|
||||
#undef main
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
main_test_libpython();
|
||||
@ -136,6 +144,7 @@ int main(int argc, char *argv[])
|
||||
main_test_libbfd();
|
||||
main_test_backtrace();
|
||||
main_test_libnuma();
|
||||
main_test_numa_num_possible_cpus();
|
||||
main_test_timerfd();
|
||||
main_test_stackprotector_all();
|
||||
main_test_libdw_dwarf_unwind();
|
||||
@ -143,6 +152,7 @@ int main(int argc, char *argv[])
|
||||
main_test_zlib();
|
||||
main_test_pthread_attr_setaffinity_np();
|
||||
main_test_lzma();
|
||||
main_test_get_cpuid();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
7
tools/build/feature/test-get_cpuid.c
Normal file
7
tools/build/feature/test-get_cpuid.c
Normal file
@ -0,0 +1,7 @@
|
||||
#include <cpuid.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
unsigned int eax = 0, ebx = 0, ecx = 0, edx = 0;
|
||||
return __get_cpuid(0x15, &eax, &ebx, &ecx, &edx);
|
||||
}
|
6
tools/build/feature/test-numa_num_possible_cpus.c
Normal file
6
tools/build/feature/test-numa_num_possible_cpus.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include <numa.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return numa_num_possible_cpus();
|
||||
}
|
@ -573,9 +573,14 @@ ifndef NO_LIBNUMA
|
||||
msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev);
|
||||
NO_LIBNUMA := 1
|
||||
else
|
||||
CFLAGS += -DHAVE_LIBNUMA_SUPPORT
|
||||
EXTLIBS += -lnuma
|
||||
$(call detected,CONFIG_NUMA)
|
||||
ifeq ($(feature-numa_num_possible_cpus), 0)
|
||||
msg := $(warning Old numa library found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev >= 2.0.8);
|
||||
NO_LIBNUMA := 1
|
||||
else
|
||||
CFLAGS += -DHAVE_LIBNUMA_SUPPORT
|
||||
EXTLIBS += -lnuma
|
||||
$(call detected,CONFIG_NUMA)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
@ -621,8 +626,13 @@ ifdef LIBBABELTRACE
|
||||
endif
|
||||
|
||||
ifndef NO_AUXTRACE
|
||||
$(call detected,CONFIG_AUXTRACE)
|
||||
CFLAGS += -DHAVE_AUXTRACE_SUPPORT
|
||||
ifeq ($(feature-get_cpuid), 0)
|
||||
msg := $(warning Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc);
|
||||
NO_AUXTRACE := 1
|
||||
else
|
||||
$(call detected,CONFIG_AUXTRACE)
|
||||
CFLAGS += -DHAVE_AUXTRACE_SUPPORT
|
||||
endif
|
||||
endif
|
||||
|
||||
# Among the variables below, these:
|
||||
|
@ -196,7 +196,8 @@ static void zero_per_pkg(struct perf_evsel *counter)
|
||||
memset(counter->per_pkg_mask, 0, MAX_NR_CPUS);
|
||||
}
|
||||
|
||||
static int check_per_pkg(struct perf_evsel *counter, int cpu, bool *skip)
|
||||
static int check_per_pkg(struct perf_evsel *counter,
|
||||
struct perf_counts_values *vals, int cpu, bool *skip)
|
||||
{
|
||||
unsigned long *mask = counter->per_pkg_mask;
|
||||
struct cpu_map *cpus = perf_evsel__cpus(counter);
|
||||
@ -218,6 +219,17 @@ static int check_per_pkg(struct perf_evsel *counter, int cpu, bool *skip)
|
||||
counter->per_pkg_mask = mask;
|
||||
}
|
||||
|
||||
/*
|
||||
* we do not consider an event that has not run as a good
|
||||
* instance to mark a package as used (skip=1). Otherwise
|
||||
* we may run into a situation where the first CPU in a package
|
||||
* is not running anything, yet the second is, and this function
|
||||
* would mark the package as used after the first CPU and would
|
||||
* not read the values from the second CPU.
|
||||
*/
|
||||
if (!(vals->run && vals->ena))
|
||||
return 0;
|
||||
|
||||
s = cpu_map__get_socket(cpus, cpu);
|
||||
if (s < 0)
|
||||
return -1;
|
||||
@ -235,7 +247,7 @@ process_counter_values(struct perf_stat_config *config, struct perf_evsel *evsel
|
||||
static struct perf_counts_values zero;
|
||||
bool skip = false;
|
||||
|
||||
if (check_per_pkg(evsel, cpu, &skip)) {
|
||||
if (check_per_pkg(evsel, count, cpu, &skip)) {
|
||||
pr_err("failed to read per-pkg counter\n");
|
||||
return -1;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ static inline char *bfd_demangle(void __maybe_unused *v,
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ELF_GETPHDRNUM_SUPPORT
|
||||
int elf_getphdrnum(Elf *elf, size_t *dst)
|
||||
static int elf_getphdrnum(Elf *elf, size_t *dst)
|
||||
{
|
||||
GElf_Ehdr gehdr;
|
||||
GElf_Ehdr *ehdr;
|
||||
|
@ -709,7 +709,7 @@ bool find_process(const char *name)
|
||||
|
||||
dir = opendir(procfs__mountpoint());
|
||||
if (!dir)
|
||||
return -1;
|
||||
return false;
|
||||
|
||||
/* Walk through the directory. */
|
||||
while (ret && (d = readdir(dir)) != NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user