Skip to contentSkip to conversation

KVM: nVMX: don't clear mtf_pending when nested events are blocked

PATCH Applied Oliver Upton 2 participants 2 messages Apr 6, 2020 – Apr 7, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: nVMX: don't clear mtf_pending when nested events are blocked

If nested events are blocked, don't clear the mtf_pending flag to avoid missing later delivery of the MTF VM-exit.

Fixes 5ef8acbdd687c ("KVM: nVMX: Emulate MTF when performing instruction emulation")
---
 arch/x86/kvm/vmx/nested.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kvm/vmx/nested.c +2 -1
index de232306561a0..cbc9ea2de28f9 100644
@@ -3645,7 +3645,8 @@ static int vmx_check_nested_events(struct kvm_vcpu *vcpu)
 	 * Clear the MTF state. If a higher priority VM-exit is delivered first,
 	 * this state is discarded.
 	 */
-	vmx->nested.mtf_pending = false;
+	if (!block_nested_events)
+		vmx->nested.mtf_pending = false;
 
 	if (lapic_in_kernel(vcpu) &&
 		test_bit(KVM_APIC_INIT, &apic->pending_events)) {
Signature · 1 line
2.26.0.292.g33ef6b2f38-goog
maintainer Applied
#1 lore raw
Quoted 15 lines · Oliver Upton

If nested events are blocked, don't clear the mtf_pending flag to avoid missing later delivery of the MTF VM-exit.

Fixes 5ef8acbdd687c ("KVM: nVMX: Emulate MTF when performing instruction emulation")
---
 arch/x86/kvm/vmx/nested.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kvm/vmx/nested.c +0 -0
index de232306561a0..cbc9ea2de28f9 100644

arch/x86/kvm/vmx/nested.c static int vmx_check_nested_events(struct kvm_vcpu *vcpu) · line 3652

Quoted 9 lines
arch/x86/kvm/vmx/nested.c +2 -1
@@ -3645,7 +3645,8 @@ static int vmx_check_nested_events(struct kvm_vcpu *vcpu)
 	 * Clear the MTF state. If a higher priority VM-exit is delivered first,
 	 * this state is discarded.
 	 */
-	vmx->nested.mtf_pending = false;
+	if (!block_nested_events)
+		vmx->nested.mtf_pending = false;
 
 	if (lapic_in_kernel(vcpu) &&
 		test_bit(KVM_APIC_INIT, &apic->pending_events)) {

Queued, thanks.

Paolo