• Peter Zijlstra's avatar
    perf/core: Fix time on IOC_ENABLE · 9b231d9f
    Peter Zijlstra authored
    Vince reported that when we do IOC_ENABLE/IOC_DISABLE while the task
    is SIGSTOP'ed state the timestamps go wobbly.
    
    It turns out we indeed fail to correctly account time while in 'OFF'
    state and doing IOC_ENABLE without getting scheduled in exposes the
    problem.
    
    Further thinking about this problem, it occurred to me that we can
    suffer a similar fate when we migrate an uncore event between CPUs.
    The perf_event_install() on the 'new' CPU will do add_event_to_ctx()
    which will reset all the time stamp, resulting in a subsequent
    update_event_times() to overwrite the total_time_* fields with smaller
    values.
    Reported-by: default avatarVince Weaver <vincent.weaver@maine.edu>
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
    9b231d9f
core.c 265 KB