From: Jim Mattson <jmattson@google.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: Jim Mattson <jmattson@google.com>
Subject: [PATCH v3 0/2] KVM: x86: Provide a capability to disable APERF/MPERF read intercepts
Date: Fri, 21 Mar 2025 15:14:29 -0700 [thread overview]
Message-ID: <20250321221444.2449974-1-jmattson@google.com> (raw)
Allow guest reads of IA32_APERF and IA32_MPERF, so that it can
determine the effective frequency multiplier for the physical LPU.
Commit b51700632e0e ("KVM: X86: Provide a capability to disable cstate
msr read intercepts") allowed the userspace VMM to grant a guest read
access to four core C-state residency MSRs. Do the same for IA32_APERF
and IA32_MPERF.
While this isn't sufficient to claim support for
CPUID.6:ECX.APERFMPERF[bit 0], it may suffice in a sufficiently
restricted environment (i.e. vCPUs pinned to LPUs, no TSC multiplier,
and no suspend/resume).
v1 -> v2: Add {IA32_APERF,IA32_MPERF} to vmx_possible_passthrough_msrs[]
v2 -> v3: Add a selftest
Jim Mattson (2):
KVM: x86: Provide a capability to disable APERF/MPERF read intercepts
KVM: selftests: Test behavior of KVM_X86_DISABLE_EXITS_APERFMPERF
Documentation/virt/kvm/api.rst | 1 +
arch/x86/include/asm/kvm_host.h | 1 +
arch/x86/kvm/svm/svm.c | 7 +
arch/x86/kvm/svm/svm.h | 2 +-
arch/x86/kvm/vmx/vmx.c | 6 +
arch/x86/kvm/vmx/vmx.h | 2 +-
arch/x86/kvm/x86.c | 8 +-
arch/x86/kvm/x86.h | 5 +
include/uapi/linux/kvm.h | 1 +
tools/include/uapi/linux/kvm.h | 4 +-
tools/testing/selftests/kvm/Makefile.kvm | 1 +
.../selftests/kvm/x86/aperfmperf_test.c | 162 ++++++++++++++++++
12 files changed, 196 insertions(+), 4 deletions(-)
create mode 100644 tools/testing/selftests/kvm/x86/aperfmperf_test.c
--
2.49.0.395.g12beb8f557-goog
next reply other threads:[~2025-03-21 22:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-21 22:14 Jim Mattson [this message]
2025-03-21 22:14 ` [PATCH v3 1/2] " Jim Mattson
2025-04-28 22:58 ` Sean Christopherson
2025-05-05 15:51 ` Jim Mattson
2025-05-05 16:34 ` Sean Christopherson
2025-05-07 18:09 ` Jim Mattson
2025-03-21 22:14 ` [PATCH v3 2/2] KVM: selftests: Test behavior of KVM_X86_DISABLE_EXITS_APERFMPERF Jim Mattson
2025-04-29 1:26 ` Sean Christopherson
2025-05-07 18:19 ` Jim Mattson
2025-05-07 19:54 ` 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=20250321221444.2449974-1-jmattson@google.com \
--to=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®