* [kvm-unit-tests PATCH] x86/pmu: Truncate reserved bits for emulated test of full width writes
@ 2023-06-07 21:21 Sean Christopherson
2023-06-07 21:56 ` Sean Christopherson
0 siblings, 1 reply; 2+ messages in thread
From: Sean Christopherson @ 2023-06-07 21:21 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, Like Xu, 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 <like.xu.linux@gmail.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
x86/pmu.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/x86/pmu.c b/x86/pmu.c
index 72c2c9cf..d92bd8ad 100644
--- a/x86/pmu.c
+++ b/x86/pmu.c
@@ -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
--
2.41.0.162.gfafddb0af9-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [kvm-unit-tests PATCH] x86/pmu: Truncate reserved bits for emulated test of full width writes
2023-06-07 21:21 [kvm-unit-tests PATCH] x86/pmu: Truncate reserved bits for emulated test of full width writes Sean Christopherson
@ 2023-06-07 21:56 ` Sean Christopherson
0 siblings, 0 replies; 2+ messages in thread
From: Sean Christopherson @ 2023-06-07 21:56 UTC (permalink / raw)
To: Paolo Bonzini, kvm, Like Xu
On Wed, Jun 07, 2023, Sean Christopherson wrote:
> 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 <like.xu.linux@gmail.com>
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> ---
Gah, Like already posted a fix, I just misread his patch at first glance.
https://lore.kernel.org/all/20221226075412.61167-3-likexu@tencent.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-07 21:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-07 21:21 [kvm-unit-tests PATCH] x86/pmu: Truncate reserved bits for emulated test of full width writes Sean Christopherson
2023-06-07 21:56 ` Sean Christopherson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).