]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: retpolines: x86: eliminate retpoline from vmx.c exit handlers
authorAndrea Arcangeli <aarcange@redhat.com>
Mon, 4 Nov 2019 22:59:59 +0000 (17:59 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:41:54 +0000 (11:41 +0100)
commitac07ffc19d52e161c081de3aaa2b3dadf103a233
treec21a649755f109ba05b7ac2c4c25eba72afd7244
parent76dff0650a144728da17efd73e6f505d6d95225a
KVM: retpolines: x86: eliminate retpoline from vmx.c exit handlers

[ Upstream commit 6630f46e5338ef20c977b43e2a6e639bbb057681 ]

It's enough to check the exit value and issue a direct call to avoid
the retpoline for all the common vmexit reasons.

Of course CONFIG_RETPOLINE already forbids gcc to use indirect jumps
while compiling all switch() statements, however switch() would still
allow the compiler to bisect the case value. It's more efficient to
prioritize the most frequent vmexits instead.

The halt may be slow paths from the point of the guest, but not
necessarily so from the point of the host if the host runs at full CPU
capacity and no host CPU is ever left idle.

Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Stable-dep-of: 31de69f4eea7 ("KVM: nVMX: Properly expose ENABLE_USR_WAIT_PAUSE control to L1")
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/kvm/vmx/vmx.c