All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM MMU: check pending exception before injecting APF
@ 2018-02-09 17:00 Paolo Bonzini
  2018-02-09 17:17 ` Greg KH
  0 siblings, 1 reply; 10+ messages in thread
From: Paolo Bonzini @ 2018-02-09 17:00 UTC (permalink / raw)
  To: stable; +Cc: nikola.ciprich, Haozhong Zhang

From: Haozhong Zhang <haozhong.zhang@intel.com>

[ upstream commit 2a266f23550be997d783f27e704b9b40c4010292 Mon Sep 17 00:00:00 2001 ]

For example, when two APF's for page ready happen after one exit and
the first one becomes pending, the second one will result in #DF.
Instead, just handle the second page fault synchronously.

Reported-by: Ross Zwisler <zwisler@gmail.com>
Message-ID: <CAOxpaSUBf8QoOZQ1p4KfUp0jq76OKfGY4Uxs-Gg8ngReD99xww@mail.gmail.com>
Reported-by: Alec Blayne <ab@tevsa.net>
Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
Fixes: 664f8e26b00c7673a8303b0d40853a0c24ca93e1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/x86/kvm/mmu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index c4deb1f34faa..e577bacd4bd0 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -3781,7 +3781,8 @@ static int kvm_arch_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn)
 bool kvm_can_do_async_pf(struct kvm_vcpu *vcpu)
 {
 	if (unlikely(!lapic_in_kernel(vcpu) ||
-		     kvm_event_needs_reinjection(vcpu)))
+		     kvm_event_needs_reinjection(vcpu) ||
+		     vcpu->arch.exception.pending))
 		return false;
 
 	if (!vcpu->arch.apf.delivery_as_pf_vmexit && is_guest_mode(vcpu))
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [PATCH] KVM MMU: check pending exception before injecting APF
@ 2018-01-10 13:44 Haozhong Zhang
  2018-01-11 10:48 ` Wanpeng Li
  2018-01-11 13:06 ` Paolo Bonzini
  0 siblings, 2 replies; 10+ messages in thread
From: Haozhong Zhang @ 2018-01-10 13:44 UTC (permalink / raw)
  To: kvm
  Cc: Paolo Bonzini, rkrcmar, Ross Zwisler, Wanpeng Li, Alec Blayne,
	Liran Alon, Haozhong Zhang

When a guest expection is already pending, injecting APF may result in
guest #DF.

For example, when two APF's for page ready happen after an exit, the
first APF will be pending. If injecting the second one regardless of
the pending one, the second APF injection will be converted an
injection of #DF.

Reported-by: Ross Zwisler <zwisler@gmail.com>
Message-ID: <CAOxpaSUBf8QoOZQ1p4KfUp0jq76OKfGY4Uxs-Gg8ngReD99xww@mail.gmail.com>
Reported-by: Alec Blayne <ab@tevsa.net>
Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
---
 arch/x86/kvm/mmu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 89da688784fa..a8d0230ea40d 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -3781,7 +3781,8 @@ static int kvm_arch_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn)
 bool kvm_can_do_async_pf(struct kvm_vcpu *vcpu)
 {
 	if (unlikely(!lapic_in_kernel(vcpu) ||
-		     kvm_event_needs_reinjection(vcpu)))
+		     kvm_event_needs_reinjection(vcpu) ||
+		     vcpu->arch.exception.pending))
 		return false;
 
 	if (!vcpu->arch.apf.delivery_as_pf_vmexit && is_guest_mode(vcpu))
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-02-09 17:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-09 17:00 [PATCH] KVM MMU: check pending exception before injecting APF Paolo Bonzini
2018-02-09 17:17 ` Greg KH
2018-02-09 17:21   ` Paolo Bonzini
2018-02-09 17:44     ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2018-01-10 13:44 Haozhong Zhang
2018-01-11 10:48 ` Wanpeng Li
2018-01-11 11:07   ` Haozhong Zhang
2018-01-11 11:22     ` Haozhong Zhang
2018-01-11 13:06 ` Paolo Bonzini
2018-01-11 17:00   ` Ross Zwisler

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.