From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Oliver Upton <oupton@google.com>
Cc: kvm@vger.kernel.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Jim Mattson" <jmattson@google.com>,
"Peter Shier" <pshier@google.com>
Subject: Re: [PATCH 3/7] KVM: VMX: Add helper to check reserved bits in MSR_CORE_PERF_GLOBAL_CTRL
Date: Fri, 30 Aug 2019 11:26:34 -0700 [thread overview]
Message-ID: <20190830182634.GF15405@linux.intel.com> (raw)
In-Reply-To: <20190828234134.132704-4-oupton@google.com>
On Wed, Aug 28, 2019 at 04:41:30PM -0700, Oliver Upton wrote:
> Creating a helper function to check the validity of the
Changelogs should use imperative mood, e.g.:
Create a helper function to check...
> {HOST,GUEST}_IA32_PERF_GLOBAL_CTRL wrt the PMU's global_ctrl_mask.
As is, this needs the SDM quote from patch 4/7 as it's not clear what
global_ctrl_mask contains, e.g. the check looks inverted to the
uninitiated. Adding a helper without a user is also discouraged,
e.g. if the helper is broken then bisection would point at the next
patch, so this should really be folded in to patch 4/7 anyways.
That being said, if you tweak the prototype (see below) then you can
use it intel_pmu_set_msr(), in which case a standalone patch does make
sense.
> Suggested-by: Jim Mattson <jmattson@google.com>
> Signed-off-by: Oliver Upton <oupton@google.com>
> ---
> arch/x86/kvm/pmu.h | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/arch/x86/kvm/pmu.h b/arch/x86/kvm/pmu.h
> index 58265f761c3b..b7d9efff208d 100644
> --- a/arch/x86/kvm/pmu.h
> +++ b/arch/x86/kvm/pmu.h
> @@ -79,6 +79,17 @@ static inline bool pmc_is_enabled(struct kvm_pmc *pmc)
> return kvm_x86_ops->pmu_ops->pmc_is_enabled(pmc);
> }
>
> +static inline bool kvm_is_valid_perf_global_ctrl(struct kvm_vcpu *vcpu,
If this takes 'struct kvm_pmu *pmu' instead of a vcpu then it can also
be used in intel_pmu_set_msr().
> + u64 global_ctrl)
> +{
> + struct kvm_pmu *pmu = vcpu_to_pmu(vcpu);
> +
> + if (pmu->global_ctrl_mask & global_ctrl)
intel_pmu_set_msr() allows 'global_ctrl == data' regardless of the mask,
do we need simliar code here?
> + return false;
> +
> + return true;
Or simply
return !(pmu->global_ctrl_mask & global_ctrl);
> +}
> +
> /* returns general purpose PMC with the specified MSR. Note that it can be
> * used for both PERFCTRn and EVNTSELn; that is why it accepts base as a
> * paramenter to tell them apart.
> --
> 2.23.0.187.g17f5b7556c-goog
>
next prev parent reply other threads:[~2019-08-30 18:26 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-28 23:41 [PATCH 0/7] KVM: VMX: Add full nested support for IA32_PERF_GLOBAL_CTRL Oliver Upton
2019-08-28 23:41 ` [PATCH 1/7] KVM: nVMX: Use kvm_set_msr to load IA32_PERF_GLOBAL_CTRL on vmexit Oliver Upton
2019-08-29 1:30 ` Krish Sadhukhan
2019-08-29 2:02 ` Oliver Upton
2019-08-29 7:19 ` Krish Sadhukhan
2019-08-29 8:07 ` Oliver Upton
2019-08-29 16:47 ` Krish Sadhukhan
2019-08-29 17:02 ` Jim Mattson
2019-08-28 23:41 ` [PATCH 2/7] KVM: nVMX: Load GUEST_IA32_PERF_GLOBAL_CTRL MSR on vmentry Oliver Upton
2019-08-30 17:58 ` Sean Christopherson
2019-08-28 23:41 ` [PATCH 3/7] KVM: VMX: Add helper to check reserved bits in MSR_CORE_PERF_GLOBAL_CTRL Oliver Upton
2019-08-30 18:26 ` Sean Christopherson [this message]
2019-08-30 19:20 ` Jim Mattson
2019-08-30 19:50 ` Oliver Upton
2019-08-28 23:41 ` [PATCH 4/7] KVM: nVMX: check GUEST_IA32_PERF_GLOBAL_CTRL on VM-Entry Oliver Upton
2019-08-30 18:37 ` Sean Christopherson
2019-08-30 20:12 ` Oliver Upton
2019-08-28 23:41 ` [PATCH 5/7] KVM: nVMX: Check HOST_IA32_PERF_GLOBAL_CTRL on VM-entry Oliver Upton
2019-08-28 23:41 ` [PATCH 6/7] KVM: nVMX: Enable load IA32_PERF_GLOBAL_CTRL vm control if supported Oliver Upton
2019-08-29 17:28 ` Jim Mattson
2019-08-28 23:41 ` [kvm-unit-tests PATCH 7/7] x86: VMX: Add tests for nested "load IA32_PERF_GLOBAL_CTRL" Oliver Upton
2019-08-29 17:33 ` Jim Mattson
2019-08-29 19:58 ` Oliver Upton
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=20190830182634.GF15405@linux.intel.com \
--to=sean.j.christopherson@intel.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=oupton@google.com \
--cc=pbonzini@redhat.com \
--cc=pshier@google.com \
--cc=rkrcmar@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.