Messages in this thread | | | Date | Wed, 24 Sep 2014 15:33:21 +0200 | From | Peter Zijlstra <> | Subject | Re: [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?
| |