From: Peter Zijlstra <peterz@infradead.org>
To: Stephane Eranian <eranian@google.com>
Cc: "Yan, Zheng" <zheng.z.yan@linux.intel.com>,
"Yan, Zheng" <zheng.z.yan@intel.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf, x86: Fix Intel shared extra MSR allocation
Date: Tue, 05 Jun 2012 15:56:26 +0200 [thread overview]
Message-ID: <1338904586.28282.183.camel@twins> (raw)
In-Reply-To: <1338903031.28282.175.camel@twins>
On Tue, 2012-06-05 at 15:30 +0200, Peter Zijlstra wrote:
> @@ -1157,14 +1163,14 @@ __intel_shared_reg_get_constraints(struct cpu_hw_events *cpuc,
> struct event_constraint *c = &emptyconstraint;
> struct er_account *era;
> unsigned long flags;
> - int orig_idx = reg->idx;
> + int idx = reg->idx;
>
> /* already allocated shared msr */
> if (reg->alloc)
> return NULL; /* call x86_get_event_constraint() */
I'm afraid that needs to be:
/*
* reg->alloc can be set due to existing state, so for fake cpuc
* we need to ignore this, otherwise we might fail to allocate
* proper fake state for this extra reg constraint. Also see
* the comment below.
*/
if (reg->alloc && !cpuc->is_fake)
return NULL; /* call x86_get_event_constraints() */
>
> again:
> - era = &cpuc->shared_regs->regs[reg->idx];
> + era = &cpuc->shared_regs->regs[idx];
> /*
> * we use spin_lock_irqsave() to avoid lockdep issues when
> * passing a fake cpuc
> @@ -1173,6 +1179,29 @@ __intel_shared_reg_get_constraints(struct cpu_hw_events *cpuc,
>
> if (!atomic_read(&era->ref) || era->config == reg->config) {
>
> + /*
> + * If its a fake cpuc -- as per validate_{group,event}() we
> + * shouldn't touch event state and we can avoid doing so
> + * since both will only call get_event_constraints() once
> + * on each event, this avoids the need for reg->alloc.
> + *
> + * Not doing the ER fixup will only result in era->reg being
> + * wrong, but since we won't actually try and program hardware
> + * this isn't a problem either.
> + */
> + if (!cpuc->is_fake) {
> + if (idx != reg->idx)
> + intel_fixup_er(event, idx);
> +
> + /*
> + * x86_schedule_events() can call get_event_constraints()
> + * multiple times on events in the case of incremental
> + * scheduling(). reg->alloc ensures we only do the ER
> + * allocation once.
> + */
> + reg->alloc = 1;
> + }
> +
> /* lock in msr value */
> era->config = reg->config;
> era->reg = reg->reg;
next prev parent reply other threads:[~2012-06-05 13:56 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-01 3:20 [PATCH] perf: Fix intel shared extra msr allocation Yan, Zheng
2012-06-01 9:35 ` Stephane Eranian
2012-06-01 14:11 ` Yan, Zheng
2012-06-04 13:12 ` Stephane Eranian
2012-06-05 2:18 ` Yan, Zheng
2012-06-05 10:14 ` Peter Zijlstra
2012-06-05 10:21 ` Stephane Eranian
2012-06-05 10:27 ` Peter Zijlstra
2012-06-05 10:38 ` Stephane Eranian
2012-06-05 12:07 ` Peter Zijlstra
2012-06-05 12:39 ` Peter Zijlstra
2012-06-05 12:51 ` Stephane Eranian
2012-06-05 13:04 ` Peter Zijlstra
2012-06-05 13:30 ` [PATCH] perf, x86: Fix Intel shared extra MSR allocation Peter Zijlstra
2012-06-05 13:56 ` Peter Zijlstra [this message]
2012-06-05 21:26 ` Stephane Eranian
2012-06-06 1:00 ` Yan, Zheng
2012-06-06 15:57 ` [tip:perf/core] perf/x86: " tip-bot for Peter Zijlstra
2012-06-06 16:11 ` tip-bot for Peter Zijlstra
2012-06-05 13:31 ` [PATCH] perf: Fix intel shared extra msr allocation Stephane Eranian
2012-06-05 13:32 ` Peter Zijlstra
2012-06-05 13:38 ` Stephane Eranian
2012-06-05 13:47 ` Peter Zijlstra
2012-06-05 13:51 ` Stephane Eranian
2012-06-06 10:12 ` Stephane Eranian
2012-06-07 1:25 ` Yan, Zheng
2012-06-07 4:01 ` Yan, Zheng
-- strict thread matches above, loose matches on Subject: below --
2012-06-05 21:35 [PATCH] perf, x86: Fix Intel shared extra MSR allocation Stephane Eranian
2012-06-06 10:35 ` Stephane Eranian
2012-06-06 10:36 ` Peter Zijlstra
2012-06-06 10:53 ` Peter Zijlstra
2012-06-06 11:43 ` Stephane Eranian
2012-06-06 11:57 ` Stephane Eranian
2012-06-06 12:06 ` Peter Zijlstra
2012-06-06 12:08 ` Stephane Eranian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1338904586.28282.183.camel@twins \
--to=peterz@infradead.org \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=zheng.z.yan@intel.com \
--cc=zheng.z.yan@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.