Re: [PATCH 5/9] perf/x86: implement cross-HT corruption bug workaround
From: Peter Zijlstra
Date: Thu Jun 05 2014 - 09:38:52 EST
On Wed, Jun 04, 2014 at 11:34:14PM +0200, Stephane Eranian wrote:
> static void
> +intel_start_scheduling(struct cpu_hw_events *cpuc)
> +{
> + /*
> + * lock shared state until we are done scheduling
> + * in stop_event_scheduling()
> + * makes scheduling appear as a transaction
> + */
> + spin_lock_irqsave(&excl_cntrs->lock, excl_cntrs->lock_flags);
> +
> + /*
> + * save initial state of sibling thread
> + */
> + memcpy(xlo->init_state, xlo->state, sizeof(xlo->init_state));
> +}
> +
> +static void
> +intel_stop_scheduling(struct cpu_hw_events *cpuc)
> +{
> + /*
> + * make new sibling thread state visible
> + */
> + memcpy(xlo->state, xlo->init_state, sizeof(xlo->state));
> +
> + xl->sched_started = false;
> + /*
> + * release shared state lock (lock acquire in intel_start_scheduling())
> + */
> + spin_unlock_irqrestore(&excl_cntrs->lock, excl_cntrs->lock_flags);
> +}
Do you really need the irqsave/irqrestore? From what I can tell this is
always called under perf_event_context::lock and that is already an
IRQ-safe lock, so interrupts should always be disabled here.
Also, it looks like xl->state is the effective state, and ->init_state
is the work state? Is init the right name for this?
Attachment:
pgpTwNb5pdMXB.pgp
Description: PGP signature