]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit - arch/x86/kernel/process.c
x86/kvm/vmx: Defer TR reload after VM exit
authorAndy Lutomirski <luto@kernel.org>
Mon, 20 Feb 2017 16:56:14 +0000 (08:56 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 21 Feb 2017 11:45:08 +0000 (12:45 +0100)
commitb7ffc44d5b2ea163899d09289ca7743d5c32e926
treec41439937c5810b701a895d1f9e060b57573d540
parentd3273deac9c0cdae32eb46f928487433eaa37f87
x86/kvm/vmx: Defer TR reload after VM exit

Intel's VMX is daft and resets the hidden TSS limit register to 0x67
on VMX reload, and the 0x67 is not configurable.  KVM currently
reloads TR using the LTR instruction on every exit, but this is quite
slow because LTR is serializing.

The 0x67 limit is entirely harmless unless ioperm() is in use, so
defer the reload until a task using ioperm() is actually running.

Here's some poorly done benchmarking using kvm-unit-tests:

Before:

cpuid 1313
vmcall 1195
mov_from_cr8 11
mov_to_cr8 17
inl_from_pmtimer 6770
inl_from_qemu 6856
inl_from_kernel 2435
outl_to_kernel 1402

After:

cpuid 1291
vmcall 1181
mov_from_cr8 11
mov_to_cr8 16
inl_from_pmtimer 6457
inl_from_qemu 6209
inl_from_kernel 2339
outl_to_kernel 1391

Signed-off-by: Andy Lutomirski <luto@kernel.org>
[Force-reload TR in invalidate_tss_limit. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/desc.h
arch/x86/kernel/ioport.c
arch/x86/kernel/process.c
arch/x86/kvm/vmx.c