Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753324AbbEAEhL (ORCPT ); Fri, 1 May 2015 00:37:11 -0400 Received: from mail-ie0-f169.google.com ([209.85.223.169]:34267 "EHLO mail-ie0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751218AbbEAEhJ (ORCPT ); Fri, 1 May 2015 00:37:09 -0400 Message-ID: <554302F0.3070101@plumgrid.com> Date: Thu, 30 Apr 2015 21:37:04 -0700 From: Alexei Starovoitov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Wang Nan , davem@davemloft.net, acme@kernel.org, mingo@redhat.com, a.p.zijlstra@chello.nl, masami.hiramatsu.pt@hitachi.com, jolsa@kernel.org CC: lizefan@kernel.org, linux-kernel@vger.kernel.org, pi3orama@163.com, hekuang@huawei.com, bgregg@netflix.com Subject: Re: [RFC PATCH 00/22] perf tools: introduce 'perf bpf' command to load eBPF programs. References: <1430391165-30267-1-git-send-email-wangnan0@huawei.com> In-Reply-To: <1430391165-30267-1-git-send-email-wangnan0@huawei.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3287 Lines: 83 On 4/30/15 3:52 AM, Wang Nan wrote: > This series of patches is an approach to integrate eBPF with perf. > After applying these patches, users are allowed to use following > command to load eBPF program compiled by LLVM into kernel: > > $ perf bpf sample_bpf.o > > The required BPF code and the loading procedure is similar to Alexei > Starovoitov's libbpf in sample/bpf, with following exceptions: > > 1. The section name are not required leading with 'kprobe/' or > 'kretprobe/'. Without such leading, any valid C var name can be use. > > 2. A 'config' section can be provided to describe the position and > arguments of a program. Syntax is identical to 'perf probe'. > > An example is pasted at the bottom of this cover letter. In that > example, mybpfprog is configured by string in config section, and will > be probed at __alloc_pages_nodemask. sample_bpf.o is generated using: > > $ $CLANG -I/usr/src/kernel/include -I/usr/src/kernel/usr/include -D__KERNEL__ \ > -Wno-unused-value -Wno-pointer-sign \ > -O2 -emit-llvm -c sample_bpf.c -o -| $LLC -march=bpf -filetype=obj -o \ > sample_bpf.o > > And can be loaded using: > > $ perf bpf sample_bpf.o > > This series is only a limited functional. Following works are on the > todo list: > > 1. Unprobe kprobe stubs used by eBPF programs when unloading; > > 2. Enable eBPF programs to access local variables and arguments > by utilizing debuginfo; > > 3. Output data in perf way. > > In this series: > > Patch 1/22 is a bugfix in perf probe, and may be triggered by following > patches; > > Patch 2-3/22 are preparation, add required macros and syscall > definition into perf source tree. > > Patch 4/22 add 'perf bpf' command. > > Patch 5-20/22 are labor works, which parse the ELF object file, collect > information in object files, create maps needed by programs, link map > and programs, config programs and load programs into kernel. > > Patch 21-22/22 are the final work. Patch 21 creates kprobe points which > will be used by eBPF programs, patch 22 creates perf file descriptors > then attach eBPF programs on them. I'm very happy to see this work. Looks great. All patches are impressively clean and concise. I think patches 1-3 are ready to go into Arnaldo's perf tree right now. 4 and above are clean and polished, but probably need to go into some 'staging area' like a branch of perf tree, since I suspect the user interface may change a little in the coming months and it's a bit too early to expose 'perf bpf' command to every perf user ? Arnaldo, Ingo, what do you guys think should be the arrangement? 'perf/bpf' branch in acme/linux.git or in tip/tip.git ? I have few comments for patches 18 and 19, but let's figure out the long term plan first. We're also working in parallel on creating a new tracing language that together with llvm backend can be used as a single shared library that can be called from perf or anything else. Then clang compilation step will be gone and programs can be run as 'perf bpf file.bpf'. Thanks! -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/