KVM: VMX: Avoid writing HOST_CR0 every entry
authorAvi Kivity <avi@redhat.com>
Mon, 3 May 2010 13:05:44 +0000 (16:05 +0300)
committerAvi Kivity <avi@redhat.com>
Sun, 1 Aug 2010 07:35:28 +0000 (10:35 +0300)
commit1c11e713576edf33b95669be9c2dc0ff1e0c90d3
tree9d7cde9a08747e4e633302b418de4b8eedaf1c2b
parent08acfa187117046f8b5044b4a4cdc910f3ceeeb5
KVM: VMX: Avoid writing HOST_CR0 every entry

cr0.ts may change between entries, so we copy cr0 to HOST_CR0 before each
entry.  That is slow, so instead, set HOST_CR0 to have TS set unconditionally
(which is a safe value), and issue a clts() just before exiting vcpu context
if the task indeed owns the fpu.

Saves ~50 cycles/exit.

Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/vmx.c
arch/x86/kvm/x86.c