From: Wang Nan <wangnan0@huawei.com>
To: <acme@kernel.org>, <jolsa@redhat.com>, <brendan.d.gregg@gmail.com>
Cc: <linux-kernel@vger.kernel.org>, <pi3orama@163.com>,
Wang Nan <wangnan0@huawei.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
"Alexei Starovoitov" <ast@kernel.org>,
Jiri Olsa <jolsa@kernel.org>, Li Zefan <lizefan@huawei.com>
Subject: [RFC PATCH 03/13] bpf tools: Add ubpf include and makefile options
Date: Wed, 20 Apr 2016 18:01:43 +0000 [thread overview]
Message-ID: <1461175313-38310-4-git-send-email-wangnan0@huawei.com> (raw)
In-Reply-To: <1461175313-38310-1-git-send-email-wangnan0@huawei.com>
Prepare to use libubpf. Add ubpf.h into libbpf.c. Add corresponding
makefile options.
Allow ignoring UBPF when building libbpf by setting NO_UBPF=1 for
libbpf building.
Allow perf controling ubpf using NO_UBPF=1.
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/lib/bpf/Makefile | 16 ++++++++++++++--
tools/lib/bpf/libbpf.c | 3 +++
tools/perf/Makefile.perf | 2 ++
tools/perf/config/Makefile | 7 +++++++
4 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 8dfa512..6944d02 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -64,9 +64,17 @@ ifndef VERBOSE
VERBOSE = 0
endif
+ifndef NO_UBPF
+ FEATURE_UBPF := ubpf
+ CFLAGS_UBPF := -DHAVE_UBPF_SUPPORT
+else
+ FEATURE_UBPF :=
+ CFLAGS_UBPF :=
+endif
+
FEATURE_USER = .libbpf
-FEATURE_TESTS = libelf libelf-getphdrnum libelf-mmap bpf ubpf
-FEATURE_DISPLAY = libelf bpf ubpf
+FEATURE_TESTS = libelf libelf-getphdrnum libelf-mmap bpf $(FEATURE_UBPF)
+FEATURE_DISPLAY = libelf bpf $(FEATURE_UBPF)
INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/arch/$(ARCH)/include/uapi -I$(srctree)/include/uapi
FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES)
@@ -120,6 +128,10 @@ ifeq ($(feature-libelf-getphdrnum), 1)
override CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT
endif
+ifeq ($(feature-ubpf), 1)
+ override CFLAGS += $(CFLAGS_UBPF)
+endif
+
# Append required CFLAGS
override CFLAGS += $(EXTRA_WARNINGS)
override CFLAGS += -Werror -Wall
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 7e543c3..55b739e 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -21,6 +21,9 @@
#include <libelf.h>
#include <gelf.h>
+#ifdef HAVE_UBPF_SUPPORT
+# include <ubpf.h>
+#endif
#include "libbpf.h"
#include "bpf.h"
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index bde8cba..5334e29 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -81,6 +81,8 @@ include ../scripts/utilities.mak
#
# Define NO_LIBBPF if you do not want BPF support
#
+# Define NO_UBPF if you do not want user space BPF support
+#
# Define FEATURES_DUMP to provide features detection dump file
# and bypass the feature detection
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 1e46277..89d0470 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -315,6 +315,13 @@ ifndef NO_LIBELF
ifeq ($(feature-bpf), 1)
CFLAGS += -DHAVE_LIBBPF_SUPPORT
$(call detected,CONFIG_LIBBPF)
+ ifndef NO_UBPF
+ ifeq ($(feature-ubpf), 1)
+ CFLAGS += -DHAVE_UBPF_SUPPORT
+ EXTLIBS += -lubpf
+ $(call detected,CONFIG_UBPF)
+ endif
+ endif
endif
ifndef NO_DWARF
--
1.8.3.4
next prev parent reply other threads:[~2016-04-20 18:02 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-20 18:01 [RFC PATCH 00/13] perf tools: Support uBPF script Wang Nan
2016-04-20 18:01 ` [RFC PATCH 01/13] bpf tools: Add map related BPF helper Wang Nan
2016-04-20 18:01 ` [RFC PATCH 02/13] tools: Add ubpf feature test Wang Nan
2016-04-20 19:11 ` Arnaldo Carvalho de Melo
2016-04-20 18:01 ` Wang Nan [this message]
2016-04-20 18:01 ` [RFC PATCH 04/13] bpf tools: Replace fd array to union array Wang Nan
2016-04-20 19:20 ` Arnaldo Carvalho de Melo
2016-04-20 18:01 ` [RFC PATCH 05/13] bpf tools: Save engine type in bpf_program Wang Nan
2016-04-20 19:23 ` Arnaldo Carvalho de Melo
2016-04-20 19:29 ` pi3orama
2016-04-20 18:01 ` [RFC PATCH 06/13] bpf tools: Introduce ubpf_vm to program instance union Wang Nan
2016-04-20 19:30 ` Arnaldo Carvalho de Melo
2016-04-20 18:01 ` [RFC PATCH 07/13] bpf tools: Load ubpf program Wang Nan
2016-04-20 19:34 ` Arnaldo Carvalho de Melo
2016-04-20 18:01 ` [RFC PATCH 08/13] bpf tools: Add API for fetching ubpf_vm Wang Nan
2016-04-20 18:01 ` [RFC PATCH 09/13] bpf tools: Register extern functions for ubpf programs Wang Nan
2016-04-20 18:01 ` [RFC PATCH 10/13] perf tools: Register basic UBPF helpers Wang Nan
2016-04-20 18:01 ` [RFC PATCH 11/13] perf bpf: Accept ubpf programs Wang Nan
2016-04-20 18:01 ` [RFC PATCH 12/13] perf record: Add UBPF hooks at beginning and end of perf record Wang Nan
2016-04-20 18:01 ` [RFC PATCH 13/13] perf tests: Add UBPF test case Wang Nan
2016-04-20 22:06 ` [RFC PATCH 00/13] perf tools: Support uBPF script Alexei Starovoitov
2016-04-21 8:17 ` Wangnan (F)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1461175313-38310-4-git-send-email-wangnan0@huawei.com \
--to=wangnan0@huawei.com \
--cc=acme@kernel.org \
--cc=acme@redhat.com \
--cc=ast@kernel.org \
--cc=brendan.d.gregg@gmail.com \
--cc=jolsa@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=pi3orama@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®