From patchwork Wed Apr 20 18:01:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 66231 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2594876qge; Wed, 20 Apr 2016 11:02:30 -0700 (PDT) X-Received: by 10.98.69.1 with SMTP id s1mr14133473pfa.56.1461175349917; Wed, 20 Apr 2016 11:02:29 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h186si3218116pfb.59.2016.04.20.11.02.29; Wed, 20 Apr 2016 11:02:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752241AbcDTSC2 (ORCPT + 29 others); Wed, 20 Apr 2016 14:02:28 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:50742 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751902AbcDTSC0 (ORCPT ); Wed, 20 Apr 2016 14:02:26 -0400 Received: from 172.24.1.48 (EHLO szxeml430-hub.china.huawei.com) ([172.24.1.48]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DJE14997; Thu, 21 Apr 2016 02:02:08 +0800 (CST) Received: from linux-4hy3.site (10.107.193.248) by szxeml430-hub.china.huawei.com (10.82.67.185) with Microsoft SMTP Server id 14.3.235.1; Thu, 21 Apr 2016 02:02:01 +0800 From: Wang Nan To: , , CC: , , Wang Nan , Arnaldo Carvalho de Melo , "Alexei Starovoitov" , Jiri Olsa , Li Zefan Subject: [RFC PATCH 02/13] tools: Add ubpf feature test Date: Wed, 20 Apr 2016 18:01:42 +0000 Message-ID: <1461175313-38310-3-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1461175313-38310-1-git-send-email-wangnan0@huawei.com> References: <1461175313-38310-1-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.107.193.248] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.5717C421.0042, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 030f8840440c565492d0f5fa28dadb2b Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: Arnaldo Carvalho de Melo Cc: Alexei Starovoitov Cc: Brendan Gregg Cc: Jiri Olsa Cc: Li Zefan --- 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 -- 1.8.3.4 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 +#include + +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)