lkml.org 
[lkml]   [2014]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V5 09/16] perf, x86: Save/resotre LBR stack during context switch
On Wed, Sep 10, 2014 at 10:09:06AM -0400, kan.liang@intel.com wrote:
> void intel_pmu_lbr_sched_task(struct perf_event_context *ctx, bool sched_in)
> {
> struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
> + struct x86_perf_task_context *task_ctx;
>
> if (!x86_pmu.lbr_nr)
> return;
> /*
> + * If LBR callstack feature is enabled and the stack was saved when
> + * the task was scheduled out, restore the stack. Otherwise flush
> + * the LBR stack.
> + */
> + task_ctx = ctx ? ctx->task_ctx_data : NULL;
> + if (task_ctx) {
> + if (sched_in) {
> + __intel_pmu_lbr_restore(task_ctx);
> + cpuc->lbr_context = ctx;
> + } else {
> + __intel_pmu_lbr_save(task_ctx);
> + }
> + }
> +
> + /*
> * When sampling the branck stack in system-wide, it may be
> * necessary to flush the stack on context switch. This happens
> * when the branch stack does not tag its entries with the pid

Why would we still need to reset if we did a save/restore on the branch
stack?


\
 
 \ /
  Last update: 2014-09-24 16:01    [W:0.240 / U:0.556 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site