From: Stephane Eranian <eranian@google.com>
To: linux-kernel@vger.kernel.org
Cc: peterz@infradead.org, mingo@elte.hu, zheng.z.yan@intel.com,
ak@linux.intel.com
Subject: [PATCH] perf/x86: fix uncore PCI fixed counter handling
Date: Mon, 9 Sep 2013 12:53:50 -0700 [thread overview]
Message-ID: <20130909195350.GA17643@google.com> (raw)
There was a bug in the handling of SNB-EP/IVB-EP uncore PCI
fixed counters, e.g., IMC. It would cause erratic values to
be returned for the IMC clockticks event. This was due to
a bogus hwc->config value which was then written to PCI
config space. The fixed counter has most fields marked as
reserved with hw reset values of 0. Yet the kernel was
defaulting to a hwc->config = ~0 and that was causing
the issues. The patch sets the hwc->config values for fixed
uncore event to 0. Now, the values of imc clockticks is
correct.
$ perf stat -a -C 0 -e uncore_imc_0/clockticks/ -I 1000 sleep 10
Signed-off-by: Stephane Eranian <eranian@google.com>
---
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index f14d9df..dfb4aa54 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -2707,7 +2707,7 @@ uncore_get_event_constraint(struct intel_uncore_box *box, struct perf_event *eve
return c;
}
- if (event->hw.config == ~0ULL)
+ if (event->attr.config == UNCORE_FIXED_EVENT)
return &constraint_fixed;
if (type->constraints) {
@@ -3011,7 +3011,9 @@ static int uncore_pmu_event_init(struct perf_event *event)
*/
if (pmu->type->single_fixed && pmu->pmu_idx > 0)
return -EINVAL;
- hwc->config = ~0ULL;
+
+ /* fixed counters have event field hardcoded to zero */
+ hwc->config = 0ULL;
} else {
hwc->config = event->attr.config & pmu->type->event_mask;
if (pmu->type->ops->hw_config) {
next reply other threads:[~2013-09-09 19:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-09 19:53 Stephane Eranian [this message]
2013-09-10 20:22 ` [PATCH] perf/x86: fix uncore PCI fixed counter handling Andi Kleen
2013-09-12 11:11 ` [tip:perf/urgent] perf/x86: Fix " tip-bot for 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=20130909195350.GA17643@google.com \
--to=eranian@google.com \
--cc=ak@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=zheng.z.yan@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox