From: Will Deacon <will.deacon@arm.com>
To: Vince Weaver <vweaver1@eecs.utk.edu>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
sam wang <linux.swang@gmail.com>, Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>,
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
Stephane Eranian <eranian@gmail.com>
Subject: Re: [patch] perf: ARMv7 wrong "branches" generalized instruction
Date: Wed, 10 Aug 2011 23:07:27 +0100 [thread overview]
Message-ID: <20110810220727.GA5270@e102144-lin.cambridge.arm.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1108101452510.25186@cl320.eecs.utk.edu>
On Wed, Aug 10, 2011 at 08:01:20PM +0100, Vince Weaver wrote:
> On Wed, 10 Aug 2011, Will Deacon wrote:
>
> > > It turns out the branches event used (ARMV7_PERFCTR_PC_WRITE) only seems
> > > to count taken branches.
> >
> > It also counts exceptions and instructions that write to the PC.
>
> are those more common than not-taken branches? I'd think branch predictor
> statistics will be a bit off if only taken instructions are measured.
They're almost certainly not as common in normal code. However, as I've
mentioned below, ARMV7_PERFCTR_PC_IMM_BRANCH only counts immediate branches
so I don't think this is so useful for general consumption.
> > > ARMV7_PERFCTR_PC_IMM_BRANCH seems to do a better job of counting both
> > > taken and not-taken. So I've attached a patch to change the definition
> > > for Cotex A9.
> >
> > Well, it also only considers immediate branches so whilst it might
> > satisy your test, I think that overall it's a less meaningful number.
>
> I guess there isn't more info available about which branches exactly are
> counted by all the events? I've gone through the trouble of writing such
> tests to find out experimentally what various counters count for x86, it
> would be sad to have to do it again for ARM.
The problem is, it's largely CPU specific. This has improved slightly with
newer cores and there is a PMUv2 document which describes common
architectural events and their reserved numbers, but it is still optional
for the CPU to implement these (notably, Cortex-A9 doesn't implement the
architected instruction counter).
Whilst your tests sound useful, to get any meaningful results out of ARM you
will need to either skip difficult tests or make them CPU specific and use the
raw encodings.
> > (b) start replacing our generalised events with HW_OP_UNSUPPORTED and force
> > the user to use raw events. I agree this isn't very friendly, but it's
> > better than giving them crazy results [for example, we currently report
> > more cache misses than cache references on A9 iirc].
> >
> > Personally, I'm favour of (b) and getting userspace to provide the user with
> > a CPU-specific event listing and then translate this to raw events using
> > something like libpfm.
>
> I agree 100%, but it's an unpopular opinion on linux-kernel. (Note that
> I'm the one who contributed ARM Cortex A8/A9 support to both libpfm4 and
> PAPI).
I can see why it's an unpopular idea if it's not necessary on your
architecture but for ARM it's really the only way forward without continuing
to introduce a mess of sparsely populated event tables every time a new CPU
crops up.
> Since the generalized events are there and ABI though, people are going to
> use them. That's why I've been writing tests that check them to see
> exactly what they are measuring.
Right, but as I say, `instructions' on one core might not be `instructions'
on another core. Just removing the ABI types from ARM will at least stop
people using them. From what I've seen of perf users on ARM, they start with
the ABI events, get some nonsensical results and then switch exclusively to
raw events from then on.
> It's still an important issue to know what "branches" measures, just it
> probably shouldn't be a kernel issue like it's become.
The TRM for the A9 will describe various events for counting branch-related
events. These may be specific to the pipeline and micro-architecture and
therefore you can't really tar them all with the same brush.
Will
next prev parent reply other threads:[~2011-08-10 22:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-10 17:40 Vince Weaver
2011-08-10 18:33 ` Will Deacon
2011-08-10 19:01 ` Vince Weaver
2011-08-10 19:16 ` Måns Rullgård
2011-08-10 22:07 ` Will Deacon [this message]
2011-08-11 8:15 ` Ingo Molnar
2011-08-11 9:16 ` Will Deacon
2011-08-12 10:34 ` Ingo Molnar
2011-08-15 11:18 ` Will Deacon
2011-08-12 4:35 ` Vince Weaver
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=20110810220727.GA5270@e102144-lin.cambridge.arm.com \
--to=will.deacon@arm.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=eranian@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux.swang@gmail.com \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=vweaver1@eecs.utk.edu \
/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
all inboxes | Powered by JetHome®