linux-yocto/arch/x86
Sean Christopherson ca89387041 KVM: SVM: Set/clear SRSO's BP_SPEC_REDUCE on 0 <=> 1 VM count transitions
commit e3417ab75a upstream.

Set the magic BP_SPEC_REDUCE bit to mitigate SRSO when running VMs if and
only if KVM has at least one active VM.  Leaving the bit set at all times
unfortunately degrades performance by a wee bit more than expected.

Use a dedicated spinlock and counter instead of hooking virtualization
enablement, as changing the behavior of kvm.enable_virt_at_load based on
SRSO_BP_SPEC_REDUCE is painful, and has its own drawbacks, e.g. could
result in performance issues for flows that are sensitive to VM creation
latency.

Defer setting BP_SPEC_REDUCE until VMRUN is imminent to avoid impacting
performance on CPUs that aren't running VMs, e.g. if a setup is using
housekeeping CPUs.  Setting BP_SPEC_REDUCE in task context, i.e. without
blasting IPIs to all CPUs, also helps avoid serializing 1<=>N transitions
without incurring a gross amount of complexity (see the Link for details
on how ugly coordinating via IPIs gets).

Link: https://lore.kernel.org/all/aBOnzNCngyS_pQIW@google.com
Fixes: 8442df2b49 ("x86/bugs: KVM: Add support for SRSO_MSR_FIX")
Reported-by: Michael Larabel <Michael@michaellarabel.com>
Closes: https://www.phoronix.com/review/linux-615-amd-regression
Cc: Borislav Petkov <bp@alien8.de>
Tested-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20250505180300.973137-1-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-09-25 11:13:49 +02:00
..
boot x86/sev: Evict cache lines during SNP memory validation 2025-08-15 12:14:12 +02:00
coco x86/sev: Ensure SVSM reserved fields in a page validation entry are initialized to zero 2025-08-28 16:31:03 +02:00
configs tinyconfig: remove unnecessary 'is not set' for choice blocks 2024-09-01 20:34:38 +09:00
crypto crypto: lib/Kconfig - Hide arch options from user 2025-05-02 07:59:32 +02:00
entry x86/bugs: Rename MDS machinery to something more generic 2025-07-10 16:05:14 +02:00
events perf/x86/intel: Fix crash in icl_update_topdown_event() 2025-09-25 11:13:44 +02:00
hyperv x86/hyperv: Fix APIC ID and VP index confusion in hv_snp_boot_ap() 2025-08-01 09:48:46 +01:00
ia32
include x86/bugs: KVM: Add support for SRSO_MSR_FIX 2025-09-25 11:13:49 +02:00
kernel x86/bugs: KVM: Add support for SRSO_MSR_FIX 2025-09-25 11:13:49 +02:00
kvm KVM: SVM: Set/clear SRSO's BP_SPEC_REDUCE on 0 <=> 1 VM count transitions 2025-09-25 11:13:49 +02:00
lib x86/bugs: KVM: Add support for SRSO_MSR_FIX 2025-09-25 11:13:49 +02:00
math-emu
mm x86/mm/64: define ARCH_PAGE_TABLE_SYNC_MASK and arch_sync_kernel_mappings() 2025-09-09 18:58:15 +02:00
net x86/its: FineIBT-paranoid vs ITS 2025-05-18 08:25:00 +02:00
pci PCI/MSI: Convert pci_msi_ignore_mask to per MSI domain flag 2025-05-02 07:58:56 +02:00
platform x86/pvh: Call C code via the kernel virtual mapping 2024-12-05 14:01:12 +01:00
power x86/fred: Fix system hang during S4 resume with FRED enabled 2025-05-29 11:02:02 +02:00
purgatory Kbuild updates for v6.10 2024-05-18 12:39:20 -07:00
ras
realmode Makefile: remove redundant tool coverage variables 2024-05-14 23:35:48 +09:00
tools x86/tools: Drop duplicate unlikely() definition in insn_decoder_test.c 2025-06-27 11:11:41 +01:00
um um: Add cmpxchg8b_emu and checksum functions to asm-prototypes.h 2025-07-06 11:01:34 +02:00
video arch: Fix name collision with ACPI's video.o 2024-05-20 21:17:06 +00:00
virt x86/virt/tdx: Avoid indirect calls to TDX assembly functions 2025-06-27 11:11:38 +01:00
xen x86/xen: disable CPU idle and frequency drivers for PVH dom0 2025-05-02 07:59:23 +02:00
.gitignore
Kbuild
Kconfig x86/vmscape: Enable the mitigation 2025-09-11 17:21:46 +02:00
Kconfig.assembler x86/kconfig: Add as-instr64 macro to properly evaluate AS_WRUSS 2024-06-20 19:48:18 +02:00
Kconfig.cpu x86/Kconfig: Add cmpxchg8b support back to Geode CPUs 2025-04-10 14:39:37 +02:00
Kconfig.debug x86/kconfig: Select ARCH_WANT_FRAME_POINTERS again when UNWINDER_FRAME_POINTER=y 2024-05-20 11:37:23 +02:00
Makefile x86/stackprotector: Work around strict Clang TLS symbol requirements 2024-11-08 13:16:00 +01:00
Makefile_32.cpu
Makefile.postlink
Makefile.um um: Pass the correct Rust target and options with gcc 2025-04-10 14:39:25 +02:00