Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1383614 > unrolled thread

[RFC PATCH 02/13] tools: Add ubpf feature test

Started byWang Nan <wangnan0@huawei.com>
First post2016-04-20 20:10 +0200
Last post2016-04-20 21:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [RFC PATCH 02/13] tools: Add ubpf feature test Wang Nan <wangnan0@huawei.com> - 2016-04-20 20:10 +0200
    Re: [RFC PATCH 02/13] tools: Add ubpf feature test Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-20 21:20 +0200

#1383614 — [RFC PATCH 02/13] tools: Add ubpf feature test

FromWang Nan <wangnan0@huawei.com>
Date2016-04-20 20:10 +0200
Subject[RFC PATCH 02/13] tools: Add ubpf feature test
Message-ID<rq4JC-3Ai-45@gated-at.bofh.it>
Add test-ubpf.c to find libubpf, which can be found from [1].

ubpf is user space BPF engine. Following commits will utilize ubpf
to make perf dynamically run some profiling scripts in user space.

[1] https://github.com/iovisor/ubpf.git

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Li Zefan <lizefan@huawei.com>
---
 tools/build/Makefile.feature    |  6 ++++--
 tools/build/feature/Makefile    |  6 +++++-
 tools/build/feature/test-ubpf.c | 11 +++++++++++
 tools/lib/bpf/Makefile          |  4 ++--
 4 files changed, 22 insertions(+), 5 deletions(-)
 create mode 100644 tools/build/feature/test-ubpf.c

diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index 9f87861..eb84b6a 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -56,7 +56,8 @@ FEATURE_TESTS_BASIC :=			\
 	zlib				\
 	lzma				\
 	get_cpuid			\
-	bpf
+	bpf				\
+	ubpf
 
 # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
 # of all feature tests
@@ -96,7 +97,8 @@ FEATURE_DISPLAY ?=			\
 	zlib				\
 	lzma				\
 	get_cpuid			\
-	bpf
+	bpf				\
+	ubpf
 
 # 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
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 4ae94db..7480e0f 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -37,7 +37,8 @@ FILES=					\
 	test-zlib.bin			\
 	test-lzma.bin			\
 	test-bpf.bin			\
-	test-get_cpuid.bin
+	test-get_cpuid.bin		\
+	test-ubpf.bin
 
 FILES := $(addprefix $(OUTPUT),$(FILES))
 
@@ -182,6 +183,9 @@ $(OUTPUT)test-get_cpuid.bin:
 $(OUTPUT)test-bpf.bin:
 	$(BUILD)
 
+$(OUTPUT)test-ubpf.bin:
+	$(BUILD) -lubpf
+
 -include $(OUTPUT)*.d
 
 ###############################
diff --git a/tools/build/feature/test-ubpf.c b/tools/build/feature/test-ubpf.c
new file mode 100644
index 0000000..3c0a257
--- /dev/null
+++ b/tools/build/feature/test-ubpf.c
@@ -0,0 +1,11 @@
+#include <stdlib.h>
+#include <ubpf.h>
+
+int main(void)
+{
+	struct ubpf_vm *vm;
+
+	vm = ubpf_create();
+	ubpf_destroy(vm);
+	return 0;
+}
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index fc1bc75..8dfa512 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -65,8 +65,8 @@ ifndef VERBOSE
 endif
 
 FEATURE_USER = .libbpf
-FEATURE_TESTS = libelf libelf-getphdrnum libelf-mmap bpf
-FEATURE_DISPLAY = libelf bpf
+FEATURE_TESTS = libelf libelf-getphdrnum libelf-mmap bpf ubpf
+FEATURE_DISPLAY = libelf bpf ubpf
 
 INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/arch/$(ARCH)/include/uapi -I$(srctree)/include/uapi
 FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES)
-- 
1.8.3.4

[toc] | [next] | [standalone]


#1383656

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2016-04-20 21:20 +0200
Message-ID<rq5Pk-4mv-15@gated-at.bofh.it>
In reply to#1383614
Em Wed, Apr 20, 2016 at 06:01:42PM +0000, Wang Nan escreveu:
> Add test-ubpf.c to find libubpf, which can be found from [1].
> 
> ubpf is user space BPF engine. Following commits will utilize ubpf
> to make perf dynamically run some profiling scripts in user space.
> 
> [1] https://github.com/iovisor/ubpf.git

Ok, but the rule we've been following is that if a library is not generally
available in distros, we don't try to build it, because it will fail in almost
all cases, causing confusion and adding overhead to the build for no reason.

So, please make it behave like babeltrace, as described in the changeset below,
i.e. to build with UBPF, one will need to do:

  $ make UBPF=1

I'm applying the patches and testing, but will need the above to proceed wrt
pushing it upstream.

- Arnaldo

commit 6ab2b762befd192b90704c5c7898f5abf8ebb387
Author: Jiri Olsa <jolsa@redhat.com>
Date:   Sat Mar 28 11:30:30 2015 +0100

    perf build: Disable libbabeltrace check by default
    
    Disabling libbabeltrace check by default and replacing the
    NO_LIBBABELTRACE make variable with LIBBABELTRACE.
    
    Users wanting the libbabeltrace feature need to build via:
    
      $ make LIBBABELTRACE=1
    
    The reason for this is that the libababeltrace interface we use (version
    1.3) hasn't been packaged/released yet, thus the failing feature check
    only slows down build and confuses other (non CTF) developers.
    
    Requested-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Jiri Olsa <jolsa@kernel.org>
    Acked-by: Ingo Molnar <mingo@kernel.org>

 
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Alexei Starovoitov <ast@kernel.org>
> Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Li Zefan <lizefan@huawei.com>
> ---
>  tools/build/Makefile.feature    |  6 ++++--
>  tools/build/feature/Makefile    |  6 +++++-
>  tools/build/feature/test-ubpf.c | 11 +++++++++++
>  tools/lib/bpf/Makefile          |  4 ++--
>  4 files changed, 22 insertions(+), 5 deletions(-)
>  create mode 100644 tools/build/feature/test-ubpf.c
> 
> diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
> index 9f87861..eb84b6a 100644
> --- a/tools/build/Makefile.feature
> +++ b/tools/build/Makefile.feature
> @@ -56,7 +56,8 @@ FEATURE_TESTS_BASIC :=			\
>  	zlib				\
>  	lzma				\
>  	get_cpuid			\
> -	bpf
> +	bpf				\
> +	ubpf
>  
>  # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
>  # of all feature tests
> @@ -96,7 +97,8 @@ FEATURE_DISPLAY ?=			\
>  	zlib				\
>  	lzma				\
>  	get_cpuid			\
> -	bpf
> +	bpf				\
> +	ubpf
>  
>  # 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
> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> index 4ae94db..7480e0f 100644
> --- a/tools/build/feature/Makefile
> +++ b/tools/build/feature/Makefile
> @@ -37,7 +37,8 @@ FILES=					\
>  	test-zlib.bin			\
>  	test-lzma.bin			\
>  	test-bpf.bin			\
> -	test-get_cpuid.bin
> +	test-get_cpuid.bin		\
> +	test-ubpf.bin
>  
>  FILES := $(addprefix $(OUTPUT),$(FILES))
>  
> @@ -182,6 +183,9 @@ $(OUTPUT)test-get_cpuid.bin:
>  $(OUTPUT)test-bpf.bin:
>  	$(BUILD)
>  
> +$(OUTPUT)test-ubpf.bin:
> +	$(BUILD) -lubpf
> +
>  -include $(OUTPUT)*.d
>  
>  ###############################
> diff --git a/tools/build/feature/test-ubpf.c b/tools/build/feature/test-ubpf.c
> new file mode 100644
> index 0000000..3c0a257
> --- /dev/null
> +++ b/tools/build/feature/test-ubpf.c
> @@ -0,0 +1,11 @@
> +#include <stdlib.h>
> +#include <ubpf.h>
> +
> +int main(void)
> +{
> +	struct ubpf_vm *vm;
> +
> +	vm = ubpf_create();
> +	ubpf_destroy(vm);
> +	return 0;
> +}
> diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> index fc1bc75..8dfa512 100644
> --- a/tools/lib/bpf/Makefile
> +++ b/tools/lib/bpf/Makefile
> @@ -65,8 +65,8 @@ ifndef VERBOSE
>  endif
>  
>  FEATURE_USER = .libbpf
> -FEATURE_TESTS = libelf libelf-getphdrnum libelf-mmap bpf
> -FEATURE_DISPLAY = libelf bpf
> +FEATURE_TESTS = libelf libelf-getphdrnum libelf-mmap bpf ubpf
> +FEATURE_DISPLAY = libelf bpf ubpf
>  
>  INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/arch/$(ARCH)/include/uapi -I$(srctree)/include/uapi
>  FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES)
> -- 
> 1.8.3.4

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web