x86/pmu: Truncate reserved bits for emulated test of full width writes
Sean Christopherson
reviewerPATCH 1/1 x86/pmu: Truncate reserved bits for emulated test of full width writes
Mask off reserved bits when stuffing PMCs with full-width writes in the forced emulation subtest, otherwise the test may fail due to attempting to set reserved bits.
Cc Like Xu <[email protected]>
Signed-off-by Sean Christopherson <[email protected]>
--- x86/pmu.c | 5 +++++ 1 file changed, 5 insertions(+)
x86/pmu.c +5 -0
@@ -498,6 +498,11 @@ static void check_emulated_instr(void) brnch_start = -EXPECTED_BRNCH ; instr_start = -EXPECTED_INSTR ; + +if (pmu_use_full_writes ()) { + brnch_start &= (1ull << pmu.gp_counter_width) -1 ; + instr_start &= (1ull << pmu.gp_counter_width) -1 ; + }wrmsr (MSR_GP_COUNTERx (0 ), brnch_start);wrmsr (MSR_GP_COUNTERx (1 ), instr_start);// KVM_FEP is a magic prefix that forces emulation so
base-commit: 02d8befe99f8205d4caea402d8b0800354255681
Signature · 1 line
2.41.0.162.gfafddb0af9-goog
Sean Christopherson
reviewerQuoted 7 lines · Sean Christopherson
Mask off reserved bits when stuffing PMCs with full-width writes in the forced emulation subtest, otherwise the test may fail due to attempting to set reserved bits.
Cc Like Xu <[email protected]>Signed-off-by Sean Christopherson <[email protected]>---
Gah, Like already posted a fix, I just misread his patch at first glance.