lkml.org 
[lkml]   [2016]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [tip:perf/core] perf: Fix race in perf_event_exec()
    From
    On Wed, Jan 6, 2016 at 1:46 PM, tip-bot for Peter Zijlstra
    <tipbot@zytor.com> wrote:

    >
    > This is because context switches can swap the task_struct::perf_event_ctxp[]
    > pointer around. Therefore you have to either disable preemption when looking
    > at current, or hold ctx->lock.
    >


    >
    > void perf_event_exec(void)
    > {
    > - struct perf_event_context *ctx;
    > int ctxn;
    >
    > rcu_read_lock();

    Do we still need this rcu_read_lock(), if perf_event_enable_on_exec()
    uses local_irq_save( ?

    > - for_each_task_context_nr(ctxn) {
    > - ctx = current->perf_event_ctxp[ctxn];
    > - if (!ctx)
    > - continue;
    > -
    > - perf_event_enable_on_exec(ctx);
    > - }
    > + for_each_task_context_nr(ctxn)
    > + perf_event_enable_on_exec(ctxn);
    > rcu_read_unlock();
    > }
    >


    \
     
     \ /
      Last update: 2016-01-06 20:21    [W:3.007 / U:0.508 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site