Re: [PATCH net-next 2/3] bpf: introduce bpf_perf_event_output() helper

2015-10-26 Thread Alexei Starovoitov
On 10/25/15 6:46 PM, Wangnan (F) wrote: Can we (or have we already) setup some rules for licensing? Which part should be GPL? Who has the response to decide it? in my mind the rules were set long ago. See my other email. -- To unsubscribe from this list: send the line "unsubscribe netdev" in

Re: [PATCH net-next 2/3] bpf: introduce bpf_perf_event_output() helper

2015-10-25 Thread Wangnan (F)
On 2015/10/24 1:25, Alexei Starovoitov wrote: On 10/23/15 9:42 AM, Peter Zijlstra wrote: On Fri, Oct 23, 2015 at 08:02:00AM -0700, Alexei Starovoitov wrote: On 10/23/15 7:39 AM, Peter Zijlstra wrote: On Tue, Oct 20, 2015 at 08:02:34PM -0700, Alexei Starovoitov wrote: +static const struct

Re: [PATCH net-next 2/3] bpf: introduce bpf_perf_event_output() helper

2015-10-23 Thread Peter Zijlstra
On Fri, Oct 23, 2015 at 08:02:00AM -0700, Alexei Starovoitov wrote: > On 10/23/15 7:39 AM, Peter Zijlstra wrote: > >On Tue, Oct 20, 2015 at 08:02:34PM -0700, Alexei Starovoitov wrote: > >>>+static const struct bpf_func_proto bpf_perf_event_output_proto = { > >>>+ .func =

Re: [PATCH net-next 2/3] bpf: introduce bpf_perf_event_output() helper

2015-10-23 Thread Alexei Starovoitov
On 10/23/15 9:42 AM, Peter Zijlstra wrote: On Fri, Oct 23, 2015 at 08:02:00AM -0700, Alexei Starovoitov wrote: On 10/23/15 7:39 AM, Peter Zijlstra wrote: On Tue, Oct 20, 2015 at 08:02:34PM -0700, Alexei Starovoitov wrote: +static const struct bpf_func_proto bpf_perf_event_output_proto = { +

Re: [PATCH net-next 2/3] bpf: introduce bpf_perf_event_output() helper

2015-10-23 Thread Alexei Starovoitov
On 10/23/15 7:39 AM, Peter Zijlstra wrote: On Tue, Oct 20, 2015 at 08:02:34PM -0700, Alexei Starovoitov wrote: >+static const struct bpf_func_proto bpf_perf_event_output_proto = { >+ .func = bpf_perf_event_output, >+ .gpl_only = false, Oh ? no particular reason. key

Re: [PATCH net-next 2/3] bpf: introduce bpf_perf_event_output() helper

2015-10-23 Thread Peter Zijlstra
On Tue, Oct 20, 2015 at 08:02:34PM -0700, Alexei Starovoitov wrote: > +static const struct bpf_func_proto bpf_perf_event_output_proto = { > + .func = bpf_perf_event_output, > + .gpl_only = false, Oh ? > + .ret_type = RET_INTEGER, > + .arg1_type =

Re: [PATCH net-next 2/3] bpf: introduce bpf_perf_event_output() helper

2015-10-22 Thread Peter Zijlstra
On Tue, Oct 20, 2015 at 08:02:34PM -0700, Alexei Starovoitov wrote: > +++ b/kernel/trace/bpf_trace.c > @@ -215,6 +215,50 @@ const struct bpf_func_proto bpf_perf_event_read_proto = { > .arg2_type = ARG_ANYTHING, > }; > > +static u64 bpf_perf_event_output(u64 r1, u64 r2, u64 index, u64

Re: [PATCH net-next 2/3] bpf: introduce bpf_perf_event_output() helper

2015-10-22 Thread Alexei Starovoitov
On 10/22/15 6:59 AM, Peter Zijlstra wrote: + if (unlikely(event->oncpu != smp_processor_id())) >+ return -EOPNOTSUPP; >+ >+ perf_sample_data_init(_data, 0, 0); >+ sample_data.raw = >+ perf_event_output(event, _data, regs); >+ return 0; >+} Note that this function also

Re: [PATCH net-next 2/3] bpf: introduce bpf_perf_event_output() helper

2015-10-21 Thread Alexei Starovoitov
On 10/21/15 5:06 AM, Peter Zijlstra wrote: PERF_COUNT_SW_DUMMY = 9, >+ PERF_COUNT_SW_BPF_OUTPUT= 10, > >PERF_COUNT_SW_MAX, /* non-ABI */ > }; Do you really need the new type? Can't you use DUMMY for this? It works fine

Re: [PATCH net-next 2/3] bpf: introduce bpf_perf_event_output() helper

2015-10-21 Thread Peter Zijlstra
On Wed, Oct 21, 2015 at 10:26:21AM -0700, Alexei Starovoitov wrote: > On 10/21/15 5:06 AM, Peter Zijlstra wrote: > >>PERF_COUNT_SW_DUMMY = 9, > >>>+ PERF_COUNT_SW_BPF_OUTPUT= 10, > >>> > >>> PERF_COUNT_SW_MAX, /* non-ABI */ > >>> };

Re: [PATCH net-next 2/3] bpf: introduce bpf_perf_event_output() helper

2015-10-21 Thread Alexei Starovoitov
On 10/21/15 4:05 AM, Wangnan (F) wrote: I think we can make perf output raw data hexadamically at first. that would be my suggestion as well. print it as hex first and when llvm type info is available you can teach perf to be smarter. We're working on support for this feature in iovisor/bcc

Re: [PATCH net-next 2/3] bpf: introduce bpf_perf_event_output() helper

2015-10-21 Thread He Kuang
hi, Alexei I've tested the sample in next patch and it works well. I think more work on the perf side needs to be done for parsing PERF_COUNT_SW_BPF_OUTPUT event type, are you working on that? Thank you. On 2015/10/21 11:02, Alexei Starovoitov wrote: This helper is used to send raw data from

Re: [PATCH net-next 2/3] bpf: introduce bpf_perf_event_output() helper

2015-10-21 Thread Peter Zijlstra
On Tue, Oct 20, 2015 at 08:02:34PM -0700, Alexei Starovoitov wrote: > This helper is used to send raw data from eBPF program into > special PERF_TYPE_SOFTWARE/PERF_COUNT_SW_BPF_OUTPUT perf_event. > User space needs to perf_event_open() it (either for one or all cpus) and > store FD into

Re: [PATCH net-next 2/3] bpf: introduce bpf_perf_event_output() helper

2015-10-21 Thread Wangnan (F)
On 2015/10/21 18:01, He Kuang wrote: hi, Alexei I've tested the sample in next patch and it works well. I think more work on the perf side needs to be done for parsing PERF_COUNT_SW_BPF_OUTPUT event type, are you working on that? Thank you. We need to add something into parse-event.y/l

[PATCH net-next 2/3] bpf: introduce bpf_perf_event_output() helper

2015-10-20 Thread Alexei Starovoitov
This helper is used to send raw data from eBPF program into special PERF_TYPE_SOFTWARE/PERF_COUNT_SW_BPF_OUTPUT perf_event. User space needs to perf_event_open() it (either for one or all cpus) and store FD into perf_event_array (similar to bpf_perf_event_read() helper) before eBPF program can