All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Mohammed Gamal <m.gamal005@gmail.com>
Cc: mtosatti@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH 1/2] VMX: Properly return error to userspace on vmentry failure
Date: Tue, 25 May 2010 14:45:59 +0300	[thread overview]
Message-ID: <4BFBB877.5030100@redhat.com> (raw)
In-Reply-To: <1274652064-8267-1-git-send-email-m.gamal005@gmail.com>

On 05/24/2010 01:01 AM, Mohammed Gamal wrote:
> The vmexit handler returns KVM_EXIT_UNKNOWN since there is no handler
> for vmentry failures. This intercepts vmentry failures and returns
> KVM_FAIL_ENTRY to userspace instead.
>
> Signed-off-by: Mohammed Gamal<m.gamal005@gmail.com>
> ---
>   arch/x86/kvm/vmx.c |    7 +++++++
>   1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 99ae513..4edcffb 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -3665,6 +3665,13 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu)
>   	if (enable_ept&&  is_paging(vcpu))
>   		vcpu->arch.cr3 = vmcs_readl(GUEST_CR3);
>
> +	if (exit_reason&  VMX_EXIT_REASONS_FAILED_VMENTRY) {
> +		vcpu->run->exit_reason = KVM_EXIT_FAIL_ENTRY;
> +		vcpu->run->fail_entry.hardware_entry_failure_reason
> +			= exit_reason&  ~VMX_EXIT_REASONS_FAILED_VMENTRY;
> +		return 0;
> +	}
> +
>   	if (unlikely(vmx->fail)) {
>   		vcpu->run->exit_reason = KVM_EXIT_FAIL_ENTRY;
>   		vcpu->run->fail_entry.hardware_entry_failure_reason
>    

How does the user distinguish between KVM_EXIT_FAIL_ENTRY due to an exit 
reason with bit 31 set and vmlauch/vmresume failure (vmx->fail set)?  We 
need separate exit codes (with documentation in api.txt).

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


  parent reply	other threads:[~2010-05-25 11:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-23 22:01 [PATCH 1/2] VMX: Properly return error to userspace on vmentry failure Mohammed Gamal
2010-05-23 22:01 ` [PATCH 2/2] VMX: Add constant for invalid guest state exit reason Mohammed Gamal
2010-05-25 11:46   ` Avi Kivity
2010-05-25 11:45 ` Avi Kivity [this message]
2010-05-25 12:01   ` [PATCH 1/2] VMX: Properly return error to userspace on vmentry failure Mohammed Gamal
2010-05-25 12:10     ` Avi Kivity
2010-05-25 12:15       ` Mohammed Gamal

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=4BFBB877.5030100@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=m.gamal005@gmail.com \
    --cc=mtosatti@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.