Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-12 Thread Adrian Hunter
On 12/06/2015 5:21 p.m., David Ahern wrote: On 6/12/15 4:34 AM, Adrian Hunter wrote: On 12/06/15 03:47, David Ahern wrote: On 6/11/15 8:15 AM, Peter Zijlstra wrote: This new PERF_RECORD_SWITCH event does not have those problems and it also has a couple of other small advantages. It is easier

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-12 Thread David Ahern
On 6/12/15 7:28 AM, Pawel Moll wrote: Thanks, that's clear then. There will just need to be a flag to indicate whether it is scheduling in or out. Just a thought: wouldn't it be good to know what CPU have we been scheduled from/to? This kind of information would be especially valuable in

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-12 Thread David Ahern
On 6/12/15 5:12 AM, Adrian Hunter wrote: This new PERF_RECORD_SWITCH event does not have those problems and it also has a couple of other small advantages. It is easier to use because it is an auxiliary event (like mmap, comm and task events) which can be enabled by setting a single bit. It is

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-12 Thread David Ahern
On 6/12/15 4:34 AM, Adrian Hunter wrote: On 12/06/15 03:47, David Ahern wrote: On 6/11/15 8:15 AM, Peter Zijlstra wrote: This new PERF_RECORD_SWITCH event does not have those problems and it also has a couple of other small advantages. It is easier to use because it is an auxiliary event (like

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-12 Thread Pawel Moll
On Fri, 2015-06-12 at 14:28 +0100, Pawel Moll wrote: > On Fri, 2015-06-12 at 14:15 +0100, Adrian Hunter wrote: > > all 3 are already part of sample_id. > > >>> > > >>> You have to decide whether you expect to be able to use an event without > > >>> sample_id. MMAP and MMAP2 both have pid, tid

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-12 Thread Pawel Moll
On Fri, 2015-06-12 at 14:15 +0100, Adrian Hunter wrote: > all 3 are already part of sample_id. > >>> > >>> You have to decide whether you expect to be able to use an event without > >>> sample_id. MMAP and MMAP2 both have pid, tid which are in sample_id, LOST > >>> has id, EXIT and FORK have

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-12 Thread Adrian Hunter
On 12/06/15 15:36, Arnaldo Carvalho de Melo wrote: > Em Fri, Jun 12, 2015 at 02:09:38PM +0200, Peter Zijlstra escreveu: >> On Fri, Jun 12, 2015 at 02:12:11PM +0300, Adrian Hunter wrote: >>> On 11/06/15 17:15, Peter Zijlstra wrote: >> Right, so the one wee problem I have is that this only

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-12 Thread Arnaldo Carvalho de Melo
Em Fri, Jun 12, 2015 at 02:09:38PM +0200, Peter Zijlstra escreveu: > On Fri, Jun 12, 2015 at 02:12:11PM +0300, Adrian Hunter wrote: > > On 11/06/15 17:15, Peter Zijlstra wrote: > > > > Right, so the one wee problem I have is that this only provides sched_in > > > data, I imagine people might be

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-12 Thread Peter Zijlstra
On Fri, Jun 12, 2015 at 02:12:11PM +0300, Adrian Hunter wrote: > On 11/06/15 17:15, Peter Zijlstra wrote: > > Right, so the one wee problem I have is that this only provides sched_in > > data, I imagine people might be interested in sched_out as well. > > That is not a problem although it would

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-12 Thread Adrian Hunter
On 11/06/15 17:15, Peter Zijlstra wrote: > On Tue, Jun 09, 2015 at 05:21:10PM +0300, Adrian Hunter wrote: >> Tracepoints are no good at all for non-privileged users >> because they need either CAP_SYS_ADMIN or >> /proc/sys/kernel/perf_event_paranoid <= -1. >> >> On the other hand, kernel software

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-12 Thread Adrian Hunter
On 12/06/15 03:47, David Ahern wrote: > On 6/11/15 8:15 AM, Peter Zijlstra wrote: >>> This new PERF_RECORD_SWITCH event does not have those problems >>> and it also has a couple of other small advantages. It is >>> easier to use because it is an auxiliary event (like mmap, >>> comm and task

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-12 Thread Adrian Hunter
On 11/06/15 17:15, Peter Zijlstra wrote: On Tue, Jun 09, 2015 at 05:21:10PM +0300, Adrian Hunter wrote: Tracepoints are no good at all for non-privileged users because they need either CAP_SYS_ADMIN or /proc/sys/kernel/perf_event_paranoid = -1. On the other hand, kernel software events need

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-12 Thread Arnaldo Carvalho de Melo
Em Fri, Jun 12, 2015 at 02:09:38PM +0200, Peter Zijlstra escreveu: On Fri, Jun 12, 2015 at 02:12:11PM +0300, Adrian Hunter wrote: On 11/06/15 17:15, Peter Zijlstra wrote: Right, so the one wee problem I have is that this only provides sched_in data, I imagine people might be interested

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-12 Thread Adrian Hunter
On 12/06/15 03:47, David Ahern wrote: On 6/11/15 8:15 AM, Peter Zijlstra wrote: This new PERF_RECORD_SWITCH event does not have those problems and it also has a couple of other small advantages. It is easier to use because it is an auxiliary event (like mmap, comm and task events) which can

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-12 Thread Peter Zijlstra
On Fri, Jun 12, 2015 at 02:12:11PM +0300, Adrian Hunter wrote: On 11/06/15 17:15, Peter Zijlstra wrote: Right, so the one wee problem I have is that this only provides sched_in data, I imagine people might be interested in sched_out as well. That is not a problem although it would be

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-12 Thread Adrian Hunter
On 12/06/15 15:36, Arnaldo Carvalho de Melo wrote: Em Fri, Jun 12, 2015 at 02:09:38PM +0200, Peter Zijlstra escreveu: On Fri, Jun 12, 2015 at 02:12:11PM +0300, Adrian Hunter wrote: On 11/06/15 17:15, Peter Zijlstra wrote: Right, so the one wee problem I have is that this only provides

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-12 Thread Pawel Moll
On Fri, 2015-06-12 at 14:15 +0100, Adrian Hunter wrote: all 3 are already part of sample_id. You have to decide whether you expect to be able to use an event without sample_id. MMAP and MMAP2 both have pid, tid which are in sample_id, LOST has id, EXIT and FORK have time, all of the

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-12 Thread Adrian Hunter
On 12/06/2015 5:21 p.m., David Ahern wrote: On 6/12/15 4:34 AM, Adrian Hunter wrote: On 12/06/15 03:47, David Ahern wrote: On 6/11/15 8:15 AM, Peter Zijlstra wrote: This new PERF_RECORD_SWITCH event does not have those problems and it also has a couple of other small advantages. It is easier

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-12 Thread David Ahern
On 6/12/15 7:28 AM, Pawel Moll wrote: Thanks, that's clear then. There will just need to be a flag to indicate whether it is scheduling in or out. Just a thought: wouldn't it be good to know what CPU have we been scheduled from/to? This kind of information would be especially valuable in

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-12 Thread Pawel Moll
On Fri, 2015-06-12 at 14:28 +0100, Pawel Moll wrote: On Fri, 2015-06-12 at 14:15 +0100, Adrian Hunter wrote: all 3 are already part of sample_id. You have to decide whether you expect to be able to use an event without sample_id. MMAP and MMAP2 both have pid, tid which are in

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-12 Thread David Ahern
On 6/12/15 4:34 AM, Adrian Hunter wrote: On 12/06/15 03:47, David Ahern wrote: On 6/11/15 8:15 AM, Peter Zijlstra wrote: This new PERF_RECORD_SWITCH event does not have those problems and it also has a couple of other small advantages. It is easier to use because it is an auxiliary event (like

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-12 Thread David Ahern
On 6/12/15 5:12 AM, Adrian Hunter wrote: This new PERF_RECORD_SWITCH event does not have those problems and it also has a couple of other small advantages. It is easier to use because it is an auxiliary event (like mmap, comm and task events) which can be enabled by setting a single bit. It is

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-11 Thread David Ahern
On 6/11/15 8:15 AM, Peter Zijlstra wrote: This new PERF_RECORD_SWITCH event does not have those problems and it also has a couple of other small advantages. It is easier to use because it is an auxiliary event (like mmap, comm and task events) which can be enabled by setting a single bit. It is

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-11 Thread Peter Zijlstra
On Thu, Jun 11, 2015 at 09:34:30AM -0700, Andi Kleen wrote: > On Thu, Jun 11, 2015 at 04:15:48PM +0200, Peter Zijlstra wrote: > > On Tue, Jun 09, 2015 at 05:21:10PM +0300, Adrian Hunter wrote: > > > Tracepoints are no good at all for non-privileged users > > > because they need either

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-11 Thread Andi Kleen
On Thu, Jun 11, 2015 at 04:15:48PM +0200, Peter Zijlstra wrote: > On Tue, Jun 09, 2015 at 05:21:10PM +0300, Adrian Hunter wrote: > > Tracepoints are no good at all for non-privileged users > > because they need either CAP_SYS_ADMIN or > > /proc/sys/kernel/perf_event_paranoid <= -1. > > > > On the

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-11 Thread Peter Zijlstra
On Tue, Jun 09, 2015 at 05:21:10PM +0300, Adrian Hunter wrote: > Tracepoints are no good at all for non-privileged users > because they need either CAP_SYS_ADMIN or > /proc/sys/kernel/perf_event_paranoid <= -1. > > On the other hand, kernel software events need either > CAP_SYS_ADMIN or

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-11 Thread Peter Zijlstra
On Tue, Jun 09, 2015 at 05:21:10PM +0300, Adrian Hunter wrote: Tracepoints are no good at all for non-privileged users because they need either CAP_SYS_ADMIN or /proc/sys/kernel/perf_event_paranoid = -1. On the other hand, kernel software events need either CAP_SYS_ADMIN or

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-11 Thread David Ahern
On 6/11/15 8:15 AM, Peter Zijlstra wrote: This new PERF_RECORD_SWITCH event does not have those problems and it also has a couple of other small advantages. It is easier to use because it is an auxiliary event (like mmap, comm and task events) which can be enabled by setting a single bit. It is

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-11 Thread Andi Kleen
On Thu, Jun 11, 2015 at 04:15:48PM +0200, Peter Zijlstra wrote: On Tue, Jun 09, 2015 at 05:21:10PM +0300, Adrian Hunter wrote: Tracepoints are no good at all for non-privileged users because they need either CAP_SYS_ADMIN or /proc/sys/kernel/perf_event_paranoid = -1. On the other hand,

Re: [RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-11 Thread Peter Zijlstra
On Thu, Jun 11, 2015 at 09:34:30AM -0700, Andi Kleen wrote: On Thu, Jun 11, 2015 at 04:15:48PM +0200, Peter Zijlstra wrote: On Tue, Jun 09, 2015 at 05:21:10PM +0300, Adrian Hunter wrote: Tracepoints are no good at all for non-privileged users because they need either CAP_SYS_ADMIN or

[RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-09 Thread Adrian Hunter
There are already two events for context switches, namely the tracepoint sched:sched_switch and the software event context_switches. Unfortunately neither are suitable for use by non-privileged users for the purpose of synchronizing hardware trace data (e.g. Intel PT) to the context switch.

[RFC PATCH] perf: Add PERF_RECORD_SWITCH to indicate context switches

2015-06-09 Thread Adrian Hunter
There are already two events for context switches, namely the tracepoint sched:sched_switch and the software event context_switches. Unfortunately neither are suitable for use by non-privileged users for the purpose of synchronizing hardware trace data (e.g. Intel PT) to the context switch.