public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Eugene Korenevsky <ekorenevsky@gmail.com>, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: nVMX: consult PFEC_MASK and PFEC_MATCH when generating #PF VM-exit
Date: Tue, 16 Dec 2014 10:21:43 +0100	[thread overview]
Message-ID: <548FF9A7.7020308@redhat.com> (raw)
In-Reply-To: <20141215205658.GA29239@gnote>



On 15/12/2014 21:56, Eugene Korenevsky wrote:
> +	u32 inequality, bit;
> +
> +	bit = (vmcs12->exception_bitmap & (1u << PF_VECTOR)) ? 1u : 0;
> +	inequality =
> +		(error_code & vmcs12->page_fault_error_code_mask) !=
> +		 vmcs12->page_fault_error_code_match ? 1u : 0;

You should either remove "? 1u : 0" (which is redundant), or flip the
bit in the exception bitmap, like

    inequality = ...
          ? (1u << PF_VECTOR) : 0;
    return ((vmcs12->exception_bitmap ^ inequality)
            & (1u << PF_VECTOR)) != 0;

If you choose the former, please use "!= 0" in the assignment of "bit"
instead of the ternary operator, and make the two variables bool.  Then
you can remove the "!= 0" in the "return" below.

Paolo

> +	return (inequality ^ bit) != 0;
> +}

      reply	other threads:[~2014-12-16  9:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-15 20:56 [PATCH] KVM: nVMX: consult PFEC_MASK and PFEC_MATCH when generating #PF VM-exit Eugene Korenevsky
2014-12-16  9:21 ` 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=548FF9A7.7020308@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=ekorenevsky@gmail.com \
    --cc=kvm@vger.kernel.org \
    /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