• Peter Zijlstra's avatar
    perf: Cure task_oncpu_function_call() races · fe4b04fa
    Peter Zijlstra authored
    Oleg reported that on architectures with
    __ARCH_WANT_INTERRUPTS_ON_CTXSW the IPI from
    task_oncpu_function_call() can land before perf_event_task_sched_in()
    and cause interesting situations for eg. perf_install_in_context().
    
    This patch reworks the task_oncpu_function_call() interface to give a
    more usable primitive as well as rework all its users to hopefully be
    more obvious as well as remove the races.
    
    While looking at the code I also found a number of races against
    perf_event_task_sched_out() which can flip contexts between tasks so
    plug those too.
    Reported-and-reviewed-by: default avatarOleg Nesterov <oleg@redhat.com>
    Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
    LKML-Reference: <new-submission>
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    fe4b04fa
perf_event.c 154 KB