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 B96F3C0218D for ; Wed, 29 Jan 2025 15:34:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=iBeadbTH0ArjC2KiRwfsYwE244mCq0Upk1uE96UT9f4=; b=AP0X02fsomQb8hH+eUeh1CIezE WIwhlGLBN9mrPRgCA8xnS5+/pNpkScsPR+LblkP3ruupjrzBEnghCO7SJe6XxEaMU9H6luwpzb4Q0 uaEqHaJqBnbXhyhw5rZH3WOz8RkzTSTciWu5Uey8KL7Jtewzx/bLE2Y0NF8ykEtumSTHGjMpATYoH P4xpc5APU/AHkapkTHWVq0bVBqJD9TcPaZcA5F4xL2JedhWkwEQs5bIdFMxTuvdTkYv3RNbDzx2vX PXLHUkXXx/pQ6ws4S1efQsRVpVKJrO1m2l4wS4GVlG5CJQubFaRFJWbchpbDoEEWrtTUJhJMEIVTm Xkl7f+yg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tdA5G-00000007GZQ-1N2k; Wed, 29 Jan 2025 15:34:30 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tdA3v-00000007GMT-2v7M for linux-arm-kernel@lists.infradead.org; Wed, 29 Jan 2025 15:33:08 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id B48CDA41A6C; Wed, 29 Jan 2025 15:31:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26953C4CED1; Wed, 29 Jan 2025 15:33:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738164786; bh=3uM7U4qAvpldPCOBxKRU1v43qglokdN9MY8icFjja2I=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=GHsKqjCH8IcLZNdtcACkT40J7XtaHcBb4y+e64Mowj5qq+gGepeJ01FRVDMXKRH2W WWoYMNliWJSpEXwx08t5Ah4MQJ1tHzRBlNMHOv2Kw8BuNuQg0XjePbAcoOGfhvjJ3T T8GVvCGXRJKLXjxaavwQlFGIV5XN7xihtxyM44GvEmRocTHU6xAE/YLKxUUGSX42rc YFXI5FVxvzxapuJpg8pc0FlFmLWNzMnmdH+TMqgUAdUBIugFOMKr1pfJY3PsXs7m5x NtbtUkVG+WYQ91FW0upw6+eMEWD6TUR8xQtAHczdZA48cBGGExGuhuE5T+T8DoFDWm 4uhZMJmGCQ63A== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tdA3r-00GNF6-Kq; Wed, 29 Jan 2025 15:33:03 +0000 Date: Wed, 29 Jan 2025 15:33:02 +0000 Message-ID: <86bjvpvdn5.wl-maz@kernel.org> From: Marc Zyngier To: Colton Lewis Cc: kvm@vger.kernel.org, linux@armlinux.org.uk, catalin.marinas@arm.com, will@kernel.org, oliver.upton@linux.dev, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, mark.rutland@arm.com, pbonzini@redhat.com, shuah@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, linux-kselftest@vger.kernel.org Subject: Re: [RFC PATCH 1/4] perf: arm_pmuv3: Introduce module param to partition the PMU In-Reply-To: References: <87ikpzthjk.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.4 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: coltonlewis@google.com, kvm@vger.kernel.org, linux@armlinux.org.uk, catalin.marinas@arm.com, will@kernel.org, oliver.upton@linux.dev, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, mark.rutland@arm.com, pbonzini@redhat.com, shuah@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, linux-kselftest@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250129_073307_865020_9FBE0C12 X-CRM114-Status: GOOD ( 22.53 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 28 Jan 2025 22:08:27 +0000, Colton Lewis wrote: > > >> + bitmap_set(cpu_pmu->cntr_mask, 0, pmcr_n); > >> + > >> + if (reserved_guest_counters > 0 && reserved_guest_counters < pmcr_n) { > >> + cpu_pmu->hpmn = reserved_guest_counters; > >> + cpu_pmu->partitioned = true; > > > Isn't this going to completely explode on a kernel running at EL1? > > Trying to access an EL2 register at EL1 can do that. I'll add the > appropriate hypercalls. But what about a guest that would get passed the magic parameter? I think you want to prevent that too. > > > Also, how does it work in an asymmetric configuration where some CPUs > > can satisfy the reservation, and some can't? > > The CPUs that can't read their own value of PMCR.N below what the > attempted reservation is and so do not get partitioned. Nothing changes > for that CPU if it can't meet the reservation. That's not what I meant. The question really is: - do we want the reservation to be the number of counters reserved for the host - or do we want it to be for the guest? On symmetric systems, it doesn't matter. On broken big-little systems, this changes everything (it has a direct impact on userspace's ability to use the counters). I think the design should reflect a decision on the above. M. -- Without deviation from the norm, progress is not possible.