On Tue, Feb 26, 2008 at 03:02:31PM +0200, Avi Kivity wrote:
> Joerg Roedel wrote:
> >In the current inject_page_fault path KVM only checks if there is another PF
> >pending and injects a DF then. But it has to check for a pendig DF too to
> >detect a shutdown condition in the VCPU. If this is not detected the VCPU 
> >goes
> >to a PF -> DF -> PF loop when it should triple fault. This patch detects this
> >condition and handles it with an KVM_SHUTDOWN exit to userspace. As a side
> >effect it fixes the following warning when trying to reboot a SMP guest on 
> >SVM:
> >diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
> >index 1af0ceb..01708b7 100644
> >--- a/arch/x86/kvm/paging_tmpl.h
> >+++ b/arch/x86/kvm/paging_tmpl.h
> >@@ -366,8 +366,9 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t 
> >addr,
> >  *   - normal guest page fault due to the guest pte marked not present, not
> >  *     writable, or not executable
> >  *
> >- *  Returns: 1 if we need to emulate the instruction, 0 otherwise, or
> >- *           a negative value on error.
> >+ *  Returns: 2 if the vcpu triple faulted
> >+ *       1 if we need to emulate the instruction
> >+ *       0 otherwise, or a negative value on error.
> >  */
> >  
> 
> This is a little icky.  What about setting vcpu->requests bit 
> KVM_REQ_TRIPLE_FAULT and checking it on the next entry?
> 
> The check is zero cost since we check vcpu->requests anyway.  We can use this 
> for other situations as well (like setting cr3 to mmio space, bad paravirt 
> mmio operation, etc.)

Ah, right. This will be much simpler and cleaner. I will send an updated
patch.

Joerg

-- 
           |           AMD Saxony Limited Liability Company & Co. KG
 Operating |         Wilschdorfer Landstr. 101, 01109 Dresden, Germany
 System    |                  Register Court Dresden: HRA 4896
 Research  |              General Partner authorized to represent:
 Center    |             AMD Saxony LLC (Wilmington, Delaware, US)
           | General Manager of AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to