mirror of https://gitee.com/openkylin/linux.git
perf: Fix EXIT event notification
The perf_event_task_ctx() function needs to be called with preemption disabled, since it's checking for currently scheduled cpu against event cpu. We disable preemption for task related perf event context if there's one defined, leaving up to the chance which cpu it gets scheduled in. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Stephane Eranian <eranian@google.com> Cc: Borislav Petkov <bp@alien8.de> Link: http://lkml.kernel.org/r/1367857638-27631-2-git-send-email-jolsa@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
534c97b095
commit
524eff183f
|
@ -4474,7 +4474,7 @@ static void perf_event_task_ctx(struct perf_event_context *ctx,
|
||||||
static void perf_event_task_event(struct perf_task_event *task_event)
|
static void perf_event_task_event(struct perf_task_event *task_event)
|
||||||
{
|
{
|
||||||
struct perf_cpu_context *cpuctx;
|
struct perf_cpu_context *cpuctx;
|
||||||
struct perf_event_context *ctx;
|
struct perf_event_context *ctx, *task_ctx = task_event->task_ctx;
|
||||||
struct pmu *pmu;
|
struct pmu *pmu;
|
||||||
int ctxn;
|
int ctxn;
|
||||||
|
|
||||||
|
@ -4485,20 +4485,22 @@ static void perf_event_task_event(struct perf_task_event *task_event)
|
||||||
goto next;
|
goto next;
|
||||||
perf_event_task_ctx(&cpuctx->ctx, task_event);
|
perf_event_task_ctx(&cpuctx->ctx, task_event);
|
||||||
|
|
||||||
ctx = task_event->task_ctx;
|
if (task_ctx)
|
||||||
if (!ctx) {
|
goto next;
|
||||||
ctxn = pmu->task_ctx_nr;
|
ctxn = pmu->task_ctx_nr;
|
||||||
if (ctxn < 0)
|
if (ctxn < 0)
|
||||||
goto next;
|
goto next;
|
||||||
ctx = rcu_dereference(current->perf_event_ctxp[ctxn]);
|
ctx = rcu_dereference(current->perf_event_ctxp[ctxn]);
|
||||||
if (ctx)
|
if (ctx)
|
||||||
perf_event_task_ctx(ctx, task_event);
|
perf_event_task_ctx(ctx, task_event);
|
||||||
}
|
|
||||||
next:
|
next:
|
||||||
put_cpu_ptr(pmu->pmu_cpu_context);
|
put_cpu_ptr(pmu->pmu_cpu_context);
|
||||||
}
|
}
|
||||||
if (task_event->task_ctx)
|
if (task_ctx) {
|
||||||
perf_event_task_ctx(task_event->task_ctx, task_event);
|
preempt_disable();
|
||||||
|
perf_event_task_ctx(task_ctx, task_event);
|
||||||
|
preempt_enable();
|
||||||
|
}
|
||||||
|
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue