]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commitec011ce0147ac49d6b1d736fde501db8963eebe4
treec41439937c5810b701a895d1f9e060b57573d540
parent36cc59e1b53106e199efda12c3274e02e47475e8
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