KVM: x86: Move handling of is_guest_mode() into fastpath exit handlers
authorSean Christopherson <seanjc@google.com>
Wed, 10 Jan 2024 01:27:03 +0000 (17:27 -0800)
committerSean Christopherson <seanjc@google.com>
Fri, 23 Feb 2024 00:22:36 +0000 (16:22 -0800)
commitbf1a49436ea37b98dd2f37c57608951d0e28eecc
tree091cc4a1cd1d7db23f079492bbd1de9cbbea3311
parent11776aa0cfa7d007ad1799b1553bdcbd830e5010
KVM: x86: Move handling of is_guest_mode() into fastpath exit handlers

Let the fastpath code decide which exits can/can't be handled in the
fastpath when L2 is active, e.g. when KVM generates a VMX preemption
timer exit to forcefully regain control, there is no "work" to be done and
so such exits can be handled in the fastpath regardless of whether L1 or
L2 is active.

Moving the is_guest_mode() check into the fastpath code also makes it
easier to see that L2 isn't allowed to use the fastpath in most cases,
e.g. it's not immediately obvious why handle_fastpath_preemption_timer()
is called from the fastpath and the normal path.

Link: https://lore.kernel.org/r/20240110012705.506918-5-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/svm/svm.c
arch/x86/kvm/vmx/vmx.c