• Sean Christopherson's avatar
    KVM: VMX: Optimize VMX instruction error and fault handling · 52a9fcbc
    Sean Christopherson authored
    Rework the VMX instruction helpers using asm-goto to branch directly
    to error/fault "handlers" in lieu of using __ex(), i.e. the generic
    ____kvm_handle_fault_on_reboot().  Branching directly to fault handling
    code during fixup avoids the extra JMP that is inserted after every VMX
    instruction when using the generic "fault on reboot" (see commit
    3901336e, "x86/kvm: Don't call kvm_spurious_fault() from .fixup").
    
    Opportunistically clean up the helpers so that they all have consistent
    error handling and messages.
    
    Leave the usage of ____kvm_handle_fault_on_reboot() (via __ex()) in
    kvm_cpu_vmxoff() and nested_vmx_check_vmentry_hw() as is.  The VMXOFF
    case is not a fast path, i.e. the cleanliness of __ex() is worth the
    JMP, and the extra JMP in nested_vmx_check_vmentry_hw() is unavoidable.
    
    Note, VMREAD cannot get the asm-goto treatment as output operands aren't
    compatible with GCC's asm-goto due to internal compiler restrictions.
    Acked-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Cc: Josh Poimboeuf <jpoimboe@redhat.com>
    Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    52a9fcbc
ops.h 8.03 KB