From: Paolo Bonzini <pbonzini@redhat.com>
To: Eugene Korenevsky <ekorenevsky@gmail.com>, kvm@vger.kernel.org
Subject: Re: [v2 PATCH] KVM: nVMX: consult PFEC_MASK and PFEC_MATCH when generating #PF VM-exit
Date: Thu, 18 Dec 2014 09:46:05 +0100 [thread overview]
Message-ID: <5492944D.9090502@redhat.com> (raw)
In-Reply-To: <20141216193553.GA13643@gnote>
On 16/12/2014 20:35, Eugene Korenevsky wrote:
> When generating #PF VM-exit, check equality:
> (PFEC & PFEC_MASK) == PFEC_MATCH
> If there is equality, the 14 bit of exception bitmap is used to take decision
> about generating #PF VM-exit. If there is inequality, inverted 14 bit is used.
>
> Signed-off-by: Eugene Korenevsky <ekorenevsky@gmail.com>
> ---
> arch/x86/kvm/vmx.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 09ccf6c..a8ef8265 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -8206,6 +8206,18 @@ static void nested_ept_uninit_mmu_context(struct kvm_vcpu *vcpu)
> vcpu->arch.walk_mmu = &vcpu->arch.mmu;
> }
>
> +static bool nested_vmx_is_page_fault_vmexit(struct vmcs12 *vmcs12,
> + u16 error_code)
> +{
> + bool inequality, bit;
> +
> + bit = (vmcs12->exception_bitmap & (1u << PF_VECTOR)) != 0;
> + inequality =
> + (error_code & vmcs12->page_fault_error_code_mask) !=
> + vmcs12->page_fault_error_code_match;
> + return inequality ^ bit;
> +}
> +
> static void vmx_inject_page_fault_nested(struct kvm_vcpu *vcpu,
> struct x86_exception *fault)
> {
> @@ -8213,8 +8225,7 @@ static void vmx_inject_page_fault_nested(struct kvm_vcpu *vcpu,
>
> WARN_ON(!is_guest_mode(vcpu));
>
> - /* TODO: also check PFEC_MATCH/MASK, not just EB.PF. */
> - if (vmcs12->exception_bitmap & (1u << PF_VECTOR))
> + if (nested_vmx_is_page_fault_vmexit(vmcs12, fault->error_code))
> nested_vmx_vmexit(vcpu, to_vmx(vcpu)->exit_reason,
> vmcs_read32(VM_EXIT_INTR_INFO),
> vmcs_readl(EXIT_QUALIFICATION));
>
Applied to kvm/queue, thanks.
Paolo
prev parent reply other threads:[~2014-12-18 8:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-16 19:35 [v2 PATCH] KVM: nVMX: consult PFEC_MASK and PFEC_MATCH when generating #PF VM-exit Eugene Korenevsky
2014-12-18 8:46 ` 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=5492944D.9090502@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