Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752244AbbFZIiE (ORCPT ); Fri, 26 Jun 2015 04:38:04 -0400 Received: from mail-wi0-f179.google.com ([209.85.212.179]:36130 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751721AbbFZIhz (ORCPT ); Fri, 26 Jun 2015 04:37:55 -0400 Message-ID: <558D0F5F.2000700@plumgrid.com> Date: Fri, 26 Jun 2015 01:37:51 -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 v8 00/49] perf tools: filtering events using eBPF programs References: <1435149113-51142-1-git-send-email-wangnan0@huawei.com> In-Reply-To: <1435149113-51142-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: 1407 Lines: 33 On 6/24/15 5:31 AM, Wang Nan wrote: > The core stuffs in this series resides in 38/49 - 49/49, which allow > users to access kernel data through parameters of eBPF programs. Now > it is possible to write eBPF programs like this: > > SEC("get_superblock=journal_get_superblock journal->j_errno") > int get_superblock(struct pt_regs *ctx, int err, int j_errno) > { > char fmt[] = "j_errno=%lx\n"; > bpf_trace_printk(fmt, sizeof(fmt), j_errno); > if (j_errno) > return 1; > return 0; > } > > Where, 'j_errno' in that function will be dereferenced according to > dwarf information by prologue generated by perf. 'err' indicates the > successfulness of the dereferencing. Looks great. Very useful addition. > In addition, this series of patches supports setting BPF program to > multiple probing points and generate different prologue for all of them > if necessary. Using glob matching is also allowed. In the above > example, there will be two journal_get_superblock() functions in kernel > if we compile both jbd and jbd2. That BPF function tracks both of them. Sounds ok, but what is the real use case for it? -- 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/