[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140605134235.GK3213@twins.programming.kicks-ass.net>
Date: Thu, 5 Jun 2014 15:42:35 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Stephane Eranian <eranian@...gle.com>
Cc: linux-kernel@...r.kernel.org, mingo@...e.hu, ak@...ux.intel.com,
jolsa@...hat.com, zheng.z.yan@...el.com,
maria.n.dimakopoulou@...il.com
Subject: Re: [PATCH 5/9] perf/x86: implement cross-HT corruption bug
workaround
On Wed, Jun 04, 2014 at 11:34:14PM +0200, Stephane Eranian wrote:
> +static void intel_commit_scheduling(struct cpu_hw_events *cpuc,
> + struct perf_event *event, int cntr)
> +{
> + struct intel_excl_cntrs *excl_cntrs = cpuc->excl_cntrs;
> + struct event_constraint *c = event->hw.constraint;
> + struct intel_excl_states *xlo, *xl;
> + int tid = cpuc->excl_thread_id;
> + int o_tid = 1 - tid;
> + int is_excl;
> +
> + if (cpuc->is_fake || !c)
> + return;
> +
> + is_excl = c->flags & PERF_X86_EVENT_EXCL;
> +
> + if (!(c->flags & PERF_X86_EVENT_DYNAMIC))
> + return;
> +
> + WARN_ON_ONCE(!excl_cntrs);
> +
> + if (!excl_cntrs)
> + return;
> +
> + xl = &excl_cntrs->states[tid];
> + xlo = &excl_cntrs->states[o_tid];
> +
> + WARN_ON_ONCE(!spin_is_locked(&excl_cntrs->lock));
Use:
lockdep_assert_held(&excl_cntrs->lock);
It also checks to see the current context is actually the lock holder,
and it doesn't generate any code when !lockdep.
> +
> + if (cntr >= 0) {
> + if (is_excl)
> + xlo->init_state[cntr] = INTEL_EXCL_EXCLUSIVE;
> + else
> + xlo->init_state[cntr] = INTEL_EXCL_SHARED;
> + }
> }
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists