Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757813AbbFAGEt (ORCPT ); Mon, 1 Jun 2015 02:04:49 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:35360 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750814AbbFAGEk (ORCPT ); Mon, 1 Jun 2015 02:04:40 -0400 Date: Mon, 1 Jun 2015 15:03:11 +0900 From: Namhyung Kim To: "Wangnan (F)" Cc: Alexei Starovoitov , paulus@samba.org, a.p.zijlstra@chello.nl, mingo@redhat.com, acme@kernel.org, jolsa@kernel.org, dsahern@gmail.com, daniel@iogearbox.net, brendan.d.gregg@gmail.com, masami.hiramatsu.pt@hitachi.com, lizefan@huawei.com, linux-kernel@vger.kernel.org, pi3orama@163.com, xiakaixu 00238161 Subject: Re: [RFC PATCH v4 10/29] bpf tools: Collect map definitions from 'maps' section Message-ID: <20150601060311.GB22455@danjae> References: <1432704004-171454-11-git-send-email-wangnan0@huawei.com> <20150528015307.GE20764@Alexeis-MacBook-Pro.local> <55667758.1070206@huawei.com> <20150528022833.GI20764@Alexeis-MacBook-Pro.local> <556686FE.105@huawei.com> <20150528060957.GA21013@Alexeis-MBP.westell.com> <5566C064.6020205@huawei.com> <20150529033518.GA21616@Alexeis-MacBook-Pro.local> <20150601021251.GA14501@danjae> <556BEB54.2080509@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <556BEB54.2080509@huawei.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2865 Lines: 65 On Mon, Jun 01, 2015 at 01:19:16PM +0800, Wangnan (F) wrote: > > > On 2015/6/1 10:12, Namhyung Kim wrote: > >Hi Alexei and Wang, > > > >On Thu, May 28, 2015 at 08:35:19PM -0700, Alexei Starovoitov wrote: > >>On Thu, May 28, 2015 at 03:14:44PM +0800, Wangnan (F) wrote: > >>>On 2015/5/28 14:09, Alexei Starovoitov wrote: > >>As far as 'bpf_store_value' goes... I was thinking to expose perf ring_buffer > >>to bpf programs, so that program can stream any data to perf that receives > >>it via mmap. Then you don't need this '$outdata' hack. > >Then we need to define and pass the format of such data so that perf > >tools can read and process the data. IIRC Masami suggested to have an > >additional user event type for inserting/injecting non-perf events - > >like PERF_RECORD_USER_DEFINED_TYPE? And its contents is something > >similar to tracepoint event format file so that we can reuse existing > >code to parse the event definition. > > Is it possible to expose such format through > /sys/kernel/debug/tracing/events/*/*/format > so we can avoid extra work on perf side and make it accessable by both perf > and ftrace? No, I mean export such format through an event in perf.data file. It still needs extra work on perf-tools side. But by using user-defined event types, there should be no kernel-side work. Above is just a suggestion how to deal with external data/events in perf. But I'm seeing many people want such feature so we need a way to handle it anyway. ;-) > > Currently we do this by opening an internal PMU and adding a common > field in trace_define_common_fields(). By reading that PMU in > tracing_generic_entry_update() we are able to collect its value by both perf > and ftrace, both > kprobe events and tracepoints (the implementation is ugly. We have to > hardwire the > PMU because alerting common field dynamically is hard. If we want to trace > multiple PMUs then > recompiling is required). In serval usecase, we found that using ftrace > should be better > because the cost of perf is higher. > > Although currently BPF programs can only get executed if it traced by perf, > I think we can > extend it to ftrace (but not sure how to do it now...). > > Currently I'm still working on perf bpf stuffs. I think it has almost done. > The next step > should be solving arguments passing problem. After that we should enable > eBPF programs to > read hardware PMU. Outputting should be the final step. I'm glad to see many > people are > thinking on it. Please keep me in the loop if you have any new idea on this > area. Sure thing. I really thank you to do this work! Namhyung -- 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/