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 5C7AFC001DC for ; Mon, 31 Jul 2023 16:41:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229946AbjGaQl1 (ORCPT ); Mon, 31 Jul 2023 12:41:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231287AbjGaQlO (ORCPT ); Mon, 31 Jul 2023 12:41:14 -0400 Received: from out-73.mta0.migadu.com (out-73.mta0.migadu.com [91.218.175.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EE9319B0 for ; Mon, 31 Jul 2023 09:41:10 -0700 (PDT) Date: Mon, 31 Jul 2023 09:41:02 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1690821667; 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=VOFw4Kj4hJRr7MmhNaCZHU6GMvxI4dnHBIGrUAh9zjc=; b=VvIXFTWW6k2oIyw87XotFIxTJjXZuSPPxVwOWsEHKndo+pcHaB450FDHoSsL6Vc3AL7W4I a61XEJt5N4DiKGw7HSEnyo/KkHHmk98WZjk/1HZaQ6J8d2PniPZ6CvR7aIRp+ynreRfr1B Rp5nYB8V2IxbMyyIF5V6o/UCAwKldhM= 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 v2 2/5] KVM: arm64: PMU: Disallow vPMU on non-uniform PMUVer systems Message-ID: References: <20230728181907.1759513-1-reijiw@google.com> <20230728181907.1759513-3-reijiw@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Mon, Jul 31, 2023 at 04:54:04AM -0700, Reiji Watanabe wrote: > Hi Oliver, > > > This doesn't actually disallow userspace from configuring a vPMU, it > > only hides the KVM cap. kvm_host_pmu_init() will still insert the host > > PMU instance in the list of valid PMUs, and there doesn't appear to be > > any check against the static key anywhere on that path. > > In v6.5-rc3, which I used as the base, or even in v6.5-rc4, > it appears kvm_reset_vcpu() checks against the static key. > So, the initial KVM_ARM_VCPU_INIT with vPMU configured will > fail on the systems. Or am I missing something ? (Or is that > going to be removed by other patches that are already queued?) No, I definitely missed something, sorry for the noise! I had only checked the PMU attributes, forgot about feature flags for a moment. > > I actually prefer where we flip the static key, as PMU context switching > > depends on both KVM support as well as the PMU driver coming up successfully. > > Instead, you could hoist the check against the sanitised PMU version into > > kvm_host_pmu_init(), maybe something like: > > Thank you, it looks better. I will fix this in v3. Sounds good, thanks! -- Best, Oliver