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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 276A5C001DC for ; Mon, 31 Jul 2023 16:41:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gB5u/NCm/iF6jwBGNwUlx0ghWGG9LEyz9uezy9/vItI=; b=iv85d0k0r4dN7t DsBHlU1qZZFZQ0ZZZhCjh+9d/qlLKLcmWDF4l4c7HonHEtreLxb4jouaPeR21MS+QrHd1OTuAXffb N+QruV3Xz1Ze580e8oEl9rk+AQS7I/InqhcS8pTVRdmDMOks1Kx6N1UR4MdrSdZdMWMzlXKqX3JPL zajNTMp32zaubiJb4xjxG2dblX/0wo5UcyuYh4WKzGAH53WIggbOVH9u49RGUfOfgR3EgKBqFBnXr ctxzX2ZdXWhoYdcWJ9KjoclV+7SLeZaULoP6AdxaCxF8e05vbUd1Wo1iwToqowybM4BkaEXyj185J HtAozC5XfissNMrgAwFQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qQVxM-00Gaph-2Q; Mon, 31 Jul 2023 16:41:16 +0000 Received: from out-72.mta0.migadu.com ([2001:41d0:1004:224b::48]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qQVxJ-00GaoW-2e for linux-arm-kernel@lists.infradead.org; Mon, 31 Jul 2023 16:41:15 +0000 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-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230731_094114_282871_7BDEFB98 X-CRM114-Status: GOOD ( 20.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel