]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: x86: Don't treat ENTER and LEAVE as branches, because they aren't
authorSean Christopherson <seanjc@google.com>
Fri, 19 Sep 2025 00:46:39 +0000 (17:46 -0700)
committerSean Christopherson <seanjc@google.com>
Mon, 22 Sep 2025 14:14:05 +0000 (07:14 -0700)
commite8f85d7884e0890ea43aa36396bcaf8a2659c2ac
treec9eefb1499978457530e809fc18bba631c4ad752
parentc49aa98376864ddf82175a7ea48977c637398653
KVM: x86: Don't treat ENTER and LEAVE as branches, because they aren't

Remove the IsBranch flag from ENTER and LEAVE in KVM's emulator, as ENTER
and LEAVE are stack operations, not branches.  Add forced emulation of
said instructions to the PMU counters test to prove that KVM diverges from
hardware, and to guard against regressions.

Opportunistically add a missing "1 MOV" to the selftest comment regarding
the number of instructions per loop, which commit 7803339fa929 ("KVM:
selftests: Use data load to trigger LLC references/misses in Intel PMU")
forgot to add.

Fixes: 018d70ffcfec ("KVM: x86: Update vPMCs when retiring branch instructions")
Cc: Jim Mattson <jmattson@google.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
Reviewed-by: Chao Gao <chao.gao@intel.com>
Link: https://lore.kernel.org/r/20250919004639.1360453-1-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/emulate.c
tools/testing/selftests/kvm/x86/pmu_counters_test.c