Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752894AbbFZWoZ (ORCPT ); Fri, 26 Jun 2015 18:44:25 -0400 Received: from mail-wg0-f51.google.com ([74.125.82.51]:33152 "EHLO mail-wg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752568AbbFZWoV (ORCPT ); Fri, 26 Jun 2015 18:44:21 -0400 Message-ID: <558DD5C2.7010303@plumgrid.com> Date: Fri, 26 Jun 2015 15:44:18 -0700 From: Alexei Starovoitov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Wang Nan , acme@kernel.org, brendan.d.gregg@gmail.com, daniel@iogearbox.net, namhyung@kernel.org, masami.hiramatsu.pt@hitachi.com, paulus@samba.org, a.p.zijlstra@chello.nl, mingo@redhat.com, jolsa@kernel.org, dsahern@gmail.com CC: linux-kernel@vger.kernel.org, lizefan@huawei.com, hekuang@huawei.com, xiakaixu@huawei.com, pi3orama@163.com Subject: Re: [RFC PATCH v9 00/50] perf tools: filtering events using eBPF programs References: <1435328155-87115-1-git-send-email-wangnan0@huawei.com> In-Reply-To: <1435328155-87115-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: 3138 Lines: 89 On 6/26/15 7:15 AM, Wang Nan wrote: > This is the 9th version which tries to introduce eBPF programs to perf. > > This patchset combined with 2 patchset I posted: > > 1. V8 of 'perf tools: filtering events using eBPF programs'; > > 2. 'tracing, perf tools: Attach BPF program on uprobe events' > > And patch 'tracing, perf: Implement BPF programs attached to uprobes' is > promoted to 1/50 since it belongs to kernel. > > As Alexei's suggestion, I squashed some patches together in order to > make patchset simpler. The affected patches including: > > Patch 19/50: merged with 'bpf tools: Load instructions buffer using load_program()'; > Patch 35/50: merged with 'perf tools: Generate prologue for BPF programs'. > > In this version I corrected many coding style problems found by > checkpatch.pl. Most of them are minor change except patch 45/50, which > checkpatch doesn't allow me to use goto statement in a macro, so I have > to redesign error processing when prologue too long. > > Other changes including: > > 1. Correct compiling problem when CONFIG_BPF_PROLOGUE not set; > > 2. Config options for each BPF program is changed to 'key=value' from > 'key:value'; > > 3. Improve error message when config string error (Patch 50/50). > > The 50 patches can be divided into following groups: > > 1. Patch 1/50 belog to kernel, which has been accepted by Alexei. > > 2. Patch 2/50 - 38/50 add basic BPF support to perf, which is from my > v7 patch, only style correction and patch squashing is take place > in this version. > > 3. Patch 39/50 - 48/50 add BPF prologue support which allow BPF programs > to read kernel data. > > 4. Patch 49/50 - 50/50 are perf side code which allow attach BPF programs > on uprobe event. > > To demonstrate the feature of the new patchset, I attach a sample eBPF > program below. This program can be used to analysis some fprintf, > tracing the userspace call and related kernel actions. Note that in > kernal event selector, we are allowed to use glob matching to match vfs_write > and vfs_writev together. For both of them we are allowed to check a internal > field of 'struct file'. > > SEC( > "target=/lib64/libc.so.6\n" > "libcprintf=_IO_vfprintf_internal" > ) > int libcprintf(void *ctx) > { > char fmt[] = "libc printf\n"; > bpf_trace_printk(fmt, sizeof(fmt)); > return 1; > } > > SEC("syswrite=vfs_write* file->f_mode") > int vfswrite(void *ctx, int err, unsigned long f_mode) > { > char fmt[] = "vfs_write, f_mode=%lx\n"; > bpf_trace_printk(fmt, sizeof(fmt), f_mode); > > if (f_mode & FMODE_READ) > return 1; > return 0; > } looks great. Thank you for addressing comments so quickly. Pushed it to my tree to get buildbot coverage. It still should go via Arnaldo's tree when he has cycles to take a look at it. What do you plan to develop next? 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/