public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Oliver Upton <oliver.upton@linux.dev>
To: Reiji Watanabe <reijiw@google.com>
Cc: Marc Zyngier <maz@kernel.org>,
	kvmarm@lists.linux.dev, kvm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	James Morse <james.morse@arm.com>,
	Alexandru Elisei <alexandru.elisei@arm.com>,
	Zenghui Yu <yuzenghui@huawei.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Jing Zhang <jingzhangos@google.com>,
	Raghavendra Rao Anata <rananta@google.com>
Subject: Re: [PATCH 2/2] KVM: arm64: PMU: Disallow vPMU on non-uniform PMUVer systems
Date: Sat, 10 Jun 2023 19:32:42 -0700	[thread overview]
Message-ID: <ZIUx5c//d4txXbUB@linux.dev> (raw)
In-Reply-To: <20230610061520.3026530-3-reijiw@google.com>

On Fri, Jun 09, 2023 at 11:15:20PM -0700, Reiji Watanabe wrote:
> Disallow userspace from configuring vPMU for guests on systems
> where the PMUVer is not uniform across all PEs.
> KVM has not been advertising PMUv3 to the guests with vPMU on
> such systems anyway, and such systems would be extremely
> uncommon and unlikely to even use KVM.

Ok... Now your changes are starting to make sense. This patch is rather
relevant context for interpreting the other PMU fix [*], so I'd
recommend you send this as a combined series going forward.

[*]  https://lore.kernel.org/kvmarm/20230610194510.4146549-1-reijiw@google.com/

> diff --git a/include/kvm/arm_pmu.h b/include/kvm/arm_pmu.h
> index eef17de966da..af1fe2b53fbb 100644
> --- a/include/kvm/arm_pmu.h
> +++ b/include/kvm/arm_pmu.h
> @@ -105,6 +105,14 @@ void kvm_vcpu_pmu_restore_host(struct kvm_vcpu *vcpu);
>  
>  u8 kvm_arm_pmu_get_pmuver_limit(void);
>  
> +static inline void kvm_arm_set_support_pmu_v3(void)
> +{
> +	u8 pmuver = kvm_arm_pmu_get_pmuver_limit();
> +
> +	if (pmu_v3_is_supported(pmuver))
> +		static_branch_enable(&kvm_arm_pmu_available);
> +}
> +
>  #else
>  struct kvm_pmu {
>  };
> @@ -114,6 +122,8 @@ static inline bool kvm_arm_support_pmu_v3(void)
>  	return false;
>  }
>  
> +static inline void kvm_arm_set_support_pmu_v3(void) {};
> +

nit: Give this thing a more generic name (e.g. kvm_pmu_init()) in case
we wind up needing more boot-time PMU initialization.

--
Thanks,
Oliver

  reply	other threads:[~2023-06-11  2:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-10  6:15 [PATCH 0/2] KVM: arm64: PMU: Disallow vPMU on non-uniform PMUVer systems Reiji Watanabe
2023-06-10  6:15 ` [PATCH 1/2] KVM: arm64: PMU: Introduce pmu_v3_is_supported() helper Reiji Watanabe
2023-06-11  1:10   ` Oliver Upton
2023-06-10  6:15 ` [PATCH 2/2] KVM: arm64: PMU: Disallow vPMU on non-uniform PMUVer systems Reiji Watanabe
2023-06-11  2:32   ` Oliver Upton [this message]
2023-06-11  5:03     ` Reiji Watanabe

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=ZIUx5c//d4txXbUB@linux.dev \
    --to=oliver.upton@linux.dev \
    --cc=alexandru.elisei@arm.com \
    --cc=james.morse@arm.com \
    --cc=jingzhangos@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maz@kernel.org \
    --cc=rananta@google.com \
    --cc=reijiw@google.com \
    --cc=suzuki.poulose@arm.com \
    --cc=yuzenghui@huawei.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