Re: [PATCH v6 6/9] x86/vmscape: Use static_call() for predictor flush

From: Peter Zijlstra

Date: Thu Dec 11 2025 - 05:51:15 EST


On Mon, Dec 01, 2025 at 10:20:14PM -0800, Pawan Gupta wrote:
> Adding more mitigation options at exit-to-userspace for VMSCAPE would
> usually require a series of checks to decide which mitigation to use. In
> this case, the mitigation is done by calling a function, which is decided
> at boot. So, adding more feature flags and multiple checks can be avoided
> by using static_call() to the mitigating function.
>
> Replace the flag-based mitigation selector with a static_call(). This also
> frees the existing X86_FEATURE_IBPB_EXIT_TO_USER.
>
> Suggested-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
> Signed-off-by: Pawan Gupta <pawan.kumar.gupta@xxxxxxxxxxxxxxx>
> ---
> arch/x86/Kconfig | 1 +
> arch/x86/include/asm/cpufeatures.h | 2 +-
> arch/x86/include/asm/entry-common.h | 7 +++----
> arch/x86/include/asm/nospec-branch.h | 3 +++
> arch/x86/kernel/cpu/bugs.c | 5 ++++-
> arch/x86/kvm/x86.c | 2 +-
> 6 files changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index fa3b616af03a2d50eaf5f922bc8cd4e08a284045..066f62f15e67e85fda0f3fd66acabad9a9794ff8 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -2706,6 +2706,7 @@ config MITIGATION_TSA
> config MITIGATION_VMSCAPE
> bool "Mitigate VMSCAPE"
> depends on KVM
> + select HAVE_STATIC_CALL

That can't be right.