x86/process/64: Make save_fsgs_for_kvm() ready for FSGSBASE
authorThomas Gleixner <tglx@linutronix.de>
Thu, 28 May 2020 20:13:52 +0000 (16:13 -0400)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 18 Jun 2020 13:47:01 +0000 (15:47 +0200)
commit6758034e4d6a7f0e26b748789ab1f83f3116d1b9
treefcaaccf48964fa4f0a63bf54ccb1b9ec3d902fd7
parent58edfd2e0a93c9adc2f29902a0335af0584041a0
x86/process/64: Make save_fsgs_for_kvm() ready for FSGSBASE

save_fsgs_for_kvm() is invoked via

  vcpu_enter_guest()
    kvm_x86_ops.prepare_guest_switch(vcpu)
      vmx_prepare_switch_to_guest()
        save_fsgs_for_kvm()

with preemption disabled, but interrupts enabled.

The upcoming FSGSBASE based GS safe needs interrupts to be disabled. This
could be done in the helper function, but that function is also called from
switch_to() which has interrupts disabled already.

Disable interrupts inside save_fsgs_for_kvm() and rename the function to
current_save_fsgs() so it can be invoked from other places.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20200528201402.1708239-7-sashal@kernel.org
arch/x86/include/asm/processor.h
arch/x86/kernel/process_64.c
arch/x86/kvm/vmx/vmx.c