Skip to content

Commit

Permalink
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/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>
  • Loading branch information
Ingo Molnar committed Jan 12, 2016
2 parents 5cb52b5 + b0500c1 commit 0bd106d
Show file tree
Hide file tree
Showing 15 changed files with 70 additions and 23 deletions.
11 changes: 10 additions & 1 deletion tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ liblockdep_clean:
libapi_clean:
$(call descend,lib/api,clean)

libbpf_clean:
$(call descend,lib/bpf,clean)

libsubcmd_clean:
$(call descend,lib/subcmd,clean)

perf_clean:
$(call descend,$(@:_clean=),clean)

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

build_clean:
$(call descend,build,clean)

clean: acpi_clean cgroup_clean cpupower_clean hv_clean firewire_clean lguest_clean \
perf_clean selftests_clean turbostat_clean usb_clean virtio_clean \
vm_clean net_clean iio_clean x86_energy_perf_policy_clean tmon_clean \
freefall_clean
freefall_clean build_clean libbpf_clean libsubcmd_clean liblockdep_clean

.PHONY: FORCE
5 changes: 5 additions & 0 deletions tools/build/feature/test-all.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@
# include "test-get_cpuid.c"
#undef main

#define main main_test_bpf
# include "test-bpf.c"
#undef main

int main(int argc, char *argv[])
{
main_test_libpython();
Expand Down Expand Up @@ -153,6 +157,7 @@ int main(int argc, char *argv[])
main_test_pthread_attr_setaffinity_np();
main_test_lzma();
main_test_get_cpuid();
main_test_bpf();

return 0;
}
20 changes: 19 additions & 1 deletion tools/build/feature/test-bpf.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
#include <asm/unistd.h>
#include <linux/bpf.h>
#include <unistd.h>

#ifndef __NR_bpf
# if defined(__i386__)
# define __NR_bpf 357
# elif defined(__x86_64__)
# define __NR_bpf 321
# elif defined(__aarch64__)
# define __NR_bpf 280
# error __NR_bpf not defined. libbpf does not support your arch.
# endif
#endif

int main(void)
{
union bpf_attr attr;

/* Check fields in attr */
attr.prog_type = BPF_PROG_TYPE_KPROBE;
attr.insn_cnt = 0;
attr.insns = 0;
Expand All @@ -14,5 +28,9 @@ int main(void)
attr.kern_version = 0;

attr = attr;
return 0;
/*
* Test existence of __NR_bpf and BPF_PROG_LOAD.
* This call should fail if we run the testcase.
*/
return syscall(__NR_bpf, BPF_PROG_LOAD, attr, sizeof(attr));
}
18 changes: 9 additions & 9 deletions tools/lib/bpf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ BPF_EXTRAVERSION = 1

MAKEFLAGS += --no-print-directory

ifeq ($(srctree),)
srctree := $(patsubst %/,%,$(dir $(shell pwd)))
srctree := $(patsubst %/,%,$(dir $(srctree)))
srctree := $(patsubst %/,%,$(dir $(srctree)))
#$(info Determined 'srctree' to be $(srctree))
endif

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

LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
include $(srctree)/tools/scripts/Makefile.arch

ifeq ($(LP64), 1)
libdir_relative = lib64
else
Expand All @@ -57,13 +64,6 @@ ifndef VERBOSE
VERBOSE = 0
endif

ifeq ($(srctree),)
srctree := $(patsubst %/,%,$(dir $(shell pwd)))
srctree := $(patsubst %/,%,$(dir $(srctree)))
srctree := $(patsubst %/,%,$(dir $(srctree)))
#$(info Determined 'srctree' to be $(srctree))
endif

FEATURE_USER = .libbpf
FEATURE_TESTS = libelf libelf-getphdrnum libelf-mmap bpf
FEATURE_DISPLAY = libelf bpf
Expand Down Expand Up @@ -192,7 +192,7 @@ config-clean:
$(Q)$(MAKE) -C $(srctree)/tools/build/feature/ clean >/dev/null

clean:
$(call QUIET_CLEAN, libbpf) $(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d \
$(call QUIET_CLEAN, libbpf) $(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd \
$(RM) LIBBPF-CFLAGS
$(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf

Expand Down
4 changes: 2 additions & 2 deletions tools/lib/bpf/bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include "bpf.h"

/*
* When building perf, unistd.h is override. Define __NR_bpf is
* required to be defined.
* When building perf, unistd.h is overrided. __NR_bpf is
* required to be defined explicitly.
*/
#ifndef __NR_bpf
# if defined(__i386__)
Expand Down
2 changes: 1 addition & 1 deletion tools/lib/lockdep/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ install_lib: all_cmd
install: install_lib

clean:
$(RM) *.o *~ $(TARGETS) *.a *liblockdep*.so* $(VERSION_FILES) .*.d
$(RM) *.o *~ $(TARGETS) *.a *liblockdep*.so* $(VERSION_FILES) .*.d .*.cmd
$(RM) tags TAGS

PHONY += force
Expand Down
2 changes: 2 additions & 0 deletions tools/perf/MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ tools/lib/string.c
tools/lib/symbol/kallsyms.c
tools/lib/symbol/kallsyms.h
tools/lib/find_bit.c
tools/lib/bitmap.c
tools/include/asm/atomic.h
tools/include/asm/barrier.h
tools/include/asm/bug.h
Expand Down Expand Up @@ -57,6 +58,7 @@ tools/include/linux/rbtree_augmented.h
tools/include/linux/string.h
tools/include/linux/types.h
tools/include/linux/err.h
tools/include/linux/bitmap.h
include/asm-generic/bitops/arch_hweight.h
include/asm-generic/bitops/const_hweight.h
include/asm-generic/bitops/fls64.h
Expand Down
4 changes: 2 additions & 2 deletions tools/perf/config/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected)

CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)

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

$(call detected_var,ARCH)

Expand Down Expand Up @@ -493,7 +493,7 @@ else

PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS))
PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)

Expand Down
5 changes: 0 additions & 5 deletions tools/perf/tests/hists_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ struct machine *setup_fake_machine(struct machines *machines)
return NULL;
}

if (machine__create_kernel_maps(machine)) {
pr_debug("Cannot create kernel maps\n");
return NULL;
}

for (i = 0; i < ARRAY_SIZE(fake_threads); i++) {
struct thread *thread;

Expand Down
1 change: 1 addition & 0 deletions tools/perf/tests/hists_cumulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,7 @@ int test__hists_cumulate(int subtest __maybe_unused)
err = parse_events(evlist, "cpu-clock", NULL);
if (err)
goto out;
err = TEST_FAIL;

machines__init(&machines);

Expand Down
1 change: 1 addition & 0 deletions tools/perf/tests/hists_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ int test__hists_filter(int subtest __maybe_unused)
err = parse_events(evlist, "task-clock", NULL);
if (err)
goto out;
err = TEST_FAIL;

/* default sort order (comm,dso,sym) will be used */
if (setup_sorting(NULL) < 0)
Expand Down
1 change: 1 addition & 0 deletions tools/perf/tests/hists_link.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ int test__hists_link(int subtest __maybe_unused)
if (err)
goto out;

err = TEST_FAIL;
/* default sort order (comm,dso,sym) will be used */
if (setup_sorting(NULL) < 0)
goto out;
Expand Down
1 change: 1 addition & 0 deletions tools/perf/tests/hists_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ int test__hists_output(int subtest __maybe_unused)
err = parse_events(evlist, "cpu-clock", NULL);
if (err)
goto out;
err = TEST_FAIL;

machines__init(&machines);

Expand Down
18 changes: 16 additions & 2 deletions tools/perf/tests/make
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include ../scripts/Makefile.include

ifndef MK
ifeq ($(MAKECMDGOALS),)
# no target specified, trigger the whole suite
Expand All @@ -12,7 +14,19 @@ endif
else
PERF := .

include config/Makefile.arch
# As per kernel Makefile, avoid funny character set dependencies
unexport LC_ALL
LC_COLLATE=C
LC_NUMERIC=C
export LC_COLLATE LC_NUMERIC

ifeq ($(srctree),)
srctree := $(patsubst %/,%,$(dir $(shell pwd)))
srctree := $(patsubst %/,%,$(dir $(srctree)))
#$(info Determined 'srctree' to be $(srctree))
endif

include $(srctree)/tools/scripts/Makefile.arch

# FIXME looks like x86 is the only arch running tests ;-)
# we need some IS_(32/64) flag to make this generic
Expand Down Expand Up @@ -280,5 +294,5 @@ all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools
out: $(run_O)
@echo OK

.PHONY: all $(run) $(run_O) tarpkg clean
.PHONY: all $(run) $(run_O) tarpkg clean make_kernelsrc make_kernelsrc_tools
endif # ifndef MK
File renamed without changes.

0 comments on commit 0bd106d

Please sign in to comment.