]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: x86: Move handling of is_guest_mode() into fastpath exit handlers
authorSean Christopherson <seanjc@google.com>
Fri, 15 Aug 2025 00:25:31 +0000 (17:25 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:28:13 +0000 (16:28 +0200)
commitca3cc405a3bc6cf11530235d0f70703150ef83b6
treebf430f217be4636fdf650d7e566c8e6d0aa0e084
parent1c1158aceaf2611346dfc903a8efa5c6cd87b23d
KVM: x86: Move handling of is_guest_mode() into fastpath exit handlers

[ Upstream commit bf1a49436ea37b98dd2f37c57608951d0e28eecc ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/kvm/svm/svm.c
arch/x86/kvm/vmx/vmx.c