Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-27 Thread xiakaixu
于 2015/10/23 23:12, Peter Zijlstra 写道: > On Fri, Oct 23, 2015 at 02:52:11PM +0200, Peter Zijlstra wrote: >> On Thu, Oct 22, 2015 at 06:28:22PM +0800, Wangnan (F) wrote: >>> information to analysis when glitch happen. Another way we are trying to >>> implement >>> now is to dynamically turn events

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-27 Thread xiakaixu
于 2015/10/23 23:12, Peter Zijlstra 写道: > On Fri, Oct 23, 2015 at 02:52:11PM +0200, Peter Zijlstra wrote: >> On Thu, Oct 22, 2015 at 06:28:22PM +0800, Wangnan (F) wrote: >>> information to analysis when glitch happen. Another way we are trying to >>> implement >>> now is to dynamically turn events

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-23 Thread Peter Zijlstra
On Fri, Oct 23, 2015 at 02:52:11PM +0200, Peter Zijlstra wrote: > On Thu, Oct 22, 2015 at 06:28:22PM +0800, Wangnan (F) wrote: > > information to analysis when glitch happen. Another way we are trying to > > implement > > now is to dynamically turn events on and off, or at least enable/disable > >

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-23 Thread Peter Zijlstra
On Thu, Oct 22, 2015 at 06:28:22PM +0800, Wangnan (F) wrote: > information to analysis when glitch happen. Another way we are trying to > implement > now is to dynamically turn events on and off, or at least enable/disable > sampling dynamically because the overhead of copying those samples > is a

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-23 Thread Peter Zijlstra
On Thu, Oct 22, 2015 at 06:28:22PM +0800, Wangnan (F) wrote: > information to analysis when glitch happen. Another way we are trying to > implement > now is to dynamically turn events on and off, or at least enable/disable > sampling dynamically because the overhead of copying those samples > is a

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-23 Thread Peter Zijlstra
On Fri, Oct 23, 2015 at 02:52:11PM +0200, Peter Zijlstra wrote: > On Thu, Oct 22, 2015 at 06:28:22PM +0800, Wangnan (F) wrote: > > information to analysis when glitch happen. Another way we are trying to > > implement > > now is to dynamically turn events on and off, or at least enable/disable > >

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-22 Thread Wangnan (F)
On 2015/10/22 17:06, Peter Zijlstra wrote: On Wed, Oct 21, 2015 at 02:19:49PM -0700, Alexei Starovoitov wrote: Urgh, that's still horridly inconsistent. Can we please come up with a consistent interface to perf? My suggestion was to do ioctl(enable/disable) of events from userspace after

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-22 Thread Peter Zijlstra
On Thu, Oct 22, 2015 at 11:12:16AM +0800, Wangnan (F) wrote: > On 2015/10/22 11:09, Alexei Starovoitov wrote: > >On 10/21/15 6:56 PM, Wangnan (F) wrote: > >>>One alternative solution I can image is to attach a BPF program > >>>at sampling like kprobe, and return 0 if we don't want sampling >

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-22 Thread Peter Zijlstra
On Thu, Oct 22, 2015 at 03:51:37PM +0800, Wangnan (F) wrote: > Because I'm not very sure what the meaning of "inconsistent" in > Peter's words... What's inconsistent is that some perf actions can be done only on local events while others can be done on !local. And I can't say I particularly like

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-22 Thread Peter Zijlstra
On Wed, Oct 21, 2015 at 02:19:49PM -0700, Alexei Starovoitov wrote: > >Urgh, that's still horridly inconsistent. Can we please come up with a > >consistent interface to perf? > My suggestion was to do ioctl(enable/disable) of events from userspace > after receiving notification from kernel via

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-22 Thread Wangnan (F)
On 2015/10/22 15:39, Ingo Molnar wrote: * Wangnan (F) wrote: [SNIP] In summary, your either-or logic doesn't hold in BPF world. A BPF program can only access perf event in a highly restricted way. We don't allow it calling perf_event_read_local() across core, so it can't. Urgh, that's

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-22 Thread Ingo Molnar
* Wangnan (F) wrote: > > > On 2015/10/22 0:57, Peter Zijlstra wrote: > >On Wed, Oct 21, 2015 at 11:06:47PM +0800, pi3orama wrote: > >>>So explain; how does this eBPF stuff work. > >>I think I get your point this time, and let me explain the eBPF stuff to > >>you. > >> > >>You are aware that

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-22 Thread Ingo Molnar
* Wangnan (F) wrote: > > > On 2015/10/22 0:57, Peter Zijlstra wrote: > >On Wed, Oct 21, 2015 at 11:06:47PM +0800, pi3orama wrote: > >>>So explain; how does this eBPF stuff work. > >>I think I get your point this time, and let me explain the eBPF stuff to > >>you. > >> >

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-22 Thread Wangnan (F)
On 2015/10/22 15:39, Ingo Molnar wrote: * Wangnan (F) wrote: [SNIP] In summary, your either-or logic doesn't hold in BPF world. A BPF program can only access perf event in a highly restricted way. We don't allow it calling perf_event_read_local() across core, so it

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-22 Thread Peter Zijlstra
On Thu, Oct 22, 2015 at 03:51:37PM +0800, Wangnan (F) wrote: > Because I'm not very sure what the meaning of "inconsistent" in > Peter's words... What's inconsistent is that some perf actions can be done only on local events while others can be done on !local. And I can't say I particularly like

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-22 Thread Peter Zijlstra
On Wed, Oct 21, 2015 at 02:19:49PM -0700, Alexei Starovoitov wrote: > >Urgh, that's still horridly inconsistent. Can we please come up with a > >consistent interface to perf? > My suggestion was to do ioctl(enable/disable) of events from userspace > after receiving notification from kernel via

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-22 Thread Peter Zijlstra
On Thu, Oct 22, 2015 at 11:12:16AM +0800, Wangnan (F) wrote: > On 2015/10/22 11:09, Alexei Starovoitov wrote: > >On 10/21/15 6:56 PM, Wangnan (F) wrote: > >>>One alternative solution I can image is to attach a BPF program > >>>at sampling like kprobe, and return 0 if we don't want sampling >

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-22 Thread Wangnan (F)
On 2015/10/22 17:06, Peter Zijlstra wrote: On Wed, Oct 21, 2015 at 02:19:49PM -0700, Alexei Starovoitov wrote: Urgh, that's still horridly inconsistent. Can we please come up with a consistent interface to perf? My suggestion was to do ioctl(enable/disable) of events from userspace after

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Alexei Starovoitov
On 10/21/15 8:12 PM, Wangnan (F) wrote: On 2015/10/22 11:09, Alexei Starovoitov wrote: On 10/21/15 6:56 PM, Wangnan (F) wrote: One alternative solution I can image is to attach a BPF program at sampling like kprobe, and return 0 if we don't want sampling take action. Thought? Do you think

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Wangnan (F)
On 2015/10/22 11:09, Alexei Starovoitov wrote: On 10/21/15 6:56 PM, Wangnan (F) wrote: One alternative solution I can image is to attach a BPF program at sampling like kprobe, and return 0 if we don't want sampling take action. Thought? Do you think attaching BPF programs to sampling is an

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Alexei Starovoitov
On 10/21/15 6:56 PM, Wangnan (F) wrote: One alternative solution I can image is to attach a BPF program at sampling like kprobe, and return 0 if we don't want sampling take action. Thought? Do you think attaching BPF programs to sampling is an acceptable idea? If you mean to extend 'filter'

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Wangnan (F)
On 2015/10/22 0:57, Peter Zijlstra wrote: On Wed, Oct 21, 2015 at 11:06:47PM +0800, pi3orama wrote: So explain; how does this eBPF stuff work. I think I get your point this time, and let me explain the eBPF stuff to you. You are aware that BPF programmer can break the system in this way:

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Wangnan (F)
Hi Alexei, On 2015/10/21 21:42, Wangnan (F) wrote: One alternative solution I can image is to attach a BPF program at sampling like kprobe, and return 0 if we don't want sampling take action. Thought? Do you think attaching BPF programs to sampling is an acceptable idea? Thank you.

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Alexei Starovoitov
On 10/21/15 9:57 AM, Peter Zijlstra wrote: In summary, your either-or logic doesn't hold in BPF world. A BPF >program can only access perf event in a highly restricted way. We >don't allow it calling perf_event_read_local() across core, so it >can't. That's actually broken. My fault as well,

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Peter Zijlstra
On Wed, Oct 21, 2015 at 11:06:47PM +0800, pi3orama wrote: > > So explain; how does this eBPF stuff work. > > I think I get your point this time, and let me explain the eBPF stuff to you. > > You are aware that BPF programmer can break the system in this way: > > A=get_non_local_perf_event() >

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread pi3orama
发自我的 iPhone > 在 2015年10月21日,下午10:09,Peter Zijlstra 写道: > > On Wed, Oct 21, 2015 at 10:01:46PM +0800, pi3orama wrote: >>> 在 2015年10月21日,下午9:49,Peter Zijlstra 写道: >>> On Wed, Oct 21, 2015 at 09:42:12PM +0800, Wangnan (F) wrote: How can an eBPF program access a !local event:

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Peter Zijlstra
On Wed, Oct 21, 2015 at 10:01:46PM +0800, pi3orama wrote: > > 在 2015年10月21日,下午9:49,Peter Zijlstra 写道: > > > >> On Wed, Oct 21, 2015 at 09:42:12PM +0800, Wangnan (F) wrote: > >> How can an eBPF program access a !local event: > >> > >> when creating perf event array we don't care which perf event

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread pi3orama
发自我的 iPhone > 在 2015年10月21日,下午9:49,Peter Zijlstra 写道: > >> On Wed, Oct 21, 2015 at 09:42:12PM +0800, Wangnan (F) wrote: >> How can an eBPF program access a !local event: >> >> when creating perf event array we don't care which perf event >> is for which CPU, so perf program can access any

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Peter Zijlstra
On Wed, Oct 21, 2015 at 09:42:12PM +0800, Wangnan (F) wrote: > How can an eBPF program access a !local event: > > when creating perf event array we don't care which perf event > is for which CPU, so perf program can access any perf event in > that array. So what is stopping the eBPF thing from

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Wangnan (F)
On 2015/10/21 20:17, Peter Zijlstra wrote: On Wed, Oct 21, 2015 at 07:49:34PM +0800, Wangnan (F) wrote: If our task is sampling cycle events during a function is running, and if two cores start that function overlap: Time: ...A Core 0: sys_write\

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Peter Zijlstra
On Wed, Oct 21, 2015 at 07:49:34PM +0800, Wangnan (F) wrote: > If our task is sampling cycle events during a function is running, > and if two cores start that function overlap: > > Time: ...A > Core 0: sys_write\ > \ >\ > Core

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Wangnan (F)
On 2015/10/21 19:56, Peter Zijlstra wrote: On Wed, Oct 21, 2015 at 07:34:28PM +0800, Wangnan (F) wrote: If you want to actually disable the event: pmu->stop() will make it stop, and you can restart using pmu->start().xiezuo I also prefer totally disabling event because our goal is to reduce

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Peter Zijlstra
On Wed, Oct 21, 2015 at 07:34:28PM +0800, Wangnan (F) wrote: > >If you want to actually disable the event: pmu->stop() will make it > >stop, and you can restart using pmu->start().xiezuo > > I also prefer totally disabling event because our goal is to reduce > sampling overhead as mush as

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Wangnan (F)
On 2015/10/21 19:33, Peter Zijlstra wrote: On Wed, Oct 21, 2015 at 06:31:04PM +0800, xiakaixu wrote: The RFC patch set contains the necessary commit log [1]. That's of course the wrong place, this should be in the patch's Changelog. It doesn't become less relevant. In some scenarios we

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Wangnan (F)
On 2015/10/21 17:12, Peter Zijlstra wrote: On Tue, Oct 20, 2015 at 03:53:02PM -0700, Alexei Starovoitov wrote: On 10/20/15 12:22 AM, Kaixu Xia wrote: diff --git a/kernel/events/core.c b/kernel/events/core.c index b11756f..5219635 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Peter Zijlstra
On Wed, Oct 21, 2015 at 06:31:04PM +0800, xiakaixu wrote: > The RFC patch set contains the necessary commit log [1]. That's of course the wrong place, this should be in the patch's Changelog. It doesn't become less relevant. > In some scenarios we don't want to output trace data when perf

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread xiakaixu
于 2015/10/21 17:12, Peter Zijlstra 写道: > On Tue, Oct 20, 2015 at 03:53:02PM -0700, Alexei Starovoitov wrote: >> On 10/20/15 12:22 AM, Kaixu Xia wrote: >>> diff --git a/kernel/events/core.c b/kernel/events/core.c >>> index b11756f..5219635 100644 >>> --- a/kernel/events/core.c >>> +++

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Peter Zijlstra
On Tue, Oct 20, 2015 at 03:53:02PM -0700, Alexei Starovoitov wrote: > On 10/20/15 12:22 AM, Kaixu Xia wrote: > >diff --git a/kernel/events/core.c b/kernel/events/core.c > >index b11756f..5219635 100644 > >--- a/kernel/events/core.c > >+++ b/kernel/events/core.c > >@@ -6337,6 +6337,9 @@ static int

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Peter Zijlstra
On Wed, Oct 21, 2015 at 10:01:46PM +0800, pi3orama wrote: > > 在 2015年10月21日,下午9:49,Peter Zijlstra 写道: > > > >> On Wed, Oct 21, 2015 at 09:42:12PM +0800, Wangnan (F) wrote: > >> How can an eBPF program access a !local event: > >> > >> when creating perf event array we don't

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Wangnan (F)
On 2015/10/21 20:17, Peter Zijlstra wrote: On Wed, Oct 21, 2015 at 07:49:34PM +0800, Wangnan (F) wrote: If our task is sampling cycle events during a function is running, and if two cores start that function overlap: Time: ...A Core 0: sys_write\

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread pi3orama
发自我的 iPhone > 在 2015年10月21日,下午9:49,Peter Zijlstra 写道: > >> On Wed, Oct 21, 2015 at 09:42:12PM +0800, Wangnan (F) wrote: >> How can an eBPF program access a !local event: >> >> when creating perf event array we don't care which perf event >> is for which CPU, so perf

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Peter Zijlstra
On Wed, Oct 21, 2015 at 09:42:12PM +0800, Wangnan (F) wrote: > How can an eBPF program access a !local event: > > when creating perf event array we don't care which perf event > is for which CPU, so perf program can access any perf event in > that array. So what is stopping the eBPF thing from

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Peter Zijlstra
On Wed, Oct 21, 2015 at 11:06:47PM +0800, pi3orama wrote: > > So explain; how does this eBPF stuff work. > > I think I get your point this time, and let me explain the eBPF stuff to you. > > You are aware that BPF programmer can break the system in this way: > > A=get_non_local_perf_event() >

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Alexei Starovoitov
On 10/21/15 9:57 AM, Peter Zijlstra wrote: In summary, your either-or logic doesn't hold in BPF world. A BPF >program can only access perf event in a highly restricted way. We >don't allow it calling perf_event_read_local() across core, so it >can't. That's actually broken. My fault as well,

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Wangnan (F)
Hi Alexei, On 2015/10/21 21:42, Wangnan (F) wrote: One alternative solution I can image is to attach a BPF program at sampling like kprobe, and return 0 if we don't want sampling take action. Thought? Do you think attaching BPF programs to sampling is an acceptable idea? Thank you.

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread pi3orama
发自我的 iPhone > 在 2015年10月21日,下午10:09,Peter Zijlstra 写道: > > On Wed, Oct 21, 2015 at 10:01:46PM +0800, pi3orama wrote: >>> 在 2015年10月21日,下午9:49,Peter Zijlstra 写道: >>> On Wed, Oct 21, 2015 at 09:42:12PM +0800, Wangnan (F) wrote: How can an

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Wangnan (F)
On 2015/10/22 0:57, Peter Zijlstra wrote: On Wed, Oct 21, 2015 at 11:06:47PM +0800, pi3orama wrote: So explain; how does this eBPF stuff work. I think I get your point this time, and let me explain the eBPF stuff to you. You are aware that BPF programmer can break the system in this way:

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Alexei Starovoitov
On 10/21/15 6:56 PM, Wangnan (F) wrote: One alternative solution I can image is to attach a BPF program at sampling like kprobe, and return 0 if we don't want sampling take action. Thought? Do you think attaching BPF programs to sampling is an acceptable idea? If you mean to extend 'filter'

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Wangnan (F)
On 2015/10/22 11:09, Alexei Starovoitov wrote: On 10/21/15 6:56 PM, Wangnan (F) wrote: One alternative solution I can image is to attach a BPF program at sampling like kprobe, and return 0 if we don't want sampling take action. Thought? Do you think attaching BPF programs to sampling is an

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Alexei Starovoitov
On 10/21/15 8:12 PM, Wangnan (F) wrote: On 2015/10/22 11:09, Alexei Starovoitov wrote: On 10/21/15 6:56 PM, Wangnan (F) wrote: One alternative solution I can image is to attach a BPF program at sampling like kprobe, and return 0 if we don't want sampling take action. Thought? Do you think

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Peter Zijlstra
On Tue, Oct 20, 2015 at 03:53:02PM -0700, Alexei Starovoitov wrote: > On 10/20/15 12:22 AM, Kaixu Xia wrote: > >diff --git a/kernel/events/core.c b/kernel/events/core.c > >index b11756f..5219635 100644 > >--- a/kernel/events/core.c > >+++ b/kernel/events/core.c > >@@ -6337,6 +6337,9 @@ static int

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread xiakaixu
于 2015/10/21 17:12, Peter Zijlstra 写道: > On Tue, Oct 20, 2015 at 03:53:02PM -0700, Alexei Starovoitov wrote: >> On 10/20/15 12:22 AM, Kaixu Xia wrote: >>> diff --git a/kernel/events/core.c b/kernel/events/core.c >>> index b11756f..5219635 100644 >>> --- a/kernel/events/core.c >>> +++

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Peter Zijlstra
On Wed, Oct 21, 2015 at 06:31:04PM +0800, xiakaixu wrote: > The RFC patch set contains the necessary commit log [1]. That's of course the wrong place, this should be in the patch's Changelog. It doesn't become less relevant. > In some scenarios we don't want to output trace data when perf

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Wangnan (F)
On 2015/10/21 19:56, Peter Zijlstra wrote: On Wed, Oct 21, 2015 at 07:34:28PM +0800, Wangnan (F) wrote: If you want to actually disable the event: pmu->stop() will make it stop, and you can restart using pmu->start().xiezuo I also prefer totally disabling event because our goal is to reduce

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Wangnan (F)
On 2015/10/21 19:33, Peter Zijlstra wrote: On Wed, Oct 21, 2015 at 06:31:04PM +0800, xiakaixu wrote: The RFC patch set contains the necessary commit log [1]. That's of course the wrong place, this should be in the patch's Changelog. It doesn't become less relevant. In some scenarios we

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Peter Zijlstra
On Wed, Oct 21, 2015 at 07:34:28PM +0800, Wangnan (F) wrote: > >If you want to actually disable the event: pmu->stop() will make it > >stop, and you can restart using pmu->start().xiezuo > > I also prefer totally disabling event because our goal is to reduce > sampling overhead as mush as

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Wangnan (F)
On 2015/10/21 17:12, Peter Zijlstra wrote: On Tue, Oct 20, 2015 at 03:53:02PM -0700, Alexei Starovoitov wrote: On 10/20/15 12:22 AM, Kaixu Xia wrote: diff --git a/kernel/events/core.c b/kernel/events/core.c index b11756f..5219635 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Peter Zijlstra
On Wed, Oct 21, 2015 at 07:49:34PM +0800, Wangnan (F) wrote: > If our task is sampling cycle events during a function is running, > and if two cores start that function overlap: > > Time: ...A > Core 0: sys_write\ > \ >\ > Core

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-20 Thread Alexei Starovoitov
On 10/20/15 12:22 AM, Kaixu Xia wrote: diff --git a/kernel/events/core.c b/kernel/events/core.c index b11756f..5219635 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -6337,6 +6337,9 @@ static int __perf_event_overflow(struct perf_event *event,

[PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-20 Thread Kaixu Xia
This patch adds the flag soft_enable to control the trace data output process when perf sampling. By setting this flag and integrating with ebpf, we can control the data output process and get the samples we are most interested in. The bpf helper bpf_perf_event_control() can control either the

[PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-20 Thread Kaixu Xia
This patch adds the flag soft_enable to control the trace data output process when perf sampling. By setting this flag and integrating with ebpf, we can control the data output process and get the samples we are most interested in. The bpf helper bpf_perf_event_control() can control either the

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-20 Thread Alexei Starovoitov
On 10/20/15 12:22 AM, Kaixu Xia wrote: diff --git a/kernel/events/core.c b/kernel/events/core.c index b11756f..5219635 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -6337,6 +6337,9 @@ static int __perf_event_overflow(struct perf_event *event,