Re: [PATCH v2 11/11] perf/x86: Simplify put_exclusive_constraints

From: Peter Zijlstra
Date: Fri May 22 2015 - 09:38:55 EST


On Fri, May 22, 2015 at 03:29:16PM +0200, Peter Zijlstra wrote:
> @@ -2149,22 +2147,25 @@ static void intel_put_excl_constraints(s
> }
>
> /*
> + * If event was actually assigned, then mark the counter state as
> + * unused now.
> */
> + if (hwc->idx >= 0) {
> + xl = &excl_cntrs->states[tid];
> +
> + /*
> + * put_constraint may be called from x86_schedule_events()
> + * which already has the lock held so here make locking
> + * conditional.
> + */
> + if (!xl->sched_started)
> + raw_spin_lock(&excl_cntrs->lock);
>
> xl->state[hwc->idx] = INTEL_EXCL_UNUSED;
>
> + if (!xl->sched_started)
> + raw_spin_unlock(&excl_cntrs->lock);
> + }
> }

Hmm, we could probably avoid the lock and use WRITE_ONCE() to clear this
state, but I'm too tired to really think about it.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/