[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140924133321.GD2805@worktop.programming.kicks-ass.net>
Date: Wed, 24 Sep 2014 15:33:21 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: kan.liang@...el.com
Cc: eranian@...gle.com, linux-kernel@...r.kernel.org, mingo@...hat.com,
paulus@...ba.org, acme@...nel.org, ak@...ux.intel.com,
"Yan, Zheng" <zheng.z.yan@...el.com>
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@...el.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?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists