]> git.baikalelectronics.ru Git - kernel.git/commit
perf_event: Fix cgrp event scheduling bug in perf_enable_on_exec()
authorStephane Eranian <eranian@google.com>
Wed, 6 Apr 2011 00:54:54 +0000 (02:54 +0200)
committerIngo Molnar <mingo@elte.hu>
Mon, 11 Apr 2011 09:07:55 +0000 (11:07 +0200)
commitfb19ef8f0aaaf9ee987120d00e206d5ccaeb40e2
tree5d8fa756453cb6f60554c6c253a3cf2a01945628
parentad81c1ca51075972b782d6b180599ab42e8470e6
perf_event: Fix cgrp event scheduling bug in perf_enable_on_exec()

There is a bug in perf_event_enable_on_exec() when cgroup events are
active on a CPU: the cgroup events may be scheduled twice causing event
state corruptions which eventually may lead to kernel panics.

The reason is that the function needs to first schedule out the cgroup
events, just like for the per-thread events. The cgroup event are
scheduled back in automatically from the perf_event_context_sched_in()
function.

The patch also adds a WARN_ON_ONCE() is perf_cgroup_switch() to catch any
bogus state.

Signed-off-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20110406005454.GA1062@quad
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/perf_event.c