public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: Glauber Costa <glommer@redhat.com>,
	Ulrich Obergfell <uobergfe@redhat.com>,
	kvm@vger.kernel.org, zamsden@redhat.com, mtosatti@redhat.com
Subject: Re: [RFC 0/4] KVM in-kernel PM Timer implementation
Date: Wed, 15 Dec 2010 11:33:53 +0200	[thread overview]
Message-ID: <4D088B81.7020802@redhat.com> (raw)
In-Reply-To: <4D079571.4030402@codemonkey.ws>

On 12/14/2010 06:04 PM, Anthony Liguori wrote:
> On 12/14/2010 09:38 AM, Avi Kivity wrote:
>> Fortunately, we have a very good bytecode interpreter that's 
>> accelerated in the kernel called KVM ;-)
>>
>> We have exactly the same bytecode interpreter under a different name, 
>> it's called userspace.
>>
>> If you can afford to make the transition back to the guest for 
>> emulation, you might as well transition to userspace.
>
> If you re-entered the guest and setup a stack that had the RIP of the 
> source of the exit, then there's no additional need to exit the 
> guest.  The handler can just do an iret.  Or am I missing something?

I didn't even consider an iret-to-guest, to be honest.  Let's consider 
the options:

  - iret-to-guest (a la tpr patching) - need to have an executable page 
in the guest virtual address space and some stack space (on 64-bit, can 
rely on iretq switching the stack).  That is probably impossible to do 
in a generic way without guest cooperation.  If we rely on guest 
cooperation, we might as well have the guest patch the IN instruction 
itself (no exits at all).

- architectural SMM - no need to find a virtual mapping, or even a 
physical page, since we're in our own physical address space.  However, 
the RSM instruction will trap, and on Intel, at least the first few 
instructions need to be emulated since SMM starts in big real mode.  
Also needs a tlb flush.

- kvm-specific SMM (probably what you referred to as "paravirt SMM", but 
if the guest OS is not involved, it's not really paravirt) - can switch 
to our own cr3 so no problem with finding a virtual mapping; however 
still needs a tlb flush, and on pre-NPT/EPT machines, switching cr3 back 
will involve an exit.

>>>
>>> We already have a virtual address space that works for most guests 
>>> thanks to the TPR optimization.
>>
>> It only works for Windows XP and Windows XP with the /3GB extension.
>
> Is this a fundamental limitation or just a statement of today's 
> heuristics?  Does any guest not keep the BIOS in virtual memory in a 
> static location?

If you're looking for a fundamental limitation, then yes, a guest need 
not map the BIOS at all.  Practically, I believe all common guest do map 
the BIOS, but IIRC modern guests use non-executable mappings.

-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2010-12-15  9:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <344060531.680691292328457867.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com>
2010-12-14 12:09 ` [RFC 0/4] KVM in-kernel PM Timer implementation Ulrich Obergfell
2010-12-14 13:34   ` Avi Kivity
2010-12-14 13:40     ` Glauber Costa
2010-12-14 13:49       ` Avi Kivity
2010-12-14 13:52         ` Gleb Natapov
2010-12-14 15:32         ` Anthony Liguori
2010-12-14 15:38           ` Avi Kivity
2010-12-14 16:04             ` Anthony Liguori
2010-12-15  9:33               ` Avi Kivity [this message]
2010-12-14 15:29   ` Anthony Liguori
2010-12-14 18:00     ` David S. Ahern
2010-12-14 19:49       ` Anthony Liguori
2010-12-14 19:54         ` David S. Ahern
2010-12-14 21:46           ` Anthony Liguori
2010-12-14 23:59             ` David S. Ahern
     [not found] <953393305.700721292337871455.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com>
2010-12-14 14:44 ` Ulrich Obergfell
2010-12-14 15:12   ` Avi Kivity
     [not found] <1956121317.795411292413874075.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com>
2010-12-15 11:53 ` Ulrich Obergfell
2012-02-21 18:10   ` Peter Lieven

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=4D088B81.7020802@redhat.com \
    --to=avi@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=glommer@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=uobergfe@redhat.com \
    --cc=zamsden@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox