public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Joerg Roedel" <joerg.roedel@amd.com>
To: "Avi Kivity" <avi@qumranet.com>
Cc: kvm-devel@lists.sourceforge.net
Subject: Re: [PATCH] KVM: detect if VCPU triple faults
Date: Tue, 26 Feb 2008 16:37:30 +0100	[thread overview]
Message-ID: <20080226153730.GE6504@amd.com> (raw)
In-Reply-To: <47C40DE7.9040907@qumranet.com>

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/

  reply	other threads:[~2008-02-26 15:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-26 11:38 [PATCH] KVM: detect if VCPU triple faults Joerg Roedel
2008-02-26 13:02 ` Avi Kivity
2008-02-26 15:37   ` Joerg Roedel [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-02-26 15:49 Joerg Roedel
2008-02-26 16:45 ` 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=20080226153730.GE6504@amd.com \
    --to=joerg.roedel@amd.com \
    --cc=avi@qumranet.com \
    --cc=kvm-devel@lists.sourceforge.net \
    /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