Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1252831
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 5/5] x86, perf: Avoid context switching LBR_INFO when not needed |
| Date | 2015-10-21 15:50 +0200 |
| Message-ID | <qm1Wa-4CG-7@gated-at.bofh.it> (permalink) |
| References | <qlK8W-3Ji-9@gated-at.bofh.it> <qlK8W-3Ji-29@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Oct 20, 2015 at 11:46:37AM -0700, Andi Kleen wrote:
> +++ b/arch/x86/kernel/cpu/perf_event_intel.c
> @@ -2844,7 +2844,7 @@ static void intel_pmu_cpu_starting(int cpu)
> /*
> * Deal with CPUs that don't clear their LBRs on power-up.
> */
> - intel_pmu_lbr_reset();
> + intel_pmu_lbr_reset(1);
s/1/true/ ?
> @@ -242,7 +245,7 @@ static void __intel_pmu_lbr_restore(struct x86_perf_task_context *task_ctx)
>
> if (task_ctx->lbr_callstack_users == 0 ||
> task_ctx->lbr_stack_state == LBR_NONE) {
> - intel_pmu_lbr_reset();
> + intel_pmu_lbr_reset(task_ctx->need_info > 0);
> return;
> }
>
> @@ -317,7 +320,7 @@ void intel_pmu_lbr_sched_task(struct perf_event_context *ctx, bool sched_in)
> * stack with branch from multiple tasks.
> */
> if (sched_in) {
> - intel_pmu_lbr_reset();
> + intel_pmu_lbr_reset(!task_ctx || task_ctx->need_info > 0);
> cpuc->lbr_context = ctx;
> }
> }
> @@ -340,7 +343,7 @@ void intel_pmu_lbr_enable(struct perf_event *event)
> * avoid data leaks.
> */
> if (event->ctx->task && cpuc->lbr_context != event->ctx) {
> - intel_pmu_lbr_reset();
> + intel_pmu_lbr_reset(!(event->hw.branch_reg.reg & LBR_NO_INFO));
> cpuc->lbr_context = event->ctx;
> }
> cpuc->br_sel = event->hw.branch_reg.reg;
Are you sure none of that will result in some data leak in a weird corner
case?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 1/5] x86, perf: Fix LBR call stack save/restore Andi Kleen <andi@firstfloor.org> - 2015-10-20 20:50 +0200
[PATCH 5/5] x86, perf: Avoid context switching LBR_INFO when not needed Andi Kleen <andi@firstfloor.org> - 2015-10-20 20:50 +0200
Re: [PATCH 5/5] x86, perf: Avoid context switching LBR_INFO when not needed Peter Zijlstra <peterz@infradead.org> - 2015-10-21 15:50 +0200
[PATCH 3/5] perf, tools: Disable branch flags/cycles for --callgraph lbr Andi Kleen <andi@firstfloor.org> - 2015-10-20 21:00 +0200
Re: [PATCH 3/5] perf, tools: Disable branch flags/cycles for --callgraph lbr Peter Zijlstra <peterz@infradead.org> - 2015-10-21 15:30 +0200
Re: [PATCH 3/5] perf, tools: Disable branch flags/cycles for --callgraph lbr Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-21 20:10 +0200
Re: [PATCH 1/5] x86, perf: Fix LBR call stack save/restore Peter Zijlstra <peterz@infradead.org> - 2015-10-21 15:20 +0200
Re: [PATCH 1/5] x86, perf: Fix LBR call stack save/restore Andi Kleen <andi@firstfloor.org> - 2015-10-21 16:40 +0200
Re: [PATCH 1/5] x86, perf: Fix LBR call stack save/restore Ingo Molnar <mingo@kernel.org> - 2015-10-21 18:30 +0200
csiph-web