• Thomas Gleixner's avatar
    x86/entry: Move user return notifier out of loop · a377ac1c
    Thomas Gleixner authored
    Guests and user space share certain MSRs. KVM sets these MSRs to guest
    values once and does not set them back to user space values on every VM
    exit to spare the costly MSR operations.
    
    User return notifiers ensure that these MSRs are set back to the correct
    values before returning to user space in exit_to_usermode_loop().
    
    There is no reason to evaluate the TIF flag indicating that user return
    notifiers need to be invoked in the loop. The important point is that they
    are invoked before returning to user space.
    
    Move the invocation out of the loop into the section which does the last
    preperatory steps before returning to user space. That section is not
    preemptible and runs with interrupts disabled until the actual return.
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Link: https://lkml.kernel.org/r/20200722220520.159112003@linutronix.de
    
    a377ac1c
common.c 22.2 KB