From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: test for PMU feature on v7 (v2 with typo fix)
Date: Mon, 26 Mar 2012 10:40:54 +0100 [thread overview]
Message-ID: <20120326094054.GA2475@mudshark.cambridge.arm.com> (raw)
In-Reply-To: <87fwcy9abw.fsf@rustcorp.com.au>
[removed some dead email addresses from CC]
On Fri, Mar 23, 2012 at 11:17:07PM +0000, Rusty Russell wrote:
> On Fri, 23 Mar 2012 09:53:14 +0000, Will Deacon <will.deacon@arm.com> wrote:
> > On Fri, Mar 23, 2012 at 12:34:57AM +0000, Rusty Russell wrote:
> ...
> > > static struct arm_pmu *__init armv7_a8_pmu_init(void)
> > > {
> > > + if (!armv7_pmu_avail())
> > > + return NULL;
> >
> > This code is only executed if we know for sure that we are running on a
> > Cortex-A8. Cortex-A8 implementations have a PMU, so I don't like having the
> > probe here in case we are running on a virtualised CPU that doesn't quite
> > match the hardware.
>
> OK, I see that argument, but I don't like it. eg. the Cortex A-15 is
> defined to have a PMUv2 with 6 counters, and below you're arguing we
> should implement zero of them.
Well, I think you should actually implement all 6 of them if that's the
target which you're emulating. However, there are bigger peripherals to fry
than the PMU so if you want to get something working quickly then a dummy
PMU makes sense as a stopgap.
> I had assumed that as we trend towards a common cross-platform kernel,
> we should be relying on feature registers where available, not the
> model.
The PMU is very tightly coupled with the CPU and it is necessary to know
exactly which CPU you have so that you can map microarchitectural events to
their identifiers. This is not discoverable in the architecture [PMUv2
provides some support for discovering the status of architected events, but
that is still not enough and is only present on A7 and A15 so far] so that's
why we probe the CPU instead.
Now, if everything was device-tree based then we could simply use a
different binding for each CPU but since we support perf on non-DT
platforms, probing the CPU type is the best solution. I would like to avoid
the probing code if we are initialised from DT, but I've not got round to it
yet (this would be useful for big.LITTLE).
> > Would you be able to advertise 0 event counters instead and treat the PMU
> > largely as RAZ/WI? The only tricky bit I can see is the cycle counter, which
> > is mandated by the presence of a PMU, however this could also just RAZ
> > initially.
>
> Yes, that's the effect of the current emulation hack. Far better not to
> lie to the guest, however, than get weird results from profiling.
I'd rather lie to the guest than modify it just to avoid emulating the
device correctly. Even then, the profiling results wouldn't be especially
weird -- everything would be 0, which is a lot better than random numbers.
Will
next prev parent reply other threads:[~2012-03-26 9:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4F590411.9060201@arm.com>
2012-03-23 0:32 ` [PATCH] ARM: test for PMU feature on v7 Rusty Russell
2012-03-23 0:34 ` [PATCH] ARM: test for PMU feature on v7 (v2 with typo fix) Rusty Russell
2012-03-23 9:53 ` Will Deacon
2012-03-23 23:17 ` Rusty Russell
2012-03-26 9:40 ` Will Deacon [this message]
2012-03-26 9:50 ` [Android-virt] " Peter Maydell
2012-03-26 15:15 ` Will Deacon
2012-03-28 6:09 ` Rusty Russell
2012-03-28 14:17 ` Nicolas Pitre
2012-03-30 17:04 ` Will Deacon
2012-03-30 17:40 ` Nicolas Pitre
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=20120326094054.GA2475@mudshark.cambridge.arm.com \
--to=will.deacon@arm.com \
--cc=linux-arm-kernel@lists.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).