public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@qumranet.com>
To: Alexander Graf <agraf@suse.de>
Cc: kvm@vger.kernel.org, joro@8bytes.org, anthony@codemonkey.ws
Subject: Re: [PATCH 9/9] Add VMEXIT handler and intercepts
Date: Wed, 03 Sep 2008 12:47:55 +0300	[thread overview]
Message-ID: <48BE5D4B.4050509@qumranet.com> (raw)
In-Reply-To: <520347F2-D392-44B2-8A4E-0A1F61365A76@suse.de>

Alexander Graf wrote:
>
> On Sep 3, 2008, at 11:23 AM, Avi Kivity wrote:
>
>> Alexander Graf wrote:
>>>>> +        svm->vmcb->control.exit_info_2 = svm->vcpu.arch.cr2;
>>>>>
>>>>
>>>> #vmexit isn't supposed to modify cr2, but we've corrupted it here.
>>>
>>> Well, yes and no. We modified the arch.cr2 but later on in vcpu_run 
>>> we don't set the vmcb cr2 field based on that when we're running 
>>> inside a VM, so cr2 stays the same as before.
>>
>> What about later, when there is a virtual #VMEXIT?  Won't that cr2 
>> leak in?
>
> The cr2 value would leak into the level1 guest that can't rely on CR2 
> to be correct anyways.

That's not very nice.

>
>>
>>
>>>>> +    /* Kill any pending exceptions */
>>>>> +    if (svm->vcpu.arch.exception.pending == true)
>>>>> +        nsvm_printk("WARNING: Pending Exception\n");
>>>>>
>>>>
>>>> This should set control.exit_int_info.
>>>
>>> This is more of a fallback. No exceptions should be in "injecting" 
>>> state on vmexit. That would mean that after an exit that was not 
>>> handled in the nested VMM we need to inject some exception, which 
>>> should in almost all cases already raise a #VMEXIT itself. So this 
>>> should never hit.
>>
>> What about, say, #PF on the IDT when attempting to inject an 
>> exception?  We should tell the guest about that so it can reinject 
>> the exception into its own guest.
>
> Doesn't the CPU already does this for us? When the guest VMM wants to 
> inject an interrupt/exception, that would result in a real injection. 

It could be an exception initiated by the CPU (say, divide overflow) or 
an exception initiated by the guest VMM.

> So when we get a #PF on the IDT the real CPU already filled 
> exit_int_info for us and we can just pass it on to the guest VMM...
>

We might be emulating a nested guest instruction, and injecting some 
expection.

> I can't think of a situation where we inject a #PF and did not get a 
> #VMEXIT from a #PF before that.

I'm confused...

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


  reply	other threads:[~2008-09-03  9:47 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-01 11:57 [PATCH 0/9] [RFC] Add support for nested SVM (kernel) Alexander Graf
2008-09-01 11:57 ` [PATCH 1/9] Add CPUID feature flag for SVM Alexander Graf
2008-09-01 11:57   ` [PATCH 2/9] Clean up VINTR setting Alexander Graf
2008-09-01 11:57     ` [PATCH 3/9] Implement GIF, clgi and stgi Alexander Graf
2008-09-01 11:57       ` [PATCH 4/9] Add helper functions for nested SVM Alexander Graf
2008-09-01 11:57         ` [PATCH 5/9] Allow setting the SVME bit Alexander Graf
2008-09-01 11:57           ` [PATCH 6/9] Implement hsave Alexander Graf
2008-09-01 11:57             ` [PATCH 7/9] Add VMLOAD and VMSAVE handlers Alexander Graf
2008-09-01 11:58               ` [PATCH 8/9] Add VMRUN handler Alexander Graf
2008-09-01 11:58                 ` [PATCH 9/9] Add VMEXIT handler and intercepts Alexander Graf
2008-09-01 13:58                   ` Avi Kivity
2008-09-02 16:15                     ` Alexander Graf
2008-09-03  9:23                       ` Avi Kivity
2008-09-03  9:33                         ` Alexander Graf
2008-09-03  9:47                           ` Avi Kivity [this message]
2008-09-03 11:55                             ` Alexander Graf
2008-09-01 13:41                 ` [PATCH 8/9] Add VMRUN handler Avi Kivity
2008-09-02 15:38                   ` Alexander Graf
2008-09-01 13:27               ` [PATCH 7/9] Add VMLOAD and VMSAVE handlers Avi Kivity
2008-09-01 14:14                 ` Alexander Graf
2008-09-01 14:27                   ` Avi Kivity
2008-09-01 14:49                     ` Alexander Graf
2008-09-01 13:15             ` [PATCH 6/9] Implement hsave Avi Kivity
2008-09-01 14:11               ` Alexander Graf
2008-09-01 14:26                 ` Avi Kivity
2008-09-01 13:21             ` Avi Kivity
2008-09-01 13:14           ` [PATCH 5/9] Allow setting the SVME bit Avi Kivity
2008-09-01 13:11       ` [PATCH 3/9] Implement GIF, clgi and stgi Avi Kivity
2008-09-01 14:02         ` Alexander Graf
2008-09-01 14:25           ` Avi Kivity
2008-09-01 15:37             ` Alexander Graf
2008-09-01 16:05               ` Avi Kivity
2008-09-01 16:13                 ` Alexander Graf
2008-09-01 16:17                   ` Avi Kivity
2008-09-01 16:40                     ` Alexander Graf
2008-09-02  9:15                       ` Avi Kivity
2008-09-01 13:13     ` [PATCH 2/9] Clean up VINTR setting Avi Kivity
2008-09-01 12:09 ` [PATCH 0/9] [RFC] Add support for nested SVM (kernel) Avi Kivity
2008-09-01 12:21 ` Joerg Roedel
2008-09-01 13:41 ` Daniel P. Berrange
2008-09-01 14:17   ` Alexander Graf
2008-09-01 14:22     ` Avi Kivity
2008-09-01 14:47       ` Alexander Graf
2008-09-01 14:57         ` Avi Kivity

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=48BE5D4B.4050509@qumranet.com \
    --to=avi@qumranet.com \
    --cc=agraf@suse.de \
    --cc=anthony@codemonkey.ws \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.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