aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2016-01-12 05:01:16 -0500
committerIngo Molnar <mingo@kernel.org>2016-01-12 05:01:16 -0500
commit0bd106d26dbe444160104b3153ca1652d2ab913b (patch)
tree10f8eb3f196f5b0e133b6ce8a63df4ac7a8f7c97 /tools
parent5cb52b5e1654f3f1ed9c32e34456d98559c85aa0 (diff)
parentb0500c169b4069e40f03391c7280cd6eaf849e49 (diff)
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
Pull perf tooling fixes from Arnaldo Carvalho de Melo: " - Fix a few clean targets in tools/ (Jiri Olsa) - Add missing sources to perf's MANIFEST, fixing the out of tree build with 'make perf-tar*-src-pkg' tarballs (Jiri Olsa) - Fix bpf related build problems in PowerPC (Naveen N. Rao, Wang Nan) - 'make -C tools/perf build-test' fixes (Wang Nan) - Fix 'perf test hist' entry (Wang Nan) - Add BPF feature check to test-all, as in an environment with all other features enabled, BPF would be considered enabled without doing real feature check. (Wang Nan)" Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile11
-rw-r--r--tools/build/feature/test-all.c5
-rw-r--r--tools/build/feature/test-bpf.c20
-rw-r--r--tools/lib/bpf/Makefile18
-rw-r--r--tools/lib/bpf/bpf.c4
-rw-r--r--tools/lib/lockdep/Makefile2
-rw-r--r--tools/perf/MANIFEST2
-rw-r--r--tools/perf/config/Makefile4
-rw-r--r--tools/perf/tests/hists_common.c5
-rw-r--r--tools/perf/tests/hists_cumulate.c1
-rw-r--r--tools/perf/tests/hists_filter.c1
-rw-r--r--tools/perf/tests/hists_link.c1
-rw-r--r--tools/perf/tests/hists_output.c1
-rw-r--r--tools/perf/tests/make18
-rw-r--r--tools/scripts/Makefile.arch (renamed from tools/perf/config/Makefile.arch)0
15 files changed, 70 insertions, 23 deletions
diff --git a/tools/Makefile b/tools/Makefile
index 0ba0df3b516f..4e8e10755e0d 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -127,6 +127,12 @@ liblockdep_clean:
127libapi_clean: 127libapi_clean:
128 $(call descend,lib/api,clean) 128 $(call descend,lib/api,clean)
129 129
130libbpf_clean:
131 $(call descend,lib/bpf,clean)
132
133libsubcmd_clean:
134 $(call descend,lib/subcmd,clean)
135
130perf_clean: 136perf_clean:
131 $(call descend,$(@:_clean=),clean) 137 $(call descend,$(@:_clean=),clean)
132 138
@@ -142,9 +148,12 @@ tmon_clean:
142freefall_clean: 148freefall_clean:
143 $(call descend,laptop/freefall,clean) 149 $(call descend,laptop/freefall,clean)
144 150
151build_clean:
152 $(call descend,build,clean)
153
145clean: acpi_clean cgroup_clean cpupower_clean hv_clean firewire_clean lguest_clean \ 154clean: acpi_clean cgroup_clean cpupower_clean hv_clean firewire_clean lguest_clean \
146 perf_clean selftests_clean turbostat_clean usb_clean virtio_clean \ 155 perf_clean selftests_clean turbostat_clean usb_clean virtio_clean \
147 vm_clean net_clean iio_clean x86_energy_perf_policy_clean tmon_clean \ 156 vm_clean net_clean iio_clean x86_energy_perf_policy_clean tmon_clean \
148 freefall_clean 157 freefall_clean build_clean libbpf_clean libsubcmd_clean liblockdep_clean
149 158
150.PHONY: FORCE 159.PHONY: FORCE
diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
index 33cf6f20bd4e..81025cade45f 100644
--- a/tools/build/feature/test-all.c
+++ b/tools/build/feature/test-all.c
@@ -125,6 +125,10 @@
125# include "test-get_cpuid.c" 125# include "test-get_cpuid.c"
126#undef main 126#undef main
127 127
128#define main main_test_bpf
129# include "test-bpf.c"
130#undef main
131
128int main(int argc, char *argv[]) 132int main(int argc, char *argv[])
129{ 133{
130 main_test_libpython(); 134 main_test_libpython();
@@ -153,6 +157,7 @@ int main(int argc, char *argv[])
153 main_test_pthread_attr_setaffinity_np(); 157 main_test_pthread_attr_setaffinity_np();
154 main_test_lzma(); 158 main_test_lzma();
155 main_test_get_cpuid(); 159 main_test_get_cpuid();
160 main_test_bpf();
156 161
157 return 0; 162 return 0;
158} 163}
diff --git a/tools/build/feature/test-bpf.c b/tools/build/feature/test-bpf.c
index 062bac811af9..b389026839b9 100644
--- a/tools/build/feature/test-bpf.c
+++ b/tools/build/feature/test-bpf.c
@@ -1,9 +1,23 @@
1#include <asm/unistd.h>
1#include <linux/bpf.h> 2#include <linux/bpf.h>
3#include <unistd.h>
4
5#ifndef __NR_bpf
6# if defined(__i386__)
7# define __NR_bpf 357
8# elif defined(__x86_64__)
9# define __NR_bpf 321
10# elif defined(__aarch64__)
11# define __NR_bpf 280
12# error __NR_bpf not defined. libbpf does not support your arch.
13# endif
14#endif
2 15
3int main(void) 16int main(void)
4{ 17{
5 union bpf_attr attr; 18 union bpf_attr attr;
6 19
20 /* Check fields in attr */
7 attr.prog_type = BPF_PROG_TYPE_KPROBE; 21 attr.prog_type = BPF_PROG_TYPE_KPROBE;
8 attr.insn_cnt = 0; 22 attr.insn_cnt = 0;
9 attr.insns = 0; 23 attr.insns = 0;
@@ -14,5 +28,9 @@ int main(void)
14 attr.kern_version = 0; 28 attr.kern_version = 0;
15 29
16 attr = attr; 30 attr = attr;
17 return 0; 31 /*
32 * Test existence of __NR_bpf and BPF_PROG_LOAD.
33 * This call should fail if we run the testcase.
34 */
35 return syscall(__NR_bpf, BPF_PROG_LOAD, attr, sizeof(attr));
18} 36}
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 919b71780710..fc1bc75ae56d 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -6,6 +6,12 @@ BPF_EXTRAVERSION = 1
6 6
7MAKEFLAGS += --no-print-directory 7MAKEFLAGS += --no-print-directory
8 8
9ifeq ($(srctree),)
10srctree := $(patsubst %/,%,$(dir $(shell pwd)))
11srctree := $(patsubst %/,%,$(dir $(srctree)))
12srctree := $(patsubst %/,%,$(dir $(srctree)))
13#$(info Determined 'srctree' to be $(srctree))
14endif
9 15
10# Makefiles suck: This macro sets a default value of $(2) for the 16# Makefiles suck: This macro sets a default value of $(2) for the
11# variable named by $(1), unless the variable has been set by 17# variable named by $(1), unless the variable has been set by
@@ -31,7 +37,8 @@ INSTALL = install
31DESTDIR ?= 37DESTDIR ?=
32DESTDIR_SQ = '$(subst ','\'',$(DESTDIR))' 38DESTDIR_SQ = '$(subst ','\'',$(DESTDIR))'
33 39
34LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1) 40include $(srctree)/tools/scripts/Makefile.arch
41
35ifeq ($(LP64), 1) 42ifeq ($(LP64), 1)
36 libdir_relative = lib64 43 libdir_relative = lib64
37else 44else
@@ -57,13 +64,6 @@ ifndef VERBOSE
57 VERBOSE = 0 64 VERBOSE = 0
58endif 65endif
59 66
60ifeq ($(srctree),)
61srctree := $(patsubst %/,%,$(dir $(shell pwd)))
62srctree := $(patsubst %/,%,$(dir $(srctree)))
63srctree := $(patsubst %/,%,$(dir $(srctree)))
64#$(info Determined 'srctree' to be $(srctree))
65endif
66
67FEATURE_USER = .libbpf 67FEATURE_USER = .libbpf
68FEATURE_TESTS = libelf libelf-getphdrnum libelf-mmap bpf 68FEATURE_TESTS = libelf libelf-getphdrnum libelf-mmap bpf
69FEATURE_DISPLAY = libelf bpf 69FEATURE_DISPLAY = libelf bpf
@@ -192,7 +192,7 @@ config-clean:
192 $(Q)$(MAKE) -C $(srctree)/tools/build/feature/ clean >/dev/null 192 $(Q)$(MAKE) -C $(srctree)/tools/build/feature/ clean >/dev/null
193 193
194clean: 194clean:
195 $(call QUIET_CLEAN, libbpf) $(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d \ 195 $(call QUIET_CLEAN, libbpf) $(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd \
196 $(RM) LIBBPF-CFLAGS 196 $(RM) LIBBPF-CFLAGS
197 $(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf 197 $(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf
198 198
diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
index 5bdc6eab6852..1f91cc941b7c 100644
--- a/tools/lib/bpf/bpf.c
+++ b/tools/lib/bpf/bpf.c
@@ -14,8 +14,8 @@
14#include "bpf.h" 14#include "bpf.h"
15 15
16/* 16/*
17 * When building perf, unistd.h is override. Define __NR_bpf is 17 * When building perf, unistd.h is overrided. __NR_bpf is
18 * required to be defined. 18 * required to be defined explicitly.
19 */ 19 */
20#ifndef __NR_bpf 20#ifndef __NR_bpf
21# if defined(__i386__) 21# if defined(__i386__)
diff --git a/tools/lib/lockdep/Makefile b/tools/lib/lockdep/Makefile
index 7e319afac78a..90d2baeb621a 100644
--- a/tools/lib/lockdep/Makefile
+++ b/tools/lib/lockdep/Makefile
@@ -149,7 +149,7 @@ install_lib: all_cmd
149install: install_lib 149install: install_lib
150 150
151clean: 151clean:
152 $(RM) *.o *~ $(TARGETS) *.a *liblockdep*.so* $(VERSION_FILES) .*.d 152 $(RM) *.o *~ $(TARGETS) *.a *liblockdep*.so* $(VERSION_FILES) .*.d .*.cmd
153 $(RM) tags TAGS 153 $(RM) tags TAGS
154 154
155PHONY += force 155PHONY += force
diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index ddf922f93aa1..2e1fa2357528 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -28,6 +28,7 @@ tools/lib/string.c
28tools/lib/symbol/kallsyms.c 28tools/lib/symbol/kallsyms.c
29tools/lib/symbol/kallsyms.h 29tools/lib/symbol/kallsyms.h
30tools/lib/find_bit.c 30tools/lib/find_bit.c
31tools/lib/bitmap.c
31tools/include/asm/atomic.h 32tools/include/asm/atomic.h
32tools/include/asm/barrier.h 33tools/include/asm/barrier.h
33tools/include/asm/bug.h 34tools/include/asm/bug.h
@@ -57,6 +58,7 @@ tools/include/linux/rbtree_augmented.h
57tools/include/linux/string.h 58tools/include/linux/string.h
58tools/include/linux/types.h 59tools/include/linux/types.h
59tools/include/linux/err.h 60tools/include/linux/err.h
61tools/include/linux/bitmap.h
60include/asm-generic/bitops/arch_hweight.h 62include/asm-generic/bitops/arch_hweight.h
61include/asm-generic/bitops/const_hweight.h 63include/asm-generic/bitops/const_hweight.h
62include/asm-generic/bitops/fls64.h 64include/asm-generic/bitops/fls64.h
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 254d06e39bea..7545ba60053e 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -17,7 +17,7 @@ detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected)
17 17
18CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS) 18CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)
19 19
20include $(src-perf)/config/Makefile.arch 20include $(srctree)/tools/scripts/Makefile.arch
21 21
22$(call detected_var,ARCH) 22$(call detected_var,ARCH)
23 23
@@ -493,7 +493,7 @@ else
493 493
494 PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) 494 PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
495 PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) 495 PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
496 PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) 496 PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
497 PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) 497 PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
498 FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) 498 FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
499 499
diff --git a/tools/perf/tests/hists_common.c b/tools/perf/tests/hists_common.c
index bcfd081ee1d2..071a8b5f5232 100644
--- a/tools/perf/tests/hists_common.c
+++ b/tools/perf/tests/hists_common.c
@@ -87,11 +87,6 @@ struct machine *setup_fake_machine(struct machines *machines)
87 return NULL; 87 return NULL;
88 } 88 }
89 89
90 if (machine__create_kernel_maps(machine)) {
91 pr_debug("Cannot create kernel maps\n");
92 return NULL;
93 }
94
95 for (i = 0; i < ARRAY_SIZE(fake_threads); i++) { 90 for (i = 0; i < ARRAY_SIZE(fake_threads); i++) {
96 struct thread *thread; 91 struct thread *thread;
97 92
diff --git a/tools/perf/tests/hists_cumulate.c b/tools/perf/tests/hists_cumulate.c
index e36089212061..5e6a86e50fb9 100644
--- a/tools/perf/tests/hists_cumulate.c
+++ b/tools/perf/tests/hists_cumulate.c
@@ -706,6 +706,7 @@ int test__hists_cumulate(int subtest __maybe_unused)
706 err = parse_events(evlist, "cpu-clock", NULL); 706 err = parse_events(evlist, "cpu-clock", NULL);
707 if (err) 707 if (err)
708 goto out; 708 goto out;
709 err = TEST_FAIL;
709 710
710 machines__init(&machines); 711 machines__init(&machines);
711 712
diff --git a/tools/perf/tests/hists_filter.c b/tools/perf/tests/hists_filter.c
index 2a784befd9ce..351a42463444 100644
--- a/tools/perf/tests/hists_filter.c
+++ b/tools/perf/tests/hists_filter.c
@@ -120,6 +120,7 @@ int test__hists_filter(int subtest __maybe_unused)
120 err = parse_events(evlist, "task-clock", NULL); 120 err = parse_events(evlist, "task-clock", NULL);
121 if (err) 121 if (err)
122 goto out; 122 goto out;
123 err = TEST_FAIL;
123 124
124 /* default sort order (comm,dso,sym) will be used */ 125 /* default sort order (comm,dso,sym) will be used */
125 if (setup_sorting(NULL) < 0) 126 if (setup_sorting(NULL) < 0)
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c
index c764d69ac6ef..64b257d8d557 100644
--- a/tools/perf/tests/hists_link.c
+++ b/tools/perf/tests/hists_link.c
@@ -293,6 +293,7 @@ int test__hists_link(int subtest __maybe_unused)
293 if (err) 293 if (err)
294 goto out; 294 goto out;
295 295
296 err = TEST_FAIL;
296 /* default sort order (comm,dso,sym) will be used */ 297 /* default sort order (comm,dso,sym) will be used */
297 if (setup_sorting(NULL) < 0) 298 if (setup_sorting(NULL) < 0)
298 goto out; 299 goto out;
diff --git a/tools/perf/tests/hists_output.c b/tools/perf/tests/hists_output.c
index ebe6cd485b5d..b231265148d8 100644
--- a/tools/perf/tests/hists_output.c
+++ b/tools/perf/tests/hists_output.c
@@ -597,6 +597,7 @@ int test__hists_output(int subtest __maybe_unused)
597 err = parse_events(evlist, "cpu-clock", NULL); 597 err = parse_events(evlist, "cpu-clock", NULL);
598 if (err) 598 if (err)
599 goto out; 599 goto out;
600 err = TEST_FAIL;
600 601
601 machines__init(&machines); 602 machines__init(&machines);
602 603
diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index c1fbb8e884c0..df38decc48c3 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -1,3 +1,5 @@
1include ../scripts/Makefile.include
2
1ifndef MK 3ifndef MK
2ifeq ($(MAKECMDGOALS),) 4ifeq ($(MAKECMDGOALS),)
3# no target specified, trigger the whole suite 5# no target specified, trigger the whole suite
@@ -12,7 +14,19 @@ endif
12else 14else
13PERF := . 15PERF := .
14 16
15include config/Makefile.arch 17# As per kernel Makefile, avoid funny character set dependencies
18unexport LC_ALL
19LC_COLLATE=C
20LC_NUMERIC=C
21export LC_COLLATE LC_NUMERIC
22
23ifeq ($(srctree),)
24srctree := $(patsubst %/,%,$(dir $(shell pwd)))
25srctree := $(patsubst %/,%,$(dir $(srctree)))
26#$(info Determined 'srctree' to be $(srctree))
27endif
28
29include $(srctree)/tools/scripts/Makefile.arch
16 30
17# FIXME looks like x86 is the only arch running tests ;-) 31# FIXME looks like x86 is the only arch running tests ;-)
18# we need some IS_(32/64) flag to make this generic 32# we need some IS_(32/64) flag to make this generic
@@ -280,5 +294,5 @@ all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools
280out: $(run_O) 294out: $(run_O)
281 @echo OK 295 @echo OK
282 296
283.PHONY: all $(run) $(run_O) tarpkg clean 297.PHONY: all $(run) $(run_O) tarpkg clean make_kernelsrc make_kernelsrc_tools
284endif # ifndef MK 298endif # ifndef MK
diff --git a/tools/perf/config/Makefile.arch b/tools/scripts/Makefile.arch
index e11fbd6fae78..e11fbd6fae78 100644
--- a/tools/perf/config/Makefile.arch
+++ b/tools/scripts/Makefile.arch