Re: [PATCH v2 linux-trace 1/8] tracing: attach eBPF programs to tracepoints and syscalls

2015-01-29 Thread Alexei Starovoitov
On Thu, Jan 29, 2015 at 4:35 AM, Namhyung Kim wrote: >>> Right. I think bpf programs belong to a user process but events are >>> global resource. Maybe you also need to consider attaching bpf >>> program via perf (ioctl?) interface.. >> >> yes. I did. Please see my reply to Masami. >> ioctl only

Re: [PATCH v2 linux-trace 1/8] tracing: attach eBPF programs to tracepoints and syscalls

2015-01-29 Thread Namhyung Kim
On Thu, Jan 29, 2015 at 4:04 PM, Alexei Starovoitov wrote: > On Wed, Jan 28, 2015 at 10:41 PM, Namhyung Kim wrote: >> >> I think it's not a problem of bpf. An user process can be killed >> anytime while it enabed events without bpf. The only thing it should >> care is the auto-unload IMHO. > >

Re: [PATCH v2 linux-trace 1/8] tracing: attach eBPF programs to tracepoints and syscalls

2015-01-28 Thread Alexei Starovoitov
On Wed, Jan 28, 2015 at 10:41 PM, Namhyung Kim wrote: > > I think it's not a problem of bpf. An user process can be killed > anytime while it enabed events without bpf. The only thing it should > care is the auto-unload IMHO. ok. I think it does indeed make sense to decouple the logic. We can a

Re: [PATCH v2 linux-trace 1/8] tracing: attach eBPF programs to tracepoints and syscalls

2015-01-28 Thread Namhyung Kim
On Thu, Jan 29, 2015 at 1:40 PM, Alexei Starovoitov wrote: > On Wed, Jan 28, 2015 at 4:46 PM, Namhyung Kim wrote: >>> >>> +static int event_filter_release(struct inode *inode, struct file *filp) >>> +{ >>> + struct ftrace_event_file *file; >>> + char buf[2] = "0"; >>> + >>> + mutex_lo

Re: [PATCH v2 linux-trace 1/8] tracing: attach eBPF programs to tracepoints and syscalls

2015-01-28 Thread Alexei Starovoitov
On Wed, Jan 28, 2015 at 9:39 PM, Masami Hiramatsu wrote: > > Maybe, would we need a reference counter for each event? :) when we would want multiple users to attach different programs to the same event, then yes. Right now I'd rather have things simple. > Actually, ftrace event is not similar to

Re: [PATCH v2 linux-trace 1/8] tracing: attach eBPF programs to tracepoints and syscalls

2015-01-28 Thread Masami Hiramatsu
(2015/01/29 13:40), Alexei Starovoitov wrote: > On Wed, Jan 28, 2015 at 4:46 PM, Namhyung Kim wrote: >>> >>> +static int event_filter_release(struct inode *inode, struct file *filp) >>> +{ >>> + struct ftrace_event_file *file; >>> + char buf[2] = "0"; >>> + >>> + mutex_lock(&event_mute

Re: [PATCH v2 linux-trace 1/8] tracing: attach eBPF programs to tracepoints and syscalls

2015-01-28 Thread Alexei Starovoitov
On Wed, Jan 28, 2015 at 4:46 PM, Namhyung Kim wrote: >> >> +static int event_filter_release(struct inode *inode, struct file *filp) >> +{ >> + struct ftrace_event_file *file; >> + char buf[2] = "0"; >> + >> + mutex_lock(&event_mutex); >> + file = event_file_data(filp); >> + if

Re: [PATCH v2 linux-trace 1/8] tracing: attach eBPF programs to tracepoints and syscalls

2015-01-28 Thread Namhyung Kim
Hi Alexei, On Tue, Jan 27, 2015 at 08:06:06PM -0800, Alexei Starovoitov wrote: > User interface: > fd = open("/sys/kernel/debug/tracing/__event__/filter") > > write(fd, "bpf_123") > > where 123 is process local FD associated with eBPF program previously loaded. > __event__ is static tracepoint e

[PATCH v2 linux-trace 1/8] tracing: attach eBPF programs to tracepoints and syscalls

2015-01-27 Thread Alexei Starovoitov
User interface: fd = open("/sys/kernel/debug/tracing/__event__/filter") write(fd, "bpf_123") where 123 is process local FD associated with eBPF program previously loaded. __event__ is static tracepoint event or syscall. (kprobe support is in next patch) Once program is successfully attached to tr