From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] KVM: detect if VCPU triple faults Date: Tue, 26 Feb 2008 15:02:31 +0200 Message-ID: <47C40DE7.9040907@qumranet.com> References: <1204025894-19064-1-git-send-email-joerg.roedel@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel@lists.sourceforge.net To: Joerg Roedel Return-path: In-Reply-To: <1204025894-19064-1-git-send-email-joerg.roedel@amd.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces@lists.sourceforge.net Errors-To: kvm-devel-bounces@lists.sourceforge.net List-Id: kvm.vger.kernel.org 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.) -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- 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/