x86/entry: Move user return notifier out of loop
authorThomas Gleixner <tglx@linutronix.de>
Wed, 22 Jul 2020 22:00:02 +0000 (00:00 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 24 Jul 2020 13:04:58 +0000 (15:04 +0200)
commita377ac1cd9d7b9ac8d546dceb3d74956fbfd443f
tree1cf496d97f362d7025a0efe3719fef54f6ed3734
parent0b085e68f4072024ecaa3889aeeaab5f6c8eba5c
x86/entry: Move user return notifier out of loop

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: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20200722220520.159112003@linutronix.de
arch/x86/entry/common.c