• Yang Zhang's avatar
    KVM: VMX: Enable acknowledge interupt on vmexit · a547c6db
    Yang Zhang authored
    The "acknowledge interrupt on exit" feature controls processor behavior
    for external interrupt acknowledgement. When this control is set, the
    processor acknowledges the interrupt controller to acquire the
    interrupt vector on VM exit.
    
    After enabling this feature, an interrupt which arrived when target cpu is
    running in vmx non-root mode will be handled by vmx handler instead of handler
    in idt. Currently, vmx handler only fakes an interrupt stack and jump to idt
    table to let real handler to handle it. Further, we will recognize the interrupt
    and only delivery the interrupt which not belong to current vcpu through idt table.
    The interrupt which belonged to current vcpu will be handled inside vmx handler.
    This will reduce the interrupt handle cost of KVM.
    
    Also, interrupt enable logic is changed if this feature is turnning on:
    Before this patch, hypervior call local_irq_enable() to enable it directly.
    Now IF bit is set on interrupt stack frame, and will be enabled on a return from
    interrupt handler if exterrupt interrupt exists. If no external interrupt, still
    call local_irq_enable() to enable it.
    
    Refer to Intel SDM volum 3, chapter 33.2.
    Signed-off-by: default avatarYang Zhang <yang.z.zhang@Intel.com>
    Reviewed-by: default avatarGleb Natapov <gleb@redhat.com>
    Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
    a547c6db
vmx.c 223 KB