qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] qemu optimization


From: John R. Hogerhuis
Subject: [Qemu-devel] qemu optimization
Date: Tue, 30 Aug 2005 00:29:49 -0700

On Mon, 2005-08-29 at 17:59 -0400, Jim C. Brown wrote:

> Um, KQEMU/qvm86 don't do dynamic translation. They are virtualizers. They run
> the code given to them (more or less) unchanged.

Sorry, I was speaking more generally (and imprecisely) about the
qemu/kqemu as a combination. As you state below, there is still dynamic
translation going on, just not by the kqemu or qvm86 modules.


(snip)

> 
> Without them, there is no native code run by qemu - everything is translated.
> 

Yep. But even in that situation, there will always be room for
improvement in how the dynamic code generator works.

I wonder, has anyone tried doing a peephole optimizer? Translate key
instruction sequences to macro instructions? There have got to be a few
such high-traffic sequences that run all the time in Windows or Linux
that could be implemented in the dynamically generated dynamic code
generator.

The most difficult part of the analysis would be to find such sequences
for interesting guest OSs and applications. I think the implementation
part would be pretty straightforward. You would have to take a hit
computing a hash the first time through a translation block so that you
could match up the block with the macroinstructions.

Actually if GCC is around on the machine, it could even be done
automatically. Put QEMU into a maintenance mode, and it would start to
collect statistics about the translation blocks. You do your normal work
on the guest machine for a little bit, maybe do a few processor
intensive things that typically take too much time.. Then tell QEMU to
stop collecting data. It looks at the translation blocks, and finds the
top ten most popular translation blocks. It generates a little C file
with the macro instructions in it, compiles it with gcc and generates a
extension to the code generator tailored to the particular guest
environment.

I guess it's an open question whether handing gcc instruction primitives
globbed together into into macroinstrucions will provide much benefit.
Depends on how smart gcc is, I guess.

-- John.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]