• Alexey Budankov's avatar
    perf/x86/intel: Implement LBR callstack context synchronization · 421ca868
    Alexey Budankov authored
    Implement intel_pmu_lbr_swap_task_ctx() method updating counters
    of the events that requested LBR callstack data on a sample.
    
    The counter can be zero for the case when task context belongs to
    a thread that has just come from a block on a futex and the context
    contains saved (lbr_stack_state == LBR_VALID) LBR register values.
    
    For the values to be restored at LBR registers on the next thread's
    switch-in event it swaps the counter value with the one that is
    expected to be non zero at the previous equivalent task perf event
    context.
    
    Swap operation type ensures the previous task perf event context
    stays consistent with the amount of events that requested LBR
    callstack data on a sample.
    Signed-off-by: default avatarAlexey Budankov <alexey.budankov@linux.intel.com>
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Ian Rogers <irogers@google.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Kan Liang <kan.liang@linux.intel.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Song Liu <songliubraving@fb.com>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Vince Weaver <vincent.weaver@maine.edu>
    Link: https://lkml.kernel.org/r/261ac742-9022-c3f4-5885-1eae7415b091@linux.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    421ca868
perf_event.h 30.2 KB