qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paul Brook <paul@codesourcery.com>
To: qemu-devel@nongnu.org
Cc: Lionel Landwerlin <lionel.landwerlin@openwide.fr>
Subject: Re: [Qemu-devel] sh : performance problem
Date: Wed, 4 Mar 2009 02:59:18 +0000	[thread overview]
Message-ID: <200903040259.18791.paul@codesourcery.com> (raw)
In-Reply-To: <1236119312.4005.13.camel@coalu.atr>

> > > Great :) But we're still far from arm :(

> By the way, does someone know why there is some kind of "tlb management
> code" in exec.c ??
>
> Does the SH4 architecture have special features that can't be handled in
> a generic code ? Or are we just rewriting some code that is already
> there ... ?

I think you're missing the most important difference; SH uses a software 
managed TLB, whereas ARM uses a hardware managed TLB.

The main consequence of this is that we don't have to model the actual ARM TLB 
at all, it is never directly visible. We effectively implement an infinitely 
large TLB.

For SH the TLB is programmed directly, so we end up having to maintain two 
TLBs: The qemu TLB and the architectural SH TLB. For correct operation pages 
must be removed from the qemu TLB when they are evicted/replaced in the SH 
TLB. The SH TLB is quite small, and flushing qemu TLB entries is quite 
expensive, so this results in fairly poor performance.

MIPS has a similar problem. However in that case the most common TLB 
operations do not directly expose the TLB state. In particular when setting a 
new TLB entry it is unspecified which TLB entry is replaced. At that point 
the OS can't know which ehtry was evicted, so we can lie, and not evict pages 
until the guest does something that allows it to determine the exact TLB 
state. In practice this is sufficient to make mips-linux workreasonably well.

I'm not sure if the same is posible for SH. It probably depends whether URC is 
visible to/used by the guest.

Large pages add even more complications. The qemu tlb canonly handle a single 
page size. In practice means that when large pages are used invalidating a 
single page entry requires the whole qemu tlb to be flushed. I'm pretty sure 
x86 getsand works mainly be chance (nothing actually ues large pages enough 
to notice it's broken). ARM takes the hit of a full TLB flush (linux breakss 
if you only flush a 1k region of a  4k entry), but single pge flushes are 
rare so in practice this doesn't hurt too much

Paul

  reply	other threads:[~2009-03-04  2:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-26 16:28 [Qemu-devel] sh : performance problem Shin-ichiro KAWASAKI
2009-02-28 19:15 ` Lionel Landwerlin
2009-03-01  6:05   ` Shin-ichiro KAWASAKI
2009-03-01 12:46     ` Lionel Landwerlin
2009-03-01 16:10       ` Shin-ichiro KAWASAKI
2009-03-01 17:39         ` Lionel Landwerlin
2009-03-02 14:46           ` Shin-ichiro KAWASAKI
2009-03-02 22:30     ` Lionel Landwerlin
2009-03-03 15:32       ` Shin-ichiro KAWASAKI
2009-03-02 23:58 ` Lionel Landwerlin
2009-03-03  0:09   ` Lionel Landwerlin
2009-03-03 15:46   ` Shin-ichiro KAWASAKI
2009-03-03 18:57     ` Lionel Landwerlin
2009-03-03 19:25       ` Laurent Desnogues
2009-03-03 22:28         ` Lionel Landwerlin
2009-03-04  2:59           ` Paul Brook [this message]
2009-03-04 15:22             ` Shin-ichiro KAWASAKI
2009-03-04 15:39           ` Shin-ichiro KAWASAKI
2009-03-03 23:11     ` Lionel Landwerlin
2009-03-04 15:12       ` Shin-ichiro KAWASAKI

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=200903040259.18791.paul@codesourcery.com \
    --to=paul@codesourcery.com \
    --cc=lionel.landwerlin@openwide.fr \
    --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).