All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Tiejun Chen <tiejun.chen@intel.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] kvm: x86: vmx: cleanup handle_ept_violation
Date: Tue, 18 Nov 2014 11:08:29 +0100	[thread overview]
Message-ID: <546B1A9D.8050705@redhat.com> (raw)
In-Reply-To: <1416301976-6187-1-git-send-email-tiejun.chen@intel.com>



On 18/11/2014 10:12, Tiejun Chen wrote:
> Instead, just use PFERR_{FETCH, PRESENT, WRITE}_MASK
> inside handle_ept_violation() for slightly better code.
> 
> Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
> ---
>  arch/x86/kvm/vmx.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 284f5c2..22dc60d 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -5474,11 +5474,11 @@ static int handle_ept_violation(struct kvm_vcpu *vcpu)
>  	trace_kvm_page_fault(gpa, exit_qualification);
>  
>  	/* It is a write fault? */
> -	error_code = exit_qualification & (1U << 1);
> +	error_code = exit_qualification & PFERR_WRITE_MASK;
>  	/* It is a fetch fault? */
> -	error_code |= (exit_qualification & (1U << 2)) << 2;
> +	error_code |= (exit_qualification << 2) & PFERR_FETCH_MASK;
>  	/* ept page table is present? */
> -	error_code |= (exit_qualification >> 3) & 0x1;
> +	error_code |= (exit_qualification >> 3) & PFERR_PRESENT_MASK;

Ok.

Paolo

      reply	other threads:[~2014-11-18 10:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-18  9:12 [PATCH] kvm: x86: vmx: cleanup handle_ept_violation Tiejun Chen
2014-11-18 10:08 ` Paolo Bonzini [this message]

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=546B1A9D.8050705@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=tiejun.chen@intel.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.