All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leendert van Doorn <leendert@watson.ibm.com>
To: Keir Fraser <Keir.Fraser@cl.cam.ac.uk>
Cc: "Petersson, Mats" <Mats.Petersson@amd.com>,
	xen-devel <xen-devel@lists.xensource.com>,
	Khoa Huynh <khoa@us.ibm.com>
Subject: Re: [PATCH] Calculate correct instruction length for data-fault VM exits on VT-x systems
Date: Fri, 28 Apr 2006 21:20:18 -0400	[thread overview]
Message-ID: <1146273618.4268.32.camel@localhost.localdomain> (raw)
In-Reply-To: <c231609ff1a74b7bbeebd70a7ec94936@cl.cam.ac.uk>

On Fri, 2006-04-28 at 10:24 +0100, Keir Fraser wrote:

> Yes, I expect HVM users will want some kind of helpful wrapper around 
> the core emulator. I'm trying to keep the emulator itself very generic, 
> so it makes sense that some tailoring will be required in some usages.
> 
> > We will of course also need to get the communication with QEMU done in
> > some way.
> 
> Yes, I don't imagine that is hard as long as you're prepared to copy 
> the guest's register state to and from qemu-dm. Even on x8664 it's only 
> a couple hundred bytes so unlikely to be a significant overhead. Then 
> you can simply have a copy of the emulator inside qemu-dm.
> 
>   -- Keir
> 
> > I haven't spent any time looking at it so far...

Here is something I've been toying with lately, inspired by the work
Steve's students presented at Eurosys.

The way we are currently doing real-mode emulation for VT-x is a royal
pain and getting the semantics right for all big real mode uses (Solaris
9, SLES's gfxboot) is next to impossible in the current framework. What
I was thinking about was to switch back and forth between a VT-x
partition and a full emulator. The obvious choice for this would be to
put back the qemu instruction emulator into qemu-dm and handle all
real-mode instructions there. As soon as CR0.PE is set to 0, we do an
upcall to the emulator. Once CR0.PE=1 and we have emulated some
threshold number of instructions (1000?) we switch back to the VMX
partition. This would allow us to amortize the cost of doing a full
context save and restore. Obviously, this is only a concern for VT-x,
but SVM could benefit in the following scenario:

We could do a similar thing for I/O operations. Basically, generate an
upcall into qemu-dm on an MMIO or PIO exit and let qemu-dm deal with it.
It can do the same trick and emulate a number of instructions (1000?)
before returning to the HVM partition. This will eliminate expensive
VMCS/VMCB exits on subsequent I/O operations (just consider doing a
block write on an IDE device in PIO mode, this is common behavior). It
will also eliminate the need for the MMIO instruction emulator in the
hypervisor.

The only difficulty is that the hypervisor keeps some of the device
state vpit and *pics and shotcuts operations to them. This state needs
to be exposed to qemu-dm so that it is saved and restored on every
qemu-dm invocation. I need to verify this, but as far as I'm aware, all
the accesses to the devices emulated in the hypervisor are PIO
operations. These are easy to decode with the exit information that is
provided by  VT-x and SVM, so they don't need a a full instruction
decoder.

Comments?

	Leendert

  reply	other threads:[~2006-04-29  1:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-28  9:19 [PATCH] Calculate correct instruction length for data-fault VM exits on VT-x systems Petersson, Mats
2006-04-28  9:24 ` Keir Fraser
2006-04-29  1:20   ` Leendert van Doorn [this message]
2006-04-28 20:02     ` Anthony Liguori
2006-04-29  8:00     ` Keir Fraser
2006-04-29 14:54       ` Leendert van Doorn
2006-04-29 10:39         ` Keir Fraser
2006-04-29 23:24           ` Leendert van Doorn
2006-04-29 18:54             ` Keir Fraser
2006-04-30  1:37               ` Leendert van Doorn
2006-04-29 19:46                 ` Keir Fraser
  -- strict thread matches above, loose matches on Subject: below --
2006-05-02 12:36 Petersson, Mats
2006-04-28  9:02 Petersson, Mats
2006-04-28  9:14 ` Keir Fraser
2006-04-28  1:52 Khoa Huynh
2006-04-28  2:41 ` Anthony Liguori
2006-04-28  6:03 ` Keir Fraser
2006-04-28 18:10   ` Khoa Huynh
2006-04-29  7:21     ` Keir Fraser

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=1146273618.4268.32.camel@localhost.localdomain \
    --to=leendert@watson.ibm.com \
    --cc=Keir.Fraser@cl.cam.ac.uk \
    --cc=Mats.Petersson@amd.com \
    --cc=khoa@us.ibm.com \
    --cc=xen-devel@lists.xensource.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.