Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753261AbbH2ApL (ORCPT ); Fri, 28 Aug 2015 20:45:11 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:33856 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752899AbbH2ApJ (ORCPT ); Fri, 28 Aug 2015 20:45:09 -0400 Subject: Re: [PATCH 32/32] bpf: Introduce function for outputing data to perf event To: Wang Nan , acme@redhat.com References: <1440745570-150857-1-git-send-email-wangnan0@huawei.com> <1440745570-150857-33-git-send-email-wangnan0@huawei.com> Cc: brendan.d.gregg@gmail.com, daniel@iogearbox.net, dsahern@gmail.com, hekuang@huawei.com, jolsa@kernel.org, xiakaixu@huawei.com, masami.hiramatsu.pt@hitachi.com, namhyung@kernel.org, a.p.zijlstra@chello.nl, lizefan@huawei.com, pi3orama@163.com, linux-kernel@vger.kernel.org, Arnaldo Carvalho de Melo , Ingo Molnar , Steven Rostedt From: Alexei Starovoitov Message-ID: <55E10091.6020107@plumgrid.com> Date: Fri, 28 Aug 2015 17:45:05 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <1440745570-150857-33-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: 1704 Lines: 42 On 8/28/15 12:06 AM, Wang Nan wrote: > his patch adds a new trace event to establish infrastruction for bpf to > output data to perf. Userspace perf tools can detect and use this event > as using the existing tracepoint events. > > New bpf trace event entry in debugfs: > > /sys/kernel/debug/tracing/events/bpf/bpf_output_data > > Userspace perf tools detect the new tracepoint event as: > > bpf:bpf_output_data [Tracepoint event] > > Data in ring-buffer of perf events added to this event will be polled > out, sample types and other attributes can be adjusted to those events > directly without touching the original kprobe events. Wang, I have 2nd thoughts on this. I've played with it, but global bpf:bpf_output_data event is limiting. I'd like to use this bpf_output_trace_data() helper for tcp estats gathering, but global collector will prevent other similar bpf programs running in parallel. So as a concept I think it's very useful, but we need a way to select which ring-buffer to output data to. proposal A: Can we use ftrace:instances concept and make bpf_output_trace_data() into that particular trace_pipe ? proposal B: bpf_perf_event_read() model is using nice concept of an array of perf_events. Can we perf_event_open a 'new' event that can be mmaped in user space and bpf_output_trace_data(idx, buf, buf_size) into it. Where 'idx' will be an index of FD from perf_even_open of such new event? 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/