All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, Like Xu <like.xu.linux@gmail.com>,
	Sean Christopherson <seanjc@google.com>
Subject: [kvm-unit-tests PATCH] x86/pmu: Truncate reserved bits for emulated test of full width writes
Date: Wed,  7 Jun 2023 14:21:11 -0700	[thread overview]
Message-ID: <20230607212111.1579831-1-seanjc@google.com> (raw)

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


             reply	other threads:[~2023-06-07 21:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-07 21:21 Sean Christopherson [this message]
2023-06-07 21:56 ` [kvm-unit-tests PATCH] x86/pmu: Truncate reserved bits for emulated test of full width writes Sean Christopherson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230607212111.1579831-1-seanjc@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=like.xu.linux@gmail.com \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.