From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
Sean Christopherson <seanjc@google.com>,
Marc Zyngier <maz@kernel.org>,
Oliver Upton <oliver.upton@linux.dev>
Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org,
Jim Mattson <jmattson@google.com>
Subject: [PATCH v5 0/5] KVM: x86: Provide a cap to disable APERF/MPERF read intercepts
Date: Wed, 25 Jun 2025 17:12:20 -0700 [thread overview]
Message-ID: <20250626001225.744268-1-seanjc@google.com> (raw)
arm64 folks, y'all got pulled in because of selftests changes. I deliberately
put that patch at the end of the series so that it can be discarded/ignored
without interfering with the x86 stuff.
Jim's series to allow a guest to read 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).
v5:
- Rebase on top of the MSR interception rework.
- Support passthrough to L2 on VMX (it was there somewhat unintentionally
for SVM).
- Expand the selftest to cover the nested case.
- Sanity check that the MSRs are inaccesible in the selftest.
- Add selftests patches to expand the task=>CPU pinning APIs.
- OR-in the new disabled exits in one batch.
v4:
- https://lore.kernel.org/all/20250530185239.2335185-1-jmattson@google.com
- Collect all disabled_exit flags in a u64 [Sean]
- Improve documentation [Sean]
- Add pin_task_to_one_cpu() to kvm selftests library [Sean]
v3:
- https://lore.kernel.org/all/20250321221444.2449974-1-jmattson@google.com
- Add a selftest
v2:
- https://lore.kernel.org/all/20250314180117.740591-1-jmattson@google.com
- Add {IA32_APERF,IA32_MPERF} to vmx_possible_passthrough_msrs[]
v1:
- https://lore.kernel.org/all/20250225004708.1001320-1-jmattson@google.com
Jim Mattson (3):
KVM: x86: Replace growing set of *_in_guest bools with a u64
KVM: x86: Provide a capability to disable APERF/MPERF read intercepts
KVM: selftests: Test behavior of KVM_X86_DISABLE_EXITS_APERFMPERF
Sean Christopherson (2):
KVM: selftests: Expand set of APIs for pinning tasks to a single CPU
KVM: selftests: Convert arch_timer tests to common helpers to pin task
Documentation/virt/kvm/api.rst | 23 ++
arch/x86/include/asm/kvm_host.h | 5 +-
arch/x86/kvm/svm/nested.c | 4 +-
arch/x86/kvm/svm/svm.c | 7 +-
arch/x86/kvm/vmx/nested.c | 6 +
arch/x86/kvm/vmx/vmx.c | 6 +-
arch/x86/kvm/x86.c | 15 +-
arch/x86/kvm/x86.h | 18 +-
include/uapi/linux/kvm.h | 1 +
tools/include/uapi/linux/kvm.h | 1 +
tools/testing/selftests/kvm/Makefile.kvm | 1 +
tools/testing/selftests/kvm/arch_timer.c | 7 +-
.../kvm/arm64/arch_timer_edge_cases.c | 23 +-
.../testing/selftests/kvm/include/kvm_util.h | 31 ++-
tools/testing/selftests/kvm/lib/kvm_util.c | 15 +-
tools/testing/selftests/kvm/lib/memstress.c | 2 +-
.../selftests/kvm/x86/aperfmperf_test.c | 213 ++++++++++++++++++
17 files changed, 321 insertions(+), 57 deletions(-)
create mode 100644 tools/testing/selftests/kvm/x86/aperfmperf_test.c
base-commit: 7ee45fdd644b138e7a213c6936474161b28d0e1a
--
2.50.0.727.gbf7dc18ff4-goog
next reply other threads:[~2025-06-26 0:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-26 0:12 Sean Christopherson [this message]
2025-06-26 0:12 ` [PATCH v5 1/5] KVM: x86: Replace growing set of *_in_guest bools with a u64 Sean Christopherson
2025-06-26 8:53 ` Xiaoyao Li
2025-06-26 0:12 ` [PATCH v5 2/5] KVM: x86: Provide a capability to disable APERF/MPERF read intercepts Sean Christopherson
2025-06-26 8:59 ` Xiaoyao Li
2025-06-26 0:12 ` [PATCH v5 3/5] KVM: selftests: Expand set of APIs for pinning tasks to a single CPU Sean Christopherson
2025-06-26 0:12 ` [PATCH v5 4/5] KVM: selftests: Test behavior of KVM_X86_DISABLE_EXITS_APERFMPERF Sean Christopherson
2025-06-26 0:12 ` [PATCH v5 5/5] KVM: selftests: Convert arch_timer tests to common helpers to pin task Sean Christopherson
2025-07-10 23:08 ` [PATCH v5 0/5] KVM: x86: Provide a cap to disable APERF/MPERF read intercepts 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=20250626001225.744268-1-seanjc@google.com \
--to=seanjc@google.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=oliver.upton@linux.dev \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox