lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 4 Jul 2013 14:44:08 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	"Yan, Zheng" <zheng.z.yan@...el.com>
Cc:	linux-kernel@...r.kernel.org, mingo@...nel.org, eranian@...gle.com,
	andi@...stfloor.org
Subject: Re: [PATCH v2 4/7] perf, x86: Save/resotre LBR stack during context
 switch

On Mon, Jul 01, 2013 at 03:23:04PM +0800, Yan, Zheng wrote:
> From: "Yan, Zheng" <zheng.z.yan@...el.com>
> 
> When the LBR call stack is enabled, it is necessary to save/restore
> the LBR stack on context switch. The solution is saving/restoring
> the LBR stack to/from task's perf event context.
> 
> If there are cpu-wide events that use LBR, do not save/restore the
> LBR stack on context switches, flush it instead.

Again inadequate changelog; it fails to explain wtf this is:

> +	if (event->ctx->task &&
> +	    branch_user_callstack(event->hw.branch_reg.reg)) {
> +		struct x86_perf_event_context *task_ctx = (void *)event->ctx;
> +		/*
> +		 * Reset the LBR stack if the call stack is not
> +		 * continuous enabled
> +		 */
> +		if (task_ctx->lbr_callstack_users == 0 &&
> +		    task_ctx->lbr_stack_gen + 1 < event->ctx->sched_gen)
> +			intel_pmu_lbr_reset();
> +
> +		task_ctx->lbr_callstack_users++;
> +		task_ctx->lbr_stack_gen = event->ctx->sched_gen;
> +	}
>  }

And what this parent_ctx nonsense is about:

> +void intel_pmu_lbr_init_context(struct perf_event_context *child_ctx,
> +				struct perf_event_context *parent_ctx)
> +{
> +	struct x86_perf_event_context *task_ctx, *parent_task_ctx;
> +
> +	if (!x86_pmu.lbr_nr)
> +		return;
> +
> +	task_ctx = (struct x86_perf_event_context *)child_ctx;
> +	parent_task_ctx = (struct x86_perf_event_context *)parent_ctx;
> +
> +	if (parent_task_ctx->lbr_callstack_users)
> +		__intel_pmu_lbr_save(task_ctx);
> +	else
> +		task_ctx->lbr_stack_saved = false;
> +}
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ