• A
    x86/kvm/vmx: Defer TR reload after VM exit · b7ffc44d
    Andy Lutomirski 提交于
    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: NAndy Lutomirski <luto@kernel.org>
    [Force-reload TR in invalidate_tss_limit. - Paolo]
    Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
    b7ffc44d
vmx.c 329.3 KB