Re: [PATCH V2 1/6] perf,core: allow invalid context events to be part of sw/hw groups

2015-04-20 Thread Andi Kleen
> If you don't care about sampling and only care about totals, then you > can just open the events concurrently *without* grouping them, as I > stated previously. perf record doesn't really support that. We need some group reader that runs regularly. The best choice for the leader is a CPU sample

Re: [PATCH V2 1/6] perf,core: allow invalid context events to be part of sw/hw groups

2015-04-20 Thread Mark Rutland
On Sat, Apr 18, 2015 at 01:47:06AM +0100, Andi Kleen wrote: > > ... which would give you arbitrary skew, because one counter is > > free-running and the other is not (when scheduling a context in or out we > > stop > > the PMU) > > Everyone just reads the counter and subtracts it from > the last

Re: [PATCH V2 1/6] perf,core: allow invalid context events to be part of sw/hw groups

2015-04-17 Thread Andi Kleen
> ... which would give you arbitrary skew, because one counter is > free-running and the other is not (when scheduling a context in or out we stop > the PMU) Everyone just reads the counter and subtracts it from the last value they've seen. That's the same how any other shared free running counte

Re: [PATCH V2 1/6] perf,core: allow invalid context events to be part of sw/hw groups

2015-04-17 Thread Mark Rutland
On Thu, Apr 16, 2015 at 10:23:42PM +0100, Andi Kleen wrote: > > From my PoV that makes sense. One is CPU-affine, the other is not, and > > the two cannot be scheduled in the same PMU transaction by the nature of > > the hardware. Fundamentally, you cannot provide group semantics due to > > this. >

Re: [PATCH V2 1/6] perf,core: allow invalid context events to be part of sw/hw groups

2015-04-16 Thread Andi Kleen
> From my PoV that makes sense. One is CPU-affine, the other is not, and > the two cannot be scheduled in the same PMU transaction by the nature of > the hardware. Fundamentally, you cannot provide group semantics due to > this. Actually you can. Just use it like a free running counter, and the di

Re: [PATCH V2 1/6] perf,core: allow invalid context events to be part of sw/hw groups

2015-04-16 Thread Mark Rutland
On Thu, Apr 16, 2015 at 05:31:40PM +0100, Mark Rutland wrote: > Hi, > > If you're going to fundamentally change the behaviour of > perf_invalid_context, please Cc authors of other system PMU drivers. > Intel aren't the only ones with such PMUs. > > For instance, this affects the ARM CCI and CCN P

Re: [PATCH V2 1/6] perf,core: allow invalid context events to be part of sw/hw groups

2015-04-16 Thread Mark Rutland
> Even if you ignore the fundamental semantics of groups, there are other > problems with allowing shared contexts: > > * The *_txn functions only get called on the group leader's PMU. If your > system PMU has these functions, they are not called. > > * Event rotation is per ctx, but now you co

Re: [PATCH V2 1/6] perf,core: allow invalid context events to be part of sw/hw groups

2015-04-16 Thread Mark Rutland
Hi, If you're going to fundamentally change the behaviour of perf_invalid_context, please Cc authors of other system PMU drivers. Intel aren't the only ones with such PMUs. For instance, this affects the ARM CCI and CCN PMU drivers. On Wed, Apr 15, 2015 at 08:56:11AM +0100, Kan Liang wrote: > Fr

RE: [PATCH V2 1/6] perf,core: allow invalid context events to be part of sw/hw groups

2015-04-16 Thread Liang, Kan
> > On Wed, Apr 15, 2015 at 03:56:11AM -0400, Kan Liang wrote: > > The event count only be read when the event is already sched_in. > > Yeah, so no. This breaks what groups are. Group events _must_ be co- > scheduled. You cannot guarantee you can schedule events from another > PMU. Why? I thin

Re: [PATCH V2 1/6] perf,core: allow invalid context events to be part of sw/hw groups

2015-04-15 Thread Peter Zijlstra
On Wed, Apr 15, 2015 at 03:56:11AM -0400, Kan Liang wrote: > The event count only be read when the event is already > sched_in. Yeah, so no. This breaks what groups are. Group events _must_ be co-scheduled. You cannot guarantee you can schedule events from another PMU. Also, I cannot see how this

Re: [PATCH V2 1/6] perf,core: allow invalid context events to be part of sw/hw groups

2015-04-15 Thread Peter Zijlstra
On Wed, Apr 15, 2015 at 06:21:11PM +0200, Andi Kleen wrote: > On Wed, Apr 15, 2015 at 06:15:28PM +0200, Peter Zijlstra wrote: > > On Wed, Apr 15, 2015 at 03:56:11AM -0400, Kan Liang wrote: > > > From: Kan Liang > > > > > > The pmu marked as perf_invalid_context don't have any state to switch on >

Re: [PATCH V2 1/6] perf,core: allow invalid context events to be part of sw/hw groups

2015-04-15 Thread Andi Kleen
On Wed, Apr 15, 2015 at 06:15:28PM +0200, Peter Zijlstra wrote: > On Wed, Apr 15, 2015 at 03:56:11AM -0400, Kan Liang wrote: > > From: Kan Liang > > > > The pmu marked as perf_invalid_context don't have any state to switch on > > context switch. Everything is global. So it is OK to be part of sw/

Re: [PATCH V2 1/6] perf,core: allow invalid context events to be part of sw/hw groups

2015-04-15 Thread Peter Zijlstra
On Wed, Apr 15, 2015 at 03:56:11AM -0400, Kan Liang wrote: > From: Kan Liang > > The pmu marked as perf_invalid_context don't have any state to switch on > context switch. Everything is global. So it is OK to be part of sw/hw > groups. > In sched_out/sched_in, del/add must be called, so the > per

[PATCH V2 1/6] perf,core: allow invalid context events to be part of sw/hw groups

2015-04-15 Thread Kan Liang
From: Kan Liang The pmu marked as perf_invalid_context don't have any state to switch on context switch. Everything is global. So it is OK to be part of sw/hw groups. In sched_out/sched_in, del/add must be called, so the perf_invalid_context event can be disabled/enabled accordingly during contex