Skip to contentSkip to conversation

kvm, vmx: Fix lazy FPU on nested guest

PATCH In review Anthoine Bourgeois 2 participants 3 messages Nov 13, 2013 – Nov 14, 2013

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

PATCH 1/1 kvm, vmx: Fix lazy FPU on nested guest

If a nested guest does a NM fault but its CR0 doesn't contain the TS flag (because it was already cleared by the guest with L1 aid) then we have to activate FPU ourselves in L0 and then continue to L2. If TS flag is set then we fallback on the previous behavior, forward the fault to L1 if it asked for.

---
 arch/x86/kvm/vmx.c | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kvm/vmx.c +3 -0
index 2b2fce1..e33cadf 100644
@@ -6627,6 +6627,9 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
 			return 0;
 		else if (is_page_fault(intr_info))
 			return enable_ept;
+		else if (is_no_device(intr_info) &&
+			 !(nested_read_cr0(vmcs12) & X86_CR0_TS))
+			return 0;
 		return vmcs12->exception_bitmap &
 				(1u << (intr_info & INTR_INFO_VECTOR_MASK));
 	case EXIT_REASON_EXTERNAL_INTERRUPT:
Signature · 8 lines
1.8.3.2

Anthoine BOURGEOIS
Bertin Technologies
[email protected]
Tél : 01 39 30 62 16

1
maintainer
#1 lore raw

Il 13/11/2013 11:45, Anthoine Bourgeois ha scritto:

Quoted 15 lines
arch/x86/kvm/vmx.c +3 -0
index 2b2fce1..e33cadf 100644
@@ -6627,6 +6627,9 @@ static bool nested_vmx_exit_handled(struct
 kvm_vcpu *vcpu)
             return 0;
         else if (is_page_fault(intr_info))
             return enable_ept;
+        else if (is_no_device(intr_info) &&
+             !(nested_read_cr0(vmcs12) & X86_CR0_TS))
+            return 0;
         return vmcs12->exception_bitmap &
                 (1u << (intr_info & INTR_INFO_VECTOR_MASK));
Quoted 2 lines

case EXIT_REASON_EXTERNAL_INTERRUPT:

The whitespace in this patch is corrupted. For this time I applied it; next time however please use "git send-email".

Paolo

#2 lore raw
Quoted 3 lines · Paolo Bonzini

The whitespace in this patch is corrupted. For this time I applied it; next time however please use "git send-email".

Ok, I'll use it.
Thank you !

Anthoine
1