• Paolo Bonzini's avatar
    KVM: vmx: speed up emulation of invalid guest state · 98eb2f8b
    Paolo Bonzini authored
    About 25% of the time spent in emulation of invalid guest state
    is wasted in checking whether emulation is required for the next
    instruction.  However, this almost never changes except when a
    segment register (or TR or LDTR) changes, or when there is a mode
    transition (i.e. CR0 changes).
    
    In fact, vmx_set_segment and vmx_set_cr0 already modify
    vmx->emulation_required (except that the former for some reason
    uses |= instead of just an assignment).  So there is no need to
    call guest_state_valid in the emulation loop.
    
    Emulation performance test results indicate 1650-2600 cycles
    for common instructions, versus 2300-3200 before this patch on
    a Sandy Bridge Xeon.
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    98eb2f8b
vmx.c 256 KB