qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Aurelien Jarno <aurelien@aurel32.net>
Cc: Paul Brook <paul@codesourcery.com>,
	qemu-devel@nongnu.org, patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH] target-arm: Minimal implementation of performance counters
Date: Mon, 25 Apr 2011 22:59:52 +0100	[thread overview]
Message-ID: <BANLkTi=OWhU1H=timLAfdT3CV_uaNMaRGg@mail.gmail.com> (raw)
In-Reply-To: <20110425210953.GH21831@volta.aurel32.net>

On 25 April 2011 22:09, Aurelien Jarno <aurelien@aurel32.net> wrote:
> On Thu, Apr 21, 2011 at 05:01:48PM +0100, Peter Maydell wrote:

>> +                tb_flush(env);
>
> If you flush all tbs, you also have to ensure that on the translate.c
> side, this is the last instruction of the tb. Otherwise, the rest of the
> TB will be executed with the wrong access rights.

This is OK, because we can't get here unless we're in privileged
mode (PMUSERENR is never writable in user mode), and changing
PMUSERENR doesn't affect the access rights for privileged mode.
And a switch into user mode will be a change of TB anyway.

(Compare the handling of the TEECR, which also doesn't need to change
TB after a tb_flush(), for the same reasons.)

> Instead of having this complex test for all cp15 access, but only for
> catching a few access to performance registers, wouldn't it make more
> sense to have this test and an exception triggering directly in
> helper.c?

That was what my first design did, but in discussions on IRC
with Paul Brook he basically said that you can't generate an
exception in the helper routine, you have to either generate
runtime code to do the test or throw away the TBs. Unfortunately
I forget the exact rationale, so I've cc'd Paul to remind me :-)

On the subject of complexity: I have vague plans for overhauling
the cp15 support code anyway, so you can effectively register
handler functions for the cp15 registers you care about rather
than having to have one enormous function full of nested case
statements. You could then have the access checking code not
so wildly far away from the register read/write implementation.
(Plus we need support for banked cp15 registers at some point.)

-- PMM

  reply	other threads:[~2011-04-25 21:59 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-21 16:01 [Qemu-devel] [PATCH] target-arm: Minimal implementation of performance counters Peter Maydell
2011-04-22  7:23 ` Brad Hards
2011-04-22  9:48   ` Peter Maydell
2011-04-22 10:32     ` Brad Hards
2011-04-25 21:09 ` Aurelien Jarno
2011-04-25 21:59   ` Peter Maydell [this message]
2011-04-25 22:31     ` Aurelien Jarno
2011-04-25 22:35       ` Peter Maydell
2011-04-26 10:23         ` Aurelien Jarno
2011-05-06 14:32           ` Peter Maydell
2011-05-14 21:32             ` Aurelien Jarno
2011-05-14 22:01               ` Blue Swirl
2011-05-14 22:10                 ` Aurelien Jarno
2011-05-16  9:59               ` Peter Maydell
2011-05-16 17:29                 ` Aurelien Jarno
2011-05-16 17:51                   ` Peter Maydell
2011-06-15 17:39                     ` Peter Maydell
2011-05-16 16:10               ` Paul Brook
2011-05-16 16:37                 ` Peter Maydell
2011-05-16 17:29                   ` Aurelien Jarno
2011-05-16 17:47                     ` Peter Maydell
2011-05-16 18:06                       ` Aurelien Jarno

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='BANLkTi=OWhU1H=timLAfdT3CV_uaNMaRGg@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=aurelien@aurel32.net \
    --cc=patches@linaro.org \
    --cc=paul@codesourcery.com \
    --cc=qemu-devel@nongnu.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).