android_kernel_motorola_sm6225/include
Peter Zijlstra ab711fe082 perf: Fix task context scheduling
Jiri reported:

 |
 | - once an event is created by sys_perf_event_open, task context
 |   is created and it stays even if the event is closed, until the
 |   task is finished ... thats what I see in code and I assume it's
 |   correct
 |
 | - when the task opens event, perf_sched_events jump label is
 |   incremented and following callbacks are started from scheduler
 |
 |         __perf_event_task_sched_in
 |         __perf_event_task_sched_out
 |
 |   These callback *in/out set/unset cpuctx->task_ctx value to the
 |   task context.
 |
 | - close is called on event on CPU 0:
 |         - the task is scheduled on CPU 0
 |         - __perf_event_task_sched_in is called
 |         - cpuctx->task_ctx is set
 |         - perf_sched_events jump label is decremented and == 0
 |         - __perf_event_task_sched_out is not called
 |         - cpuctx->task_ctx on CPU 0 stays set
 |
 | - exit is called on CPU 1:
 |         - the task is scheduled on CPU 1
 |         - perf_event_exit_task is called
 |         - task_ctx_sched_out unsets cpuctx->task_ctx on CPU 1
 |         - put_ctx destroys the context
 |
 | - another call of perf_rotate_context on CPU 0 will use invalid
 |   task_ctx pointer, and eventualy panic.
 |

Cure this the simplest possibly way by partially reverting the
jump_label optimization for the sched_out case.

Reported-and-tested-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: <stable@kernel.org> # .37+
LKML-Reference: <1301520405.4859.213.camel@twins>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2011-03-31 13:02:55 +02:00
..
acpi Merge branch 'linus' into release 2011-03-23 02:34:54 -04:00
asm-generic Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2011-03-25 17:52:22 -07:00
crypto
drm drm/vblank: update recently added vbl interface to be more future proof. 2011-03-24 21:28:46 +10:00
keys
linux perf: Fix task context scheduling 2011-03-31 13:02:55 +02:00
math-emu
media [media] videobuf2-dma-contig: make cookie() return a pointer to dma_addr_t 2011-03-22 19:41:58 -03:00
mtd
net xfrm: Assign esn pointers when cloning a state 2011-03-28 23:34:52 -07:00
pcmcia
rdma
rxrpc
scsi [SCSI] libiscsi_tcp: use kmap in xmit path 2011-03-23 11:36:58 -05:00
sound ALSA: vmalloc buffers should use normal mmap 2011-03-25 11:13:12 +01:00
staging [media] Altera FPGA firmware download module 2011-03-21 20:32:16 -03:00
target [SCSI] target: add initial statistics 2011-03-23 11:36:50 -05:00
trace Merge branch 'for-linus-unmerged' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable 2011-03-28 15:31:05 -07:00
video atmel_lcdfb: implement inverted contrast pwm 2011-03-22 16:23:44 +09:00
xen Merge branch 'stable/xen.pm.bug-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen 2011-03-17 18:37:42 -07:00
Kbuild