All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Dunn <daviddunn@google.com>
To: kvm@vger.kernel.org, pbonzini@redhat.com,
	like.xu.linux@gmail.com, jmattson@google.com,
	cloudliang@tencent.com
Cc: daviddunn@google.com
Subject: [PATCH v2 0/3] Provide VM capability to disable PMU virtualization for individual VMs
Date: Fri, 21 Jan 2022 00:29:49 +0000	[thread overview]
Message-ID: <20220121002952.241015-1-daviddunn@google.com> (raw)

This patchset adds a new per VM capability for configuring the x86 PMU.
Right now the only configuration is to disable the PMU for an entire VM.

Thanks to Sean and Like for great feedback on v1.

I've incorporated most of the comments.  Unfortunately I wasn't able to
get the AMD version to work by using pmu->version == 0 as a flag.  And
it makes the Intel pmu->refresh() logic complicated.  So this version
stays with the kvm->arch.enable_pmu boolean on each VM.

David Dunn (3):
  Provide VM capability to disable PMU virtualization for individual VMs
  selftests: introduce function to create test VM without vcpus.
  selftests: Verify disabling PMU via KVM_CAP_CONFIG_PMU

 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                            | 12 +++++
 include/uapi/linux/kvm.h                      |  4 ++
 tools/include/uapi/linux/kvm.h                |  4 ++
 .../selftests/kvm/include/kvm_util_base.h     |  3 ++
 tools/testing/selftests/kvm/lib/kvm_util.c    | 48 ++++++++++++++-----
 .../kvm/x86_64/pmu_event_filter_test.c        | 35 ++++++++++++++
 9 files changed, 96 insertions(+), 15 deletions(-)

-- 
2.35.0.rc0.227.g00780c9af4-goog


             reply	other threads:[~2022-01-21  0:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-21  0:29 David Dunn [this message]
2022-01-21  0:29 ` [PATCH v2 1/3] Provide VM capability to disable PMU virtualization for individual VMs David Dunn
2022-01-21  6:59   ` Like Xu
2022-01-21  0:29 ` [PATCH v2 2/3] selftests: introduce function to create test VM without vcpus David Dunn
2022-01-21  0:29 ` [PATCH v2 3/3] selftests: Verify disabling PMU 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=20220121002952.241015-1-daviddunn@google.com \
    --to=daviddunn@google.com \
    --cc=cloudliang@tencent.com \
    --cc=jmattson@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.