Skip to content

Commit 0bd106d

Browse files
author
Ingo Molnar
committed
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 <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
2 parents 5cb52b5 + b0500c1 commit 0bd106d

File tree

15 files changed

+70
-23
lines changed

15 files changed

+70
-23
lines changed

tools/Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ liblockdep_clean:
127127
libapi_clean:
128128
$(call descend,lib/api,clean)
129129

130+
libbpf_clean:
131+
$(call descend,lib/bpf,clean)
132+
133+
libsubcmd_clean:
134+
$(call descend,lib/subcmd,clean)
135+
130136
perf_clean:
131137
$(call descend,$(@:_clean=),clean)
132138

@@ -142,9 +148,12 @@ tmon_clean:
142148
freefall_clean:
143149
$(call descend,laptop/freefall,clean)
144150

151+
build_clean:
152+
$(call descend,build,clean)
153+
145154
clean: acpi_clean cgroup_clean cpupower_clean hv_clean firewire_clean lguest_clean \
146155
perf_clean selftests_clean turbostat_clean usb_clean virtio_clean \
147156
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
149158

150159
.PHONY: FORCE

tools/build/feature/test-all.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@
125125
# include "test-get_cpuid.c"
126126
#undef main
127127

128+
#define main main_test_bpf
129+
# include "test-bpf.c"
130+
#undef main
131+
128132
int main(int argc, char *argv[])
129133
{
130134
main_test_libpython();
@@ -153,6 +157,7 @@ int main(int argc, char *argv[])
153157
main_test_pthread_attr_setaffinity_np();
154158
main_test_lzma();
155159
main_test_get_cpuid();
160+
main_test_bpf();
156161

157162
return 0;
158163
}

tools/build/feature/test-bpf.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
1+
#include <asm/unistd.h>
12
#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
215

316
int main(void)
417
{
518
union bpf_attr attr;
619

20+
/* Check fields in attr */
721
attr.prog_type = BPF_PROG_TYPE_KPROBE;
822
attr.insn_cnt = 0;
923
attr.insns = 0;
@@ -14,5 +28,9 @@ int main(void)
1428
attr.kern_version = 0;
1529

1630
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));
1836
}

tools/lib/bpf/Makefile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ BPF_EXTRAVERSION = 1
66

77
MAKEFLAGS += --no-print-directory
88

9+
ifeq ($(srctree),)
10+
srctree := $(patsubst %/,%,$(dir $(shell pwd)))
11+
srctree := $(patsubst %/,%,$(dir $(srctree)))
12+
srctree := $(patsubst %/,%,$(dir $(srctree)))
13+
#$(info Determined 'srctree' to be $(srctree))
14+
endif
915

1016
# Makefiles suck: This macro sets a default value of $(2) for the
1117
# variable named by $(1), unless the variable has been set by
@@ -31,7 +37,8 @@ INSTALL = install
3137
DESTDIR ?=
3238
DESTDIR_SQ = '$(subst ','\'',$(DESTDIR))'
3339

34-
LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
40+
include $(srctree)/tools/scripts/Makefile.arch
41+
3542
ifeq ($(LP64), 1)
3643
libdir_relative = lib64
3744
else
@@ -57,13 +64,6 @@ ifndef VERBOSE
5764
VERBOSE = 0
5865
endif
5966

60-
ifeq ($(srctree),)
61-
srctree := $(patsubst %/,%,$(dir $(shell pwd)))
62-
srctree := $(patsubst %/,%,$(dir $(srctree)))
63-
srctree := $(patsubst %/,%,$(dir $(srctree)))
64-
#$(info Determined 'srctree' to be $(srctree))
65-
endif
66-
6767
FEATURE_USER = .libbpf
6868
FEATURE_TESTS = libelf libelf-getphdrnum libelf-mmap bpf
6969
FEATURE_DISPLAY = libelf bpf
@@ -192,7 +192,7 @@ config-clean:
192192
$(Q)$(MAKE) -C $(srctree)/tools/build/feature/ clean >/dev/null
193193

194194
clean:
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 \
196196
$(RM) LIBBPF-CFLAGS
197197
$(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf
198198

tools/lib/bpf/bpf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#include "bpf.h"
1515

1616
/*
17-
* When building perf, unistd.h is override. Define __NR_bpf is
18-
* required to be defined.
17+
* When building perf, unistd.h is overrided. __NR_bpf is
18+
* required to be defined explicitly.
1919
*/
2020
#ifndef __NR_bpf
2121
# if defined(__i386__)

tools/lib/lockdep/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ install_lib: all_cmd
149149
install: install_lib
150150

151151
clean:
152-
$(RM) *.o *~ $(TARGETS) *.a *liblockdep*.so* $(VERSION_FILES) .*.d
152+
$(RM) *.o *~ $(TARGETS) *.a *liblockdep*.so* $(VERSION_FILES) .*.d .*.cmd
153153
$(RM) tags TAGS
154154

155155
PHONY += force

tools/perf/MANIFEST

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ tools/lib/string.c
2828
tools/lib/symbol/kallsyms.c
2929
tools/lib/symbol/kallsyms.h
3030
tools/lib/find_bit.c
31+
tools/lib/bitmap.c
3132
tools/include/asm/atomic.h
3233
tools/include/asm/barrier.h
3334
tools/include/asm/bug.h
@@ -57,6 +58,7 @@ tools/include/linux/rbtree_augmented.h
5758
tools/include/linux/string.h
5859
tools/include/linux/types.h
5960
tools/include/linux/err.h
61+
tools/include/linux/bitmap.h
6062
include/asm-generic/bitops/arch_hweight.h
6163
include/asm-generic/bitops/const_hweight.h
6264
include/asm-generic/bitops/fls64.h

tools/perf/config/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected)
1717

1818
CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)
1919

20-
include $(src-perf)/config/Makefile.arch
20+
include $(srctree)/tools/scripts/Makefile.arch
2121

2222
$(call detected_var,ARCH)
2323

@@ -493,7 +493,7 @@ else
493493

494494
PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
495495
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
497497
PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
498498
FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
499499

tools/perf/tests/hists_common.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,6 @@ struct machine *setup_fake_machine(struct machines *machines)
8787
return NULL;
8888
}
8989

90-
if (machine__create_kernel_maps(machine)) {
91-
pr_debug("Cannot create kernel maps\n");
92-
return NULL;
93-
}
94-
9590
for (i = 0; i < ARRAY_SIZE(fake_threads); i++) {
9691
struct thread *thread;
9792

tools/perf/tests/hists_cumulate.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,7 @@ int test__hists_cumulate(int subtest __maybe_unused)
706706
err = parse_events(evlist, "cpu-clock", NULL);
707707
if (err)
708708
goto out;
709+
err = TEST_FAIL;
709710

710711
machines__init(&machines);
711712

0 commit comments

Comments
 (0)