public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: David Dunn <daviddunn@google.com>
To: pbonzini@redhat.com
Cc: seanjc@google.com, jmattson@google.com, like.xu.linux@gmail.com,
	kvm@vger.kernel.org, David Dunn <daviddunn@google.com>
Subject: [PATCH v7 0/3] KVM: x86: Provide per VM capability for disabling PMU virtualization
Date: Tue, 15 Feb 2022 01:48:03 +0000	[thread overview]
Message-ID: <20220215014806.4102669-1-daviddunn@google.com> (raw)

Allow usermode to disable PMU virtualization on individual x86 VMs.
When disabled, the PMU is not accessible from the guest.

v6: https://lore.kernel.org/all/20220209172945.1495014-1-daviddunn@google.com/

v6 -> v7
 * Incorporating feedback from Sean.
 * Rephrased commit messages (borrowed from Sean).
 * Added locking around kvm->created_vcpus access.
 * Moved KVM_CAP_PMU_VALID_MASK out of user ABI headers.
 * Changed comments on vm_create_without_vcpus.
 * Directly check results in selftest TEST_ASSERT statements.

v5 -> v6
 * resolve minor conflicts that were queued after v5 was reviewed.

v4 -> v5
 * Remove automatic CPUID adjustment when PMU disabled.
 * Update documentation and changelog to reflect above.
 * Update documentation to document arg[0] and return values.

David Dunn (3):
  KVM: x86: Provide per VM capability for disabling PMU virtualization
  KVM: selftests: Carve out helper to create "default" VM without vCPUs
  KVM: selftests: Verify disabling PMU virtualization via
    KVM_CAP_CONFIG_PMU

 Documentation/virt/kvm/api.rst                | 22 ++++++++++++
 arch/x86/include/asm/kvm_host.h               |  1 +
 arch/x86/kvm/svm/pmu.c                        |  2 +-
 arch/x86/kvm/vmx/pmu_intel.c                  |  2 +-
 arch/x86/kvm/x86.c                            | 17 +++++++++
 include/uapi/linux/kvm.h                      |  3 ++
 tools/include/uapi/linux/kvm.h                |  3 ++
 .../selftests/kvm/include/kvm_util_base.h     |  3 ++
 tools/testing/selftests/kvm/lib/kvm_util.c    | 35 +++++++++++++++----
 .../kvm/x86_64/pmu_event_filter_test.c        | 33 +++++++++++++++++
 10 files changed, 113 insertions(+), 8 deletions(-)

-- 
2.35.1.265.g69c8d7142f-goog


             reply	other threads:[~2022-02-15  1:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-15  1:48 David Dunn [this message]
2022-02-15  1:48 ` [PATCH v7 1/3] KVM: x86: Provide per VM capability for disabling PMU virtualization David Dunn
2022-02-17 16:22   ` Sean Christopherson
2022-02-15  1:48 ` [PATCH v7 2/3] KVM: selftests: Carve out helper to create "default" VM without vCPUs David Dunn
2022-02-17 15:46   ` Sean Christopherson
2022-02-15  1:48 ` [PATCH v7 3/3] KVM: selftests: Verify disabling PMU virtualization via KVM_CAP_CONFIG_PMU David Dunn

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=20220215014806.4102669-1-daviddunn@google.com \
    --to=daviddunn@google.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=like.xu.linux@gmail.com \
    --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