From: Ingo Molnar <mingo@kernel.org>
To: Andi Kleen <andi@firstfloor.org>
Cc: peterz@infradead.org, linux-kernel@vger.kernel.org,
acme@infradead.org, jolsa@redhat.com, eranian@google.com
Subject: Re: perf, x86: Add parts of the remaining haswell PMU functionality
Date: Thu, 5 Sep 2013 19:04:57 +0200 [thread overview]
Message-ID: <20130905170457.GA27741@gmail.com> (raw)
In-Reply-To: <20130905151034.GP19750@two.firstfloor.org>
* Andi Kleen <andi@firstfloor.org> wrote:
> On Thu, Sep 05, 2013 at 03:15:02PM +0200, Ingo Molnar wrote:
> >
> > * Ingo Molnar <mingo@kernel.org> wrote:
> >
> > > One thing I'm not seeing in the current Haswell code is the config set
> > > up for PERF_COUNT_HW_STALLED_CYCLES_FRONTEND/BACKEND. Both SB and IB has
> > > them configured.
> >
> > Ping? Consider this a regression report.
>
> AFAIK they don't work. You only get the correct answer in some
> situations, but in others it either overestimates frontend or
> underestimates backend badly.
Well, at least the front-end side is still documented in the SDM as being
usable to count stalled cycles.
AFAICS backend stall cycles are documented to work on Ivy Bridge.
On Haswell there's only UOPS_EXECUTED.CORE (0xb1 0x02) - this will
over-count but could still be useful if we halved its value and considered
it only statistically correct.
For perf stat -a alike system-wide workloads it should still produce
usable results that way.
I.e. something like the patch below (it does not solve the double counting
yet).
Thanks,
Ingo
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index 0abf674..a61dd79 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -2424,6 +2424,10 @@ __init int intel_pmu_init(void)
intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] =
X86_CONFIG(.event=0x0e, .umask=0x01, .inv=1, .cmask=1);
+ /* UOPS_EXECUTED.THREAD,c=1,i=1 to count stall cycles*/
+ intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_BACKEND] =
+ X86_CONFIG(.event=0xb1, .umask=0x01, .inv=1, .cmask=1);
+
pr_cont("IvyBridge events, ");
break;
@@ -2450,6 +2454,15 @@ __init int intel_pmu_init(void)
x86_pmu.hw_config = hsw_hw_config;
x86_pmu.get_event_constraints = hsw_get_event_constraints;
x86_pmu.cpu_events = hsw_events_attrs;
+
+ /* UOPS_ISSUED.ANY,c=1,i=1 to count stall cycles */
+ intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] =
+ X86_CONFIG(.event=0x0e, .umask=0x01, .inv=1, .cmask=1);
+
+ /* UOPS_EXECUTED.CORE,c=1,i=1 to count stall cycles*/
+ intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_BACKEND] =
+ X86_CONFIG(.event=0xb1, .umask=0x02, .inv=1, .cmask=1);
+
pr_cont("Haswell events, ");
break;
next prev parent reply other threads:[~2013-09-05 17:05 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-09 1:15 perf, x86: Add parts of the remaining haswell PMU functionality Andi Kleen
2013-08-09 1:15 ` [PATCH 1/4] perf, x86: Avoid checkpointed counters causing excessive TSX aborts v4 Andi Kleen
2013-08-13 10:29 ` Peter Zijlstra
2013-08-09 1:15 ` [PATCH 2/4] perf, x86: Report TSX transaction abort cost as weight Andi Kleen
2013-08-13 11:23 ` Peter Zijlstra
2013-08-13 14:35 ` Andi Kleen
2013-08-13 15:27 ` Peter Zijlstra
2013-08-13 18:25 ` Andi Kleen
2013-08-14 9:33 ` Peter Zijlstra
2013-08-09 1:15 ` [PATCH 3/4] perf, x86: Add Haswell TSX event aliases v6 Andi Kleen
2013-08-09 1:15 ` [PATCH 4/4] perf, tools: Add perf stat --transaction v3 Andi Kleen
2013-09-02 6:55 ` perf, x86: Add parts of the remaining haswell PMU functionality Ingo Molnar
2013-09-05 13:15 ` Ingo Molnar
2013-09-05 15:10 ` Andi Kleen
2013-09-05 17:04 ` Ingo Molnar [this message]
2013-09-05 19:33 ` Andi Kleen
2013-09-05 17:12 ` Ingo Molnar
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=20130905170457.GA27741@gmail.com \
--to=mingo@kernel.org \
--cc=acme@infradead.org \
--cc=andi@firstfloor.org \
--cc=eranian@google.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).