All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvm, vmx: Fix lazy FPU on nested guest
@ 2013-11-13 10:45 Anthoine Bourgeois
  2013-11-13 17:46 ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Anthoine Bourgeois @ 2013-11-13 10:45 UTC (permalink / raw)
  To: Gleb Natapov, Paolo Bonzini, kvm; +Cc: Anthoine Bourgeois

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.

Signed-off-by: Anthoine Bourgeois <bourgeois@bertin.fr>
---
  arch/x86/kvm/vmx.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 2b2fce1..e33cadf 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -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:
-- 
1.8.3.2

Anthoine BOURGEOIS
Bertin Technologies
bourgeois@bertin.fr
Tél : 01 39 30 62 16

1

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

* Re: [PATCH] kvm, vmx: Fix lazy FPU on nested guest
  2013-11-13 10:45 [PATCH] kvm, vmx: Fix lazy FPU on nested guest Anthoine Bourgeois
@ 2013-11-13 17:46 ` Paolo Bonzini
  2013-11-14  7:22   ` Anthoine Bourgeois
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2013-11-13 17:46 UTC (permalink / raw)
  To: Anthoine Bourgeois; +Cc: Gleb Natapov, kvm

Il 13/11/2013 11:45, Anthoine Bourgeois ha scritto:
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 2b2fce1..e33cadf 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -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:
> -- 

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

Paolo

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

* Re: [PATCH] kvm, vmx: Fix lazy FPU on nested guest
  2013-11-13 17:46 ` Paolo Bonzini
@ 2013-11-14  7:22   ` Anthoine Bourgeois
  0 siblings, 0 replies; 3+ messages in thread
From: Anthoine Bourgeois @ 2013-11-14  7:22 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Gleb Natapov, kvm

On Wed, Nov 13, 2013 at 06:46:47PM +0100, Paolo Bonzini wrote:
>
>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


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

end of thread, other threads:[~2013-11-14  7:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-13 10:45 [PATCH] kvm, vmx: Fix lazy FPU on nested guest Anthoine Bourgeois
2013-11-13 17:46 ` Paolo Bonzini
2013-11-14  7:22   ` Anthoine Bourgeois

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.