Re: [BUG] perf: sharing of cpuctx between core and ibs PMU causes problems

2012-08-13 Thread Stephane Eranian
On Mon, Aug 13, 2012 at 5:32 PM, Peter Zijlstra wrote: > On Mon, 2012-08-13 at 14:53 +0200, Stephane Eranian wrote: >> >> Your proposal solves the problem, though it is not that pretty because >> you're exposing >> IBS stuff in sched.h aside for the 2 new iterations. But I don't see >> another way

Re: [BUG] perf: sharing of cpuctx between core and ibs PMU causes problems

2012-08-13 Thread Peter Zijlstra
On Mon, 2012-08-13 at 14:53 +0200, Stephane Eranian wrote: > > Your proposal solves the problem, though it is not that pretty because > you're exposing > IBS stuff in sched.h aside for the 2 new iterations. But I don't see > another way around > this at this point. Yeah, I don't particularly lik

Re: [BUG] perf: sharing of cpuctx between core and ibs PMU causes problems

2012-08-13 Thread Stephane Eranian
Peter, Ok, that should fix the problem that IBS would not work correctly in per-thread mode. I realized I was looking at an older kernel which did not have the split between ibs op and fetch. And there, the .task_nr_context was not initialized at all. Your proposal solves the problem, though it i

Re: [BUG] perf: sharing of cpuctx between core and ibs PMU causes problems

2012-08-13 Thread Peter Zijlstra
OK,.. so the AMD IBS PMUs actually have perf_invalid_context. Lemme have a proper look... Weirdness.. perf_pmu_register() will allocate a pmu->pmu_cpu_context for each PMU. find_pmu_context() even special cases the perf_invalid_context to return NULL to force the allocation instead of sharing i

Re: [BUG] perf: sharing of cpuctx between core and ibs PMU causes problems

2012-08-09 Thread Stephane Eranian
On Thu, Aug 9, 2012 at 8:08 PM, Peter Zijlstra wrote: > On Thu, 2012-08-09 at 16:05 +0200, Stephane Eranian wrote: >> > uncore PMU does not have this issue because uncore_pmu->task_ctx_nr >> > is 'perf_invalid_context'. find_pmu_context() always return NULL in >> > that case. >> > >> Yes, I think

Re: [BUG] perf: sharing of cpuctx between core and ibs PMU causes problems

2012-08-09 Thread Peter Zijlstra
On Thu, 2012-08-09 at 16:05 +0200, Stephane Eranian wrote: > > uncore PMU does not have this issue because uncore_pmu->task_ctx_nr > > is 'perf_invalid_context'. find_pmu_context() always return NULL in > > that case. > > > Yes, I think IBS should do the same and that should fix the problem > there

Re: [BUG] perf: sharing of cpuctx between core and ibs PMU causes problems

2012-08-09 Thread Stephane Eranian
On Thu, Aug 9, 2012 at 8:55 AM, Yan, Zheng wrote: > On 08/09/2012 08:51 AM, Stephane Eranian wrote: >> Hi, >> >> I ran into a problem on my AMD box whereby I would hit the >> WARN_ON_ONCE(cpuctx->cgrp) in perf_cgroup_switch(). >> >> It took me a while to track this down. It turns out that the >> l

Re: [BUG] perf: sharing of cpuctx between core and ibs PMU causes problems

2012-08-08 Thread Yan, Zheng
On 08/09/2012 08:51 AM, Stephane Eranian wrote: > Hi, > > I ran into a problem on my AMD box whereby I would hit the > WARN_ON_ONCE(cpuctx->cgrp) in perf_cgroup_switch(). > > It took me a while to track this down. It turns out that the > list_for_each_entry_rcu() loop had multiple iterations. Tha

[BUG] perf: sharing of cpuctx between core and ibs PMU causes problems

2012-08-08 Thread Stephane Eranian
Hi, I ran into a problem on my AMD box whereby I would hit the WARN_ON_ONCE(cpuctx->cgrp) in perf_cgroup_switch(). It took me a while to track this down. It turns out that the list_for_each_entry_rcu() loop had multiple iterations. That's normal, we have CPU PMU and IBS PMU. But what caused the