Messages in this thread | | | Date | Tue, 7 Jun 2011 14:10:50 +0200 | From | Jiri Olsa <> | Subject | Re: [PATCH] perf, core: Fix initial task_ctx/event installation |
| |
On Tue, Jun 07, 2011 at 12:28:56AM +0200, Jiri Olsa wrote: > On Tue, Jun 07, 2011 at 12:23:28AM +0200, Peter Zijlstra wrote: > > This works for me.. > > > > --- > > kernel/events/core.c | 28 +++++++++++++++++----------- > > 1 files changed, 17 insertions(+), 11 deletions(-) > > > > diff --git a/kernel/events/core.c b/kernel/events/core.c > > index ba89f40..5e8c7b1 100644 > > --- a/kernel/events/core.c > > +++ b/kernel/events/core.c > > @@ -1505,25 +1505,31 @@ static int __perf_install_in_context(void *info) > > struct perf_event_context *task_ctx = cpuctx->task_ctx; > > struct task_struct *task = current; > > > > - perf_ctx_lock(cpuctx, cpuctx->task_ctx); > > + perf_ctx_lock(cpuctx, task_ctx); > > perf_pmu_disable(cpuctx->ctx.pmu); > > > > /* > > * If there was an active task_ctx schedule it out. > > */ > > - if (task_ctx) { > > + if (task_ctx) > > task_ctx_sched_out(task_ctx); > > - /* > > - * If the context we're installing events in is not the > > - * active task_ctx, flip them. > > - */ > > - if (ctx->task && task_ctx != ctx) { > > - raw_spin_unlock(&cpuctx->ctx.lock); > > - raw_spin_lock(&ctx->lock); > > - cpuctx->task_ctx = task_ctx = ctx; > > - } > > + > > + /* > > + * If the context we're installing events in is not the > > + * active task_ctx, flip them. > > + */ > > + if (ctx->task && task_ctx != ctx) { > > + if (task_ctx) > > + raw_spin_unlock(&task_ctx->lock); > > + raw_spin_lock(&ctx->lock); > > + task_ctx = ctx; > > + } > > + > > + if (task_ctx) { > > + cpuctx->task_ctx = task_ctx; > > task = task_ctx->task; > > } > > + > > cpu_ctx_sched_out(cpuctx, EVENT_ALL); > > > > update_context_time(ctx); > > > > > > just came back :) seems ok.. I'll test tomorow and let you know works ok for me
thanks, jirka
| |