]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
perf_counter: Fix a race on perf_counter_ctx
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Fri, 7 Aug 2009 17:49:01 +0000 (19:49 +0200)
committerIngo Molnar <mingo@elte.hu>
Sun, 9 Aug 2009 10:54:46 +0000 (12:54 +0200)
commit3a80b4a3539696f4b0574876326860323035a302
tree9d2901259a2b25b181997f89495452fd7f06827b
parent3a43ce68ae1758fa6a839386025ef45acb6baa22
perf_counter: Fix a race on perf_counter_ctx

While extending perfcounters with BTS hw-tracing, Markus
Metzger managed to trigger this warning:

   [  995.557128] WARNING: at kernel/perf_counter.c:1191 __perf_counter_task_sched_out+0x48/0x6b()

triggers because commit
9f498cc5be7e013d8d6e4c616980ed0ffc8680d2 (perf_counter: Full
task tracing) removed clearing of tsk->perf_counter_ctxp out
from under ctx->lock which introduced a race (against
perf_lock_task_context).

Move it back and deal with the exit notification by explicitly
passing along the former task context.

Reported-by: Markus T Metzger <markus.t.metzger@intel.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1249667341.17467.5.camel@twins>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/perf_counter.c