public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@qumranet.com>
To: Joerg Roedel <joerg.roedel@amd.com>
Cc: kvm-devel@lists.sourceforge.net
Subject: Re: [PATCH] KVM: detect if VCPU triple faults
Date: Tue, 26 Feb 2008 15:02:31 +0200	[thread overview]
Message-ID: <47C40DE7.9040907@qumranet.com> (raw)
In-Reply-To: <1204025894-19064-1-git-send-email-joerg.roedel@amd.com>

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/

  reply	other threads:[~2008-02-26 13:02 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 [this message]
2008-02-26 15:37   ` Joerg Roedel
  -- 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=47C40DE7.9040907@qumranet.com \
    --to=avi@qumranet.com \
    --cc=joerg.roedel@amd.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