From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D04E6C7EE29 for ; Sun, 11 Jun 2023 02:33:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230510AbjFKCdY (ORCPT ); Sat, 10 Jun 2023 22:33:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229831AbjFKCdX (ORCPT ); Sat, 10 Jun 2023 22:33:23 -0400 Received: from out-17.mta1.migadu.com (out-17.mta1.migadu.com [IPv6:2001:41d0:203:375::11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C91BE10A for ; Sat, 10 Jun 2023 19:33:20 -0700 (PDT) Date: Sat, 10 Jun 2023 19:32:42 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1686450797; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gYuy6+cAPETSeiC1HLB5DdgLxSlHnRHGTMIbZlrv/LM=; b=dL29wej5FWD5A7SWuFIiZq1Ri+AnsNP5jarB6+l48bCXsIEOm3HuoZyerwbivdXr6KAK0C 1sksBAU0o0t7rEzlbTcjLhtGFC9lkNUWUGGlgp1pS/65k5d6JEJEPw1eVPmwt5YIzCNVvQ 0TG8zglI48re7ps3OWIUQYGqSG3f1p0= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Reiji Watanabe Cc: Marc Zyngier , kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, James Morse , Alexandru Elisei , Zenghui Yu , Suzuki K Poulose , Jing Zhang , Raghavendra Rao Anata Subject: Re: [PATCH 2/2] KVM: arm64: PMU: Disallow vPMU on non-uniform PMUVer systems Message-ID: References: <20230610061520.3026530-1-reijiw@google.com> <20230610061520.3026530-3-reijiw@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230610061520.3026530-3-reijiw@google.com> X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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