All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86,kvm,vmx: Don't trap writes to CR4.TSD
@ 2014-10-08  0:16 Andy Lutomirski
  2014-10-22 19:10 ` Andy Lutomirski
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Lutomirski @ 2014-10-08  0:16 UTC (permalink / raw)
  To: Gleb Natapov, Paolo Bonzini; +Cc: kvm, Peter Zijlstra, Andy Lutomirski

CR4.TSD is guest-owned; don't trap writes to it in VMX guests.  This
avoids a VM exit on context switches into or out of a PR_TSC_SIGSEGV
task.

I think that this fixes an unintentional side-effect of:
    4c38609ac569 KVM: VMX: Make guest cr4 mask more conservative

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
---
 arch/x86/kvm/vmx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 54ca301f8415..0653233fcc82 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -105,7 +105,7 @@ module_param(nested, bool, S_IRUGO);
 	(KVM_VM_CR0_ALWAYS_ON_UNRESTRICTED_GUEST | X86_CR0_PG | X86_CR0_PE)
 #define KVM_CR4_GUEST_OWNED_BITS				      \
 	(X86_CR4_PVI | X86_CR4_DE | X86_CR4_PCE | X86_CR4_OSFXSR      \
-	 | X86_CR4_OSXMMEXCPT)
+	 | X86_CR4_OSXMMEXCPT | X86_CR4_TSD)
 
 #define KVM_PMODE_VM_CR4_ALWAYS_ON (X86_CR4_PAE | X86_CR4_VMXE)
 #define KVM_RMODE_VM_CR4_ALWAYS_ON (X86_CR4_VME | X86_CR4_PAE | X86_CR4_VMXE)
-- 
1.9.3


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

* Re: [PATCH] x86,kvm,vmx: Don't trap writes to CR4.TSD
  2014-10-08  0:16 [PATCH] x86,kvm,vmx: Don't trap writes to CR4.TSD Andy Lutomirski
@ 2014-10-22 19:10 ` Andy Lutomirski
  2014-10-22 19:52   ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Lutomirski @ 2014-10-22 19:10 UTC (permalink / raw)
  To: Gleb Natapov, Paolo Bonzini; +Cc: kvm list, Peter Zijlstra, Andy Lutomirski

On Tue, Oct 7, 2014 at 5:16 PM, Andy Lutomirski <luto@amacapital.net> wrote:
> CR4.TSD is guest-owned; don't trap writes to it in VMX guests.  This
> avoids a VM exit on context switches into or out of a PR_TSC_SIGSEGV
> task.

Friendly ping.  I suspect this got lost in KVM Forum, etc.

--Andy

>
> I think that this fixes an unintentional side-effect of:
>     4c38609ac569 KVM: VMX: Make guest cr4 mask more conservative
>
> Signed-off-by: Andy Lutomirski <luto@amacapital.net>
> ---
>  arch/x86/kvm/vmx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 54ca301f8415..0653233fcc82 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -105,7 +105,7 @@ module_param(nested, bool, S_IRUGO);
>         (KVM_VM_CR0_ALWAYS_ON_UNRESTRICTED_GUEST | X86_CR0_PG | X86_CR0_PE)
>  #define KVM_CR4_GUEST_OWNED_BITS                                     \
>         (X86_CR4_PVI | X86_CR4_DE | X86_CR4_PCE | X86_CR4_OSFXSR      \
> -        | X86_CR4_OSXMMEXCPT)
> +        | X86_CR4_OSXMMEXCPT | X86_CR4_TSD)
>
>  #define KVM_PMODE_VM_CR4_ALWAYS_ON (X86_CR4_PAE | X86_CR4_VMXE)
>  #define KVM_RMODE_VM_CR4_ALWAYS_ON (X86_CR4_VME | X86_CR4_PAE | X86_CR4_VMXE)
> --
> 1.9.3
>



-- 
Andy Lutomirski
AMA Capital Management, LLC

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

* Re: [PATCH] x86,kvm,vmx: Don't trap writes to CR4.TSD
  2014-10-22 19:10 ` Andy Lutomirski
@ 2014-10-22 19:52   ` Paolo Bonzini
  0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2014-10-22 19:52 UTC (permalink / raw)
  To: Andy Lutomirski, Gleb Natapov; +Cc: kvm list, Peter Zijlstra

On 10/22/2014 09:10 PM, Andy Lutomirski wrote:
> On Tue, Oct 7, 2014 at 5:16 PM, Andy Lutomirski <luto@amacapital.net> wrote:
>> CR4.TSD is guest-owned; don't trap writes to it in VMX guests.  This
>> avoids a VM exit on context switches into or out of a PR_TSC_SIGSEGV
>> task.
> 
> Friendly ping.  I suspect this got lost in KVM Forum, etc.

Yup, will push tomorrow.

Paolo

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

end of thread, other threads:[~2014-10-22 19:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-08  0:16 [PATCH] x86,kvm,vmx: Don't trap writes to CR4.TSD Andy Lutomirski
2014-10-22 19:10 ` Andy Lutomirski
2014-10-22 19:52   ` Paolo Bonzini

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.