[1/4] KVM: nSVM: fix condition for filtering async PF
diff mbox series

Message ID 20200516135311.704878-2-pbonzini@redhat.com
State New
Headers show
Series
  • KVM: nSVM: more svm_check_nested_events work
Related show

Commit Message

Paolo Bonzini May 16, 2020, 1:53 p.m. UTC
Async page faults have to be trapped in the host (L1 in this
case), since the APC reason was passed from L0 to L1 and stored
in the L1 APF data page.  This was completely reversed, as the
page faults were passed to the guest (a L2 hypervisor).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/x86/kvm/svm/nested.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Sean Christopherson May 18, 2020, 3:05 p.m. UTC | #1
On Sat, May 16, 2020 at 09:53:08AM -0400, Paolo Bonzini wrote:
> Async page faults have to be trapped in the host (L1 in this
> case), since the APC reason was passed from L0 to L1 and stored
> in the L1 APF data page.  This was completely reversed, as the
> page faults were passed to the guest (a L2 hypervisor).
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---

Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>

Patch
diff mbox series

diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
index 44b09ae419cf..e98ce5f6d562 100644
--- a/arch/x86/kvm/svm/nested.c
+++ b/arch/x86/kvm/svm/nested.c
@@ -889,8 +889,8 @@  int nested_svm_exit_special(struct vcpu_svm *svm)
 			return NESTED_EXIT_HOST;
 		break;
 	case SVM_EXIT_EXCP_BASE + PF_VECTOR:
-		/* When we're shadowing, trap PFs, but not async PF */
-		if (!npt_enabled && svm->vcpu.arch.apf.host_apf_reason == 0)
+		/* Trap async PF even if not shadowing */
+		if (!npt_enabled || svm->vcpu.arch.apf.host_apf_reason)
 			return NESTED_EXIT_HOST;
 		break;
 	default: