lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9CC9D831-40A9-47E0-873A-99D9D19773DD@fb.com>
Date:   Fri, 4 Dec 2020 04:13:11 +0000
From:   Song Liu <songliubraving@...com>
To:     Jiri Olsa <jolsa@...hat.com>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Kernel Team <Kernel-team@...com>,
        "peterz@...radead.org" <peterz@...radead.org>,
        "mingo@...hat.com" <mingo@...hat.com>,
        "acme@...nel.org" <acme@...nel.org>,
        "mark.rutland@....com" <mark.rutland@....com>,
        "alexander.shishkin@...ux.intel.com" 
        <alexander.shishkin@...ux.intel.com>,
        "namhyung@...nel.org" <namhyung@...nel.org>
Subject: Re: [PATCH v1 1/2] perf: support build BPF skeletons with perf



> On Dec 3, 2020, at 3:31 PM, Jiri Olsa <jolsa@...hat.com> wrote:
> 
> On Wed, Dec 02, 2020 at 01:37:08AM -0800, Song Liu wrote:
>> BPF programs are useful in perf to profile BPF programs. BPF skeleton is
>> by far the easiest way to write BPF tools. Enable building BPF skeletons
>> in util/bpf_skel. A dummy bpf skeleton is added. More bpf skeletons will
>> be added for different use cases.
>> 
>> Signed-off-by: Song Liu <songliubraving@...com>
>> 
[...]
>> index 97cbfb31b7625..4eeeabbaa2947 100644
>> --- a/tools/build/Makefile.feature
>> +++ b/tools/build/Makefile.feature
>> @@ -99,7 +99,9 @@ FEATURE_TESTS_EXTRA :=                  \
>>          clang                          \
>>          libbpf                         \
>>          libpfm4                        \
>> -         libdebuginfod
>> +         libdebuginfod			\
>> +	 clang-bpf-co-re
> 
> do not use tabs in here

Will fix. 

> 
>> +
>> 
>> FEATURE_TESTS ?= $(FEATURE_TESTS_BASIC)
>> 
>> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
>> index ce8516e4de34f..c8ff82b4fc1b2 100644
>> --- a/tools/perf/Makefile.config
>> +++ b/tools/perf/Makefile.config
>> @@ -621,6 +621,16 @@ ifndef NO_LIBBPF
>>   endif
>> endif
>> 
>> +$(call feature_check,clang-bpf-co-re)
>> +ifeq ($(feature-clang-bpf-co-re), 0)
>> +  undefine BUILD_BPF_SKEL
> 
> we compile with 'make BUILD_BPF_SKEL=1' so we should fail here
> with the standard 'please install..' message we use

Yeah, that makes sense. Will fix it in the next version. 

> 
>> +endif
>> +
>> +ifdef BUILD_BPF_SKEL
>> +    $(call detected,CONFIG_PERF_BPF_SKEL)
>> +    CFLAGS += -DBUILD_BPF_SKEL
>> +endif
>> +
>> dwarf-post-unwind := 1
>> dwarf-post-unwind-text := BUG
>> 
>> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
>> index 7ce3f2e8b9c74..f46f0cd012b2d 100644
>> --- a/tools/perf/Makefile.perf
>> +++ b/tools/perf/Makefile.perf
>> @@ -126,6 +126,8 @@ include ../scripts/utilities.mak
>> #
>> # Define NO_LIBDEBUGINFOD if you do not want support debuginfod
>> #
>> +# Define BUILD_BPF_SKEL to enable BPF skeletons
>> +#
>> 
>> # As per kernel Makefile, avoid funny character set dependencies
>> unexport LC_ALL
>> @@ -178,6 +180,8 @@ LD += $(EXTRA_LDFLAGS)
>> HOSTCC  ?= gcc
>> HOSTLD  ?= ld
>> HOSTAR  ?= ar
>> +CLANG ?= clang
> 
> please keep the indent with other ?= when possible

Will fix. 
> 
>> +LLVM_STRIP ?= llvm-strip
>> 
>> PKG_CONFIG = $(CROSS_COMPILE)pkg-config
>> LLVM_CONFIG ?= llvm-config
>> @@ -735,7 +739,8 @@ prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders $(drm_ioc
>> 	$(x86_arch_prctl_code_array) \
>> 	$(rename_flags_array) \
>> 	$(arch_errno_name_array) \
>> -	$(sync_file_range_arrays)
>> +	$(sync_file_range_arrays) \
>> +	bpf-skel
>> 
>> $(OUTPUT)%.o: %.c prepare FORCE
>> 	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
>> @@ -1008,7 +1013,44 @@ config-clean:
>> python-clean:
>> 	$(python-clean)
>> 
>> -clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBPERF)-clean config-clean fixdep-clean python-clean
>> +SKEL_OUT := $(abspath util/bpf_skel)
>> +SKEL_TMP_OUT := $(abspath util/bpf_skel/.tmp)
> 
> hum, actualy we use $(OUTPUT) and if it's not defined we build
> directly in the tree, this should follow the same

Good catch! I tested with OUTPUT in earlier version, missed it 
later on. Will fix it in the next version. 

>> +SKELETONS := $(SKEL_OUT)/dummy.skel.h
>> +
>> +ifdef BUILD_BPF_SKEL
>> +BPFTOOL := $(SKEL_TMP_OUT)/bpftool-bootstrap
>> +LIBBPF_SRC := $(abspath ../lib/bpf)
>> +BPF_INCLUDE := -I$(SKEL_TMP_OUT)/..
>> +submake_extras := feature_display=0
> 
> there's no need for the variable, is there?
> also why do we want to hide it?

I guess no need to hide it. I copied this pattern from bpftool. 
Let me remove it in v2. 

Thanks,
Song

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ