From patchwork Tue Jan 7 17:57:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 13929468 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 81CE9E77197 for ; Tue, 7 Jan 2025 18:00:57 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3fC9wowpZkbWoJuKElyCEJRKR87ZdcOItfjhewpcM14=; b=0rFPakW/5gBDaJ2Kzk6nS/CrSl mTh9ne3x8AkhojFQpoBsn71g2A/gshOobvfzGo/mJVNOR59tFhc3/A5p8Xgemgs22ym9IhB5u3Dgy 1Vre1eR2+5HmBIpQELSjRjFAI8Hz6JuD+q8xWLfBh0tlZO9CYcdeDdb6DeovsUrkHhUix4mZfLxch /Ac0+0doC1bD1OPpfYpMLSmxo4eBEanOklUWxgqOmoK85hMduesxEinAbbTD0zLr7MVgBRXnyHgzn HdsOlwFTZYBqtUU0/jZ4qihsZNmidYlka6XwjFELSA/n8wCBRzjvdmmT3Nr+rLLhhBiImT1Xh6Ajc stpDlEag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVDsj-00000005wb3-1rlZ; Tue, 07 Jan 2025 18:00:45 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVDq1-00000005vqn-48ot for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 17:57:59 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 6E6825C5AB7; Tue, 7 Jan 2025 17:57:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20324C4CEDD; Tue, 7 Jan 2025 17:57:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736272677; bh=sshLo3IhsFUalehf2Fn8CgaG+DdU2mxMe+CyT/ZQ0z8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=BKPptCII9UGPKfgx5aw/tglKhzECKOn4zgK/od1kd3F7d33q/dGVjWYENrZDAZbFg nTOzZm00lU42nNaliDepUyH/x+vZ3PZ3I8zXVJl+hm0P68pYh+b47CsE70fLoLdkvq A6VFvoiC6X//TYJY/Q6XX1blU5E4WCe8JrwbrF+fzHnWkZ5WkwnjBro/NVleCPNvjp 95wwZ0jcrBAqyuNLOCgCX5jqi7sg+pbswAgCwIpfCuxqjhTkEJ+5iNk6/XVddHOh21 aMNt3gDjPdJl2bnb7XaHzsCwTegspTFqFoAN08/NwjTZYEjOgT+DgDXCiJYjDOrh20 Uuvdt33nDIp9Q== From: "Rob Herring (Arm)" Date: Tue, 07 Jan 2025 11:57:19 -0600 Subject: [PATCH 1/7] perf: arm_pmuv3: Call kvm_vcpu_pmu_resync_el0() before enabling counters MIME-Version: 1.0 Message-Id: <20250107-arm-pmu-cleanups-v1-v1-1-313951346a25@kernel.org> References: <20250107-arm-pmu-cleanups-v1-v1-0-313951346a25@kernel.org> In-Reply-To: <20250107-arm-pmu-cleanups-v1-v1-0-313951346a25@kernel.org> To: Will Deacon , Mark Rutland Cc: Marc Zyngier , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.15-dev X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_095758_070527_182880F4 X-CRM114-Status: GOOD ( 10.44 ) 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 Counting events related to setup of the PMU is not desired, but kvm_vcpu_pmu_resync_el0() is called just after the PMU counters have been enabled. Move the call to before enabling the counters. Signed-off-by: Rob Herring (Arm) --- drivers/perf/arm_pmuv3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/perf/arm_pmuv3.c b/drivers/perf/arm_pmuv3.c index b5cc11abc962cc80e87afa26688a59f381eea105..dfef8d4669f58eb7f989a9582164b00a823ac60b 100644 --- a/drivers/perf/arm_pmuv3.c +++ b/drivers/perf/arm_pmuv3.c @@ -825,10 +825,10 @@ static void armv8pmu_start(struct arm_pmu *cpu_pmu) else armv8pmu_disable_user_access(); + kvm_vcpu_pmu_resync_el0(); + /* Enable all counters */ armv8pmu_pmcr_write(armv8pmu_pmcr_read() | ARMV8_PMU_PMCR_E); - - kvm_vcpu_pmu_resync_el0(); } static void armv8pmu_stop(struct arm_pmu *cpu_pmu) From patchwork Tue Jan 7 17:57:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 13929469 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 D8790E77197 for ; Tue, 7 Jan 2025 18:02:16 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/NZ5PkKWwqogh83p7m4ThLhG4atvxnGH1PhUqTUSDC0=; b=aQHov2tdsgVETP3+t9Bhs8bTzK 1n81Ya6o7jZy1j67JxCXdw4XJT4Lm/6sf/LEnwDrRfQqJKE53aiT7rZDLhku4HO+N/BEKtvOqMJrJ SeIIbcCSSnV0DvwOg/dh2Ry+Tw4FDstnzn4GLxyCDVsx4F1Cpc6KeDJS62p3IMELjyNDfgqAgQJRb x5nIZsR0cJ075HpAaAMp+tdy18kdwtq198EntaADvAdoNl/tCjAgZwlOArOMTykFqgaQsDXY9GBEC XXlcv9D/Vy5+TM8TyWdO0LXAU4gYUskm2EQsqWTm4RyET9cxpEtiXcnX0vB5h53bTvwjqLSMfmmi7 oUgrB54Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVDtu-00000005wnl-0oLe; Tue, 07 Jan 2025 18:01:58 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVDq3-00000005vrH-3Y2d for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 17:58:00 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 1CE76A41B45; Tue, 7 Jan 2025 17:56:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 614AFC4CEE1; Tue, 7 Jan 2025 17:57:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736272678; bh=5DSA0+mdRxVJt+CbOzGSEBIaXyQQIsiFn5Zx0DYYHsU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=iMupMDetIuxxR8k18HLGg2FUn2kCX6hxYkaaqfxG7fpiYH2mBOQ4UolihxY+CDDLW WXZaQbkAJ8Yw9+yOmq+CM22Ioo308t7bgWuG8NgxuGVVAWXma397cCLjasEF/WkjZm J1cst0YDL65G13cq5oVY+ByCJdUuffYIhXujfshHPamkdOYnjZWUSdsmJFUNhYmUot QWjdPABU2NLInrCQ+C3nTclm1+nLK7CvYi4woV5W1WqItywwDnbMgOXuFaSpK8+7ct OdeveqnnT+WbsDCGo/nODGUn+n/5aOBPP/CMWjVM5LAzBsY597hXGjJRaVAMSbnADV yd5hixivigfOQ== From: "Rob Herring (Arm)" Date: Tue, 07 Jan 2025 11:57:20 -0600 Subject: [PATCH 2/7] perf: arm_pmu: Don't disable counter in armpmu_add() MIME-Version: 1.0 Message-Id: <20250107-arm-pmu-cleanups-v1-v1-2-313951346a25@kernel.org> References: <20250107-arm-pmu-cleanups-v1-v1-0-313951346a25@kernel.org> In-Reply-To: <20250107-arm-pmu-cleanups-v1-v1-0-313951346a25@kernel.org> To: Will Deacon , Mark Rutland Cc: Marc Zyngier , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.15-dev X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_095759_954953_B8199D34 X-CRM114-Status: GOOD ( 17.81 ) 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 From: Mark Rutland Currently armpmu_add() tries to handle a newly-allocated counter having a stale associated event, but this should not be possible, and if this were to happen the current mitigation is insufficient and potentially expensive. It would be better to warn if we encounter the impossible case. Calls to pmu::add() and pmu::del() are serialized by the core perf code, and armpmu_del() clears the relevant slot in pmu_hw_events::events[] before clearing the bit in pmu_hw_events::used_mask such that the counter can be reallocated. Thus when armpmu_add() allocates a counter index from pmu_hw_events::used_mask, it should not be possible to observe a stale even in pmu_hw_events::events[] unless either pmu_hw_events::used_mask or pmu_hw_events::events[] have been corrupted. If this were to happen, we'd end up with two events with the same event->hw.idx, which would clash with each other during reprogramming, deletion, etc, and produce bogus results. Add a WARN_ON_ONCE() for this case so that we can detect if this ever occurs in practice. That possiblity aside, there's no need to call arm_pmu::disable(event) for the new event. The PMU reset code initialises the counter in a disabled state, and armpmu_del() will disable the counter before it can be reused. Remove the redundant disable. Signed-off-by: Mark Rutland Signed-off-by: Rob Herring (Arm) --- drivers/perf/arm_pmu.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c index 398cce3d76fc44dcc1e1f84f9e3c62b3574a8d12..2f33e69a8caf203928559e54adb2d354888c4b09 100644 --- a/drivers/perf/arm_pmu.c +++ b/drivers/perf/arm_pmu.c @@ -342,12 +342,10 @@ armpmu_add(struct perf_event *event, int flags) if (idx < 0) return idx; - /* - * If there is an event in the counter we are going to use then make - * sure it is disabled. - */ + /* The newly-allocated counter should be empty */ + WARN_ON_ONCE(hw_events->events[idx]); + event->hw.idx = idx; - armpmu->disable(event); hw_events->events[idx] = event; hwc->state = PERF_HES_STOPPED | PERF_HES_UPTODATE; From patchwork Tue Jan 7 17:57:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 13929470 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 A4890E77197 for ; Tue, 7 Jan 2025 18:03:25 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UpeyMU9mAouF5+ieJTiBptIIVXGF1w1Vi2mtyhmI18k=; b=jCoyoAL06y8LrvBNQGXO1J6Kvi jut+NqdmsuTlFakyrblMx9RGzf9GYTkVZkpBwc73C/sieakIV9/Xx1OeDH/OUxA0GIoLKLTTdpzse rgCtseEh4CSiEMniNm2Ouo5PLzI0x+xzBZ3rkeOxqCLyzuK6ZI6okPnqKMZESFw2E2xb5n76/AWdm STuyr8T0jQqrzYVfDZz5tGf1Vjmu1f0W3IlLYdZ0/Q5j0LZrlUBI3YNeHwAkB01y4Yg/K4Tq+cTPB ZfWu5+9nUT0gfITAa/QmEi/Yf1Wzv2t96UeUrcIUR7MItMho/nSGALn3G8tQfkDYU/hvRG0ULsxQJ K9Dlv8og==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVDv4-00000005wz2-3r3N; Tue, 07 Jan 2025 18:03:10 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVDq4-00000005vrW-34L7 for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 17:58:01 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 05F925C5B2D; Tue, 7 Jan 2025 17:57:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9ACBAC4CEDD; Tue, 7 Jan 2025 17:57:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736272679; bh=5URfCVQGt60Qv1ThmRA61G0kbMgHGKkbCZK3fRVjnOE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=u4HphdXBR2Mzj+zIheW5IIWU1w4wJRKDxGVN1uwPVnhqTxDRpe5YjGlD2kbHrEHX/ 51rRMoL1aCAZ5161wFgienkS4EDoHF8CXym2AsA+3f71wrW3GC+/2jmqxy+KsZB5MB K0kR69d0EqRhQTGX2NN3rcVhSWg7G8ogqOyxqZB1W9M7S7jHlEaO1IHm9yPYPIKDo3 P7QV+g1sW2yslRNcbna9sx2oEi3cCue1JATAAcBmeJx2dchtfYXAvQMkSFBqQKcyEi OWoL7oAPJTSPAjaczkRRTKrEQggB9+fCXashmSyA9mLrACf2WfRltPCrEbb/EvWmsG XskxjfiJpW9kg== From: "Rob Herring (Arm)" Date: Tue, 07 Jan 2025 11:57:21 -0600 Subject: [PATCH 3/7] perf: arm_pmuv3: Don't disable counter in armv8pmu_enable_event() MIME-Version: 1.0 Message-Id: <20250107-arm-pmu-cleanups-v1-v1-3-313951346a25@kernel.org> References: <20250107-arm-pmu-cleanups-v1-v1-0-313951346a25@kernel.org> In-Reply-To: <20250107-arm-pmu-cleanups-v1-v1-0-313951346a25@kernel.org> To: Will Deacon , Mark Rutland Cc: Marc Zyngier , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.15-dev X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_095800_816467_015C8718 X-CRM114-Status: GOOD ( 11.21 ) 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 From: Mark Rutland Currently armv8pmu_enable_event() starts by disabling the event counter it has been asked to enable. This should not be necessary as the counter (and the PMU as a whole) should not be active when armv8pmu_enable_event() is called. Remove the redundant call to armv8pmu_disable_event_counter(). At the same time, remove the comment immeditately above as everything it says is obvious from the function names below. Signed-off-by: Mark Rutland Signed-off-by: Rob Herring (Arm) --- drivers/perf/arm_pmuv3.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/perf/arm_pmuv3.c b/drivers/perf/arm_pmuv3.c index dfef8d4669f58eb7f989a9582164b00a823ac60b..7a1056e1e686146c2c7b20f62d19d384f1ae422b 100644 --- a/drivers/perf/arm_pmuv3.c +++ b/drivers/perf/arm_pmuv3.c @@ -795,11 +795,6 @@ static void armv8pmu_enable_user_access(struct arm_pmu *cpu_pmu) static void armv8pmu_enable_event(struct perf_event *event) { - /* - * Enable counter and interrupt, and set the counter to count - * the event that we're interested in. - */ - armv8pmu_disable_event_counter(event); armv8pmu_write_event_type(event); armv8pmu_enable_event_irq(event); armv8pmu_enable_event_counter(event); From patchwork Tue Jan 7 17:57:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 13929473 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 BE228E77197 for ; Tue, 7 Jan 2025 18:04:37 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=MLBiwj8IfogrcJ7y12ztRmoNwpQiHsX8ttvL+3tsLnk=; b=uIrXnrqc8usK7e/Xx2AgnpAFd2 Sc9SHTqivxDAvR57O7wK8OkyTluFhtxmcYI/dTiPCs7Kz1K+Rm5Q8yoch769w9yRNsiXnsJk6P8En ScwB/aCjCa5Ot3KeidLp2OQxfKjspTiF3A7ezUm+0uRiLh0QbYCfWUSNDQjBMAD6ctZ4t5R39QNLU Dtod2ydgk4Hsgpn9mhVmF1QS6Qv9zp59Xh4rOF4x4sbJKifzYw61cZ6ZOebGeZq1tANHR9HBFT8L8 bORqbGjjDDDizryxw3gN5F/WjxKcaUUEcTgztfZXBbud4desjoroFkgeKcn1NaMT3gX6FFJZhBU+R rGzel0ag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVDwF-00000005xBG-2EXf; Tue, 07 Jan 2025 18:04:23 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVDq5-00000005vrs-3aV5 for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 17:58:02 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 48E405C5ACB; Tue, 7 Jan 2025 17:57:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF930C4CED6; Tue, 7 Jan 2025 17:58:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736272681; bh=bGHhhbymQuCF6yfAGiV6Cpz7xaEk/cyDDkdwRpKdx1g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=fHPEA7iIoNVoepGleuV3evVE6t6TzF9Qzz9mmg9oqdFESZnneHb86MWmBOxFBgkHS HgxaV4n5RalQmsvR8DZ55EWQDDC1geGDml8TpbiKjz/tG2yE9qDZFLjTN7teqOjvVb /qT/F6X5MPrUUyq96vTGZwSwbNDcAvo0y4KFGKtewFZDFhQQzJS9x4vwViyuckYXf3 pg5Ka/U0f2R8jlXfxuGW2uIGhTz5bRDrUyJCccKtya4lgqd25SgGPhB2R1V+lE1KNH HAjoSsSGTdGUVtPk9A41A6yf9k2lcG/85OmxWLzJEsuxlWoNCVxBYkUXvkLV6zAyK6 5hcQiJMngbcQg== From: "Rob Herring (Arm)" Date: Tue, 07 Jan 2025 11:57:22 -0600 Subject: [PATCH 4/7] perf: arm_v7_pmu: Drop obvious comments for enabling/disabling counters and interrupts MIME-Version: 1.0 Message-Id: <20250107-arm-pmu-cleanups-v1-v1-4-313951346a25@kernel.org> References: <20250107-arm-pmu-cleanups-v1-v1-0-313951346a25@kernel.org> In-Reply-To: <20250107-arm-pmu-cleanups-v1-v1-0-313951346a25@kernel.org> To: Will Deacon , Mark Rutland Cc: Marc Zyngier , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.15-dev X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_095801_985373_840D3FF8 X-CRM114-Status: GOOD ( 10.34 ) 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 The function calls for enabling/disabling counters and interrupts are pretty obvious as to what they are doing, and the comments don't add any additional value. Signed-off-by: Rob Herring (Arm) --- drivers/perf/arm_v7_pmu.c | 44 -------------------------------------------- 1 file changed, 44 deletions(-) diff --git a/drivers/perf/arm_v7_pmu.c b/drivers/perf/arm_v7_pmu.c index 420cadd108e79821f43537fab23fe081ca6fd9bc..7fa88e3b64e07bacbf2f9731e3318a7dc1085fb1 100644 --- a/drivers/perf/arm_v7_pmu.c +++ b/drivers/perf/arm_v7_pmu.c @@ -857,14 +857,6 @@ static void armv7pmu_enable_event(struct perf_event *event) return; } - /* - * Enable counter and interrupt, and set the counter to count - * the event that we're interested in. - */ - - /* - * Disable counter - */ armv7_pmnc_disable_counter(idx); /* @@ -875,14 +867,7 @@ static void armv7pmu_enable_event(struct perf_event *event) if (cpu_pmu->set_event_filter || idx != ARMV7_IDX_CYCLE_COUNTER) armv7_pmnc_write_evtsel(idx, hwc->config_base); - /* - * Enable interrupt for this counter - */ armv7_pmnc_enable_intens(idx); - - /* - * Enable counter - */ armv7_pmnc_enable_counter(idx); } @@ -898,18 +883,7 @@ static void armv7pmu_disable_event(struct perf_event *event) return; } - /* - * Disable counter and interrupt - */ - - /* - * Disable counter - */ armv7_pmnc_disable_counter(idx); - - /* - * Disable interrupt for this counter - */ armv7_pmnc_disable_intens(idx); } @@ -1476,12 +1450,6 @@ static void krait_pmu_enable_event(struct perf_event *event) struct hw_perf_event *hwc = &event->hw; int idx = hwc->idx; - /* - * Enable counter and interrupt, and set the counter to count - * the event that we're interested in. - */ - - /* Disable counter */ armv7_pmnc_disable_counter(idx); /* @@ -1494,10 +1462,7 @@ static void krait_pmu_enable_event(struct perf_event *event) else armv7_pmnc_write_evtsel(idx, hwc->config_base); - /* Enable interrupt for this counter */ armv7_pmnc_enable_intens(idx); - - /* Enable counter */ armv7_pmnc_enable_counter(idx); } @@ -1797,12 +1762,6 @@ static void scorpion_pmu_enable_event(struct perf_event *event) struct hw_perf_event *hwc = &event->hw; int idx = hwc->idx; - /* - * Enable counter and interrupt, and set the counter to count - * the event that we're interested in. - */ - - /* Disable counter */ armv7_pmnc_disable_counter(idx); /* @@ -1815,10 +1774,7 @@ static void scorpion_pmu_enable_event(struct perf_event *event) else if (idx != ARMV7_IDX_CYCLE_COUNTER) armv7_pmnc_write_evtsel(idx, hwc->config_base); - /* Enable interrupt for this counter */ armv7_pmnc_enable_intens(idx); - - /* Enable counter */ armv7_pmnc_enable_counter(idx); } From patchwork Tue Jan 7 17:57:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 13929474 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 C4F70E77198 for ; Tue, 7 Jan 2025 18:05:49 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8Q4BvjsThbcuk2yWaiu4PjWEhQ6b9AxZqya0BriW4qw=; b=UvFPwGVNMjDhrDitQiPAjYCRde jXQOvldSUj3h/ROWTyPomvJ+2lLvGH233jGF/kMH2r3lc6NsWzwODftZWJ4lc5VevlEilbmCJwL1l XCJim+5c6swjOPbzR1wZaBlwXV8AFRSMEqgYK2aPT/U9asYLvJ18VyL4y6qE2l6pzeyy8dQ4XGSdY nhFZi/LghKdcx9+no63VvVFmTBkHBkQAm6s0HleH8IEXpUlE2zpIJMnle1ssabf9N7ZRXlzUDGFb9 F1BdLWrybD/mdTMotnf/AKVnpp58ZB2HbDRFG97zYRsi0Gfx7gtgnXoJlrwi0J7XOWRUgAyf0FHqr 3+Mk+fpQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVDxR-00000005xJH-0pZz; Tue, 07 Jan 2025 18:05:37 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVDq8-00000005vsK-0CjG for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 17:58:05 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 7A0035C5AB0; Tue, 7 Jan 2025 17:57:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BAE23C4CED6; Tue, 7 Jan 2025 17:58:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736272683; bh=XFA/YG0tyw7HQ7kQjjoUNZxsPed+1g9YsBcAFNNi/7w=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=k5WmGUi8BAtGwlotCQj+i7lLyYJ0pteKdHcxWbY71z6am74TMZY0Qckm1bRkB0iR1 2v0qNfMAxNrV0n48WwqDdW61+giEwDzWV59XYco09AiUeXdUCrSmg5PM7Lh/FdgtBt XsqAuqBNJCTyY6DYTEeJpVUiTHM56yqy96HeEjqOP93eGV+UOFdPZqb9uw/aG4LzGI uD/zBREmDB8OSnyoaUWb7i7j3xoVJyiIzHm+QH4jgUB8+aPjNUCr4ocWXISyCmXm+I jV8UfdYEJ69AwxJRUaNbjg+rk64KQ9YywXi5pGXreOPN4jTpkz6rUlDDJcRfIfWrLW Db6tV/vn3dY/A== From: "Rob Herring (Arm)" Date: Tue, 07 Jan 2025 11:57:23 -0600 Subject: [PATCH 5/7] perf: arm_v7_pmu: Don't disable counter in (armv7|krait_|scorpion_)pmu_enable_event() MIME-Version: 1.0 Message-Id: <20250107-arm-pmu-cleanups-v1-v1-5-313951346a25@kernel.org> References: <20250107-arm-pmu-cleanups-v1-v1-0-313951346a25@kernel.org> In-Reply-To: <20250107-arm-pmu-cleanups-v1-v1-0-313951346a25@kernel.org> To: Will Deacon , Mark Rutland Cc: Marc Zyngier , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.15-dev X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_095804_132460_B6E4C85F X-CRM114-Status: GOOD ( 10.35 ) 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 Currently (armv7|krait_|scorpion_)pmu_enable_event() start by disabling the event counter it has been asked to enable. This should not be necessary as the counter (and the PMU as a whole) should not be active when *_enable_event() is called. Signed-off-by: Rob Herring (Arm) --- drivers/perf/arm_v7_pmu.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/perf/arm_v7_pmu.c b/drivers/perf/arm_v7_pmu.c index 7fa88e3b64e07bacbf2f9731e3318a7dc1085fb1..17831e1920bd8d306aa1ea9cebe8b3f4659dfcee 100644 --- a/drivers/perf/arm_v7_pmu.c +++ b/drivers/perf/arm_v7_pmu.c @@ -857,8 +857,6 @@ static void armv7pmu_enable_event(struct perf_event *event) return; } - armv7_pmnc_disable_counter(idx); - /* * Set event (if destined for PMNx counters) * We only need to set the event for the cycle counter if we @@ -1450,8 +1448,6 @@ static void krait_pmu_enable_event(struct perf_event *event) struct hw_perf_event *hwc = &event->hw; int idx = hwc->idx; - armv7_pmnc_disable_counter(idx); - /* * Set event (if destined for PMNx counters) * We set the event for the cycle counter because we @@ -1762,8 +1758,6 @@ static void scorpion_pmu_enable_event(struct perf_event *event) struct hw_perf_event *hwc = &event->hw; int idx = hwc->idx; - armv7_pmnc_disable_counter(idx); - /* * Set event (if destined for PMNx counters) * We don't set the event for the cycle counter because we From patchwork Tue Jan 7 17:57:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 13929475 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 25770E77197 for ; Tue, 7 Jan 2025 18:07:03 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=h4xMrJV0xDE8bH+rFgV2L3NCUSZODrvnlDr67+jwP50=; b=ROd0KSVeWeQAPvGLLNe7nqjStC dgG2pgg7m2H24ZgKNGCbaphNIzwRdtzo7FkC80a9jPaeewIh7TidBNTb12KSQDRUKm898EYPgVuUb 0HfMoH1LHWja41bMCOuyTFtyJDn8CRDkRvBNwnIi5auZNGpKs+IYhLkcO95XoqzfzRpf3qbxhXylx wXXSmmVApg33Jtok8ZGA+nfHLDReP3CygCKhZIFM7L6dZ1SHCH90K5I2hgrhKF3+hlmTplQMCmZ6h B/4j5sW9HDc0hEpwcxTZoIxE8CC4LCU50weSRnK+WkOa2dHE+RVgdGXlJZZBoSSuRfjzQrYNk58g4 3YQkGJlA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVDyb-00000005xWP-3WVr; Tue, 07 Jan 2025 18:06:49 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVDq9-00000005vsn-1RvI for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 17:58:06 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id BF6E75C5ACB; Tue, 7 Jan 2025 17:57:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7270EC4CED6; Tue, 7 Jan 2025 17:58:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736272684; bh=GB50mQ0xAwvXLDxGsfO9zTbH3wdQV2KxHTzCYS5KFS0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=nloULJM8rOfQZkcs39y/l5GTiRGlytGoyivKtOSvBjTv6mKexBvm91vcKXoOGC9De 9BogOAa7HMa6PRFu0+LFO/eMIpRt4Zn5u+fbL7JVuxxzECZlO401iCyoN3YM/ychrH ddhMOg9B/tK4EAoQpJhMVhR7M+UmhK7h6B+txwOnmUes+0JN8fTaAAp2segvbV03im X6BFJvYQaasvdxlmYWff2B1qB2B63J26962+bGfdQcJoppnABGWfewZZ5pPCojpF5G Krj++IQkwHz9o4JJWkHdPGeyvY0t/KzI2Ao9a+kyZng6QzAdy47s4QHAq3E1Gn6pmI ftq4O6DHKln6A== From: "Rob Herring (Arm)" Date: Tue, 07 Jan 2025 11:57:24 -0600 Subject: [PATCH 6/7] perf: apple_m1: Don't disable counter in m1_pmu_enable_event() MIME-Version: 1.0 Message-Id: <20250107-arm-pmu-cleanups-v1-v1-6-313951346a25@kernel.org> References: <20250107-arm-pmu-cleanups-v1-v1-0-313951346a25@kernel.org> In-Reply-To: <20250107-arm-pmu-cleanups-v1-v1-0-313951346a25@kernel.org> To: Will Deacon , Mark Rutland Cc: Marc Zyngier , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.15-dev X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_095805_428514_35F94D16 X-CRM114-Status: UNSURE ( 9.62 ) X-CRM114-Notice: Please train this message. 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 Currently m1_pmu_enable_event() starts by disabling the event counter it has been asked to enable. This should not be necessary as the counter (and the PMU as a whole) should not be active when m1_pmu_enable_event() is called. Cc: Marc Zyngier Signed-off-by: Rob Herring (Arm) --- drivers/perf/apple_m1_cpu_pmu.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/perf/apple_m1_cpu_pmu.c b/drivers/perf/apple_m1_cpu_pmu.c index 1d4d01e1275e05c9dc656502d22de5bb2fc46b11..6a7071f0298d3d15f0c6f2fbc49789d669aa02e6 100644 --- a/drivers/perf/apple_m1_cpu_pmu.c +++ b/drivers/perf/apple_m1_cpu_pmu.c @@ -394,10 +394,6 @@ static void m1_pmu_enable_event(struct perf_event *event) user = event->hw.config_base & M1_PMU_CFG_COUNT_USER; kernel = event->hw.config_base & M1_PMU_CFG_COUNT_KERNEL; - m1_pmu_disable_counter_interrupt(event->hw.idx); - m1_pmu_disable_counter(event->hw.idx); - isb(); - m1_pmu_configure_counter(event->hw.idx, evt, user, kernel); m1_pmu_enable_counter(event->hw.idx); m1_pmu_enable_counter_interrupt(event->hw.idx); From patchwork Tue Jan 7 17:57:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 13929476 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 76BA4E77197 for ; Tue, 7 Jan 2025 18:08:17 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=iCVvBc/q46uXPhJ4U6mLtaG15DnUSJRSqJD6EcromvU=; b=tY5ApAnBW96bYbuOpwHDzc+PUf B/pcX1IHTrnta4PhHUU5gxuKRd9w8STN/fcCibFseEKk/BSknvTPqV4SJXSC0vKJ1GwJacEiTzFIO qfUoOCnpBQk1mZYq9eo0jNkLw6Ler4VbWv5T0/DNEdjA33p5MZRpym0avpnq//dzQjKhu6CkZyGw/ g7KH3nrYchKAhs9Svb4rUZwpxusS269lNP/bePPGMVEnpmG2shUUhuHxQQSC3dnG4BmgeZN7860oh z2Ev9b4e+a13OMvnnBdHPN5h1r1uKnFFQ+e3ntrZbKVHJt7a6EUfCWMRiwSf3uN98AsKDqM5QoVap 2iPO1RYw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVDzm-00000005xfW-1wxx; Tue, 07 Jan 2025 18:08:02 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVDqA-00000005vtO-1VhN for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2025 17:58:07 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id C66F95C5B5B; Tue, 7 Jan 2025 17:57:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91F76C4CEDD; Tue, 7 Jan 2025 17:58:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736272685; bh=Xg0HoZ+XSp8w6IMRK8GIJFRMyzdy5hLO5u4gC+4TkYs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=o8M8/kRQGcpF0+IVRy8JCTN1s+ST4iPUbVn+Jd2f96tKgqeQdgThP9TH7Yo9KdIl9 EBTAbUQk3UUb0MryJM6s5bnVAbtGHBMFEFkcDIUZ1vkh8gzOpiLO59yYwJy3jxmZ2r vOK1NPtz+5heBV/k3kfTuoOZfW3fAqJILky3A6/7THaTaykzIWLIqf0WE04KF3HqgG U2VLiz7Xcb7gOKHoUAFceLmg3dPP4ULD+0qMglw6iypwEQWrXAt07/G3UJ9tFCRrIP zESCb1OgbRj7HrGWdi2JoCHAcQO+I0ICGInsHYe8gL5T37Q1No21wFihW3fee6hpnn CiaqFKfPl4Z7Q== From: "Rob Herring (Arm)" Date: Tue, 07 Jan 2025 11:57:25 -0600 Subject: [PATCH 7/7] perf: arm_pmu: Move PMUv3-specific data MIME-Version: 1.0 Message-Id: <20250107-arm-pmu-cleanups-v1-v1-7-313951346a25@kernel.org> References: <20250107-arm-pmu-cleanups-v1-v1-0-313951346a25@kernel.org> In-Reply-To: <20250107-arm-pmu-cleanups-v1-v1-0-313951346a25@kernel.org> To: Will Deacon , Mark Rutland Cc: Marc Zyngier , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.15-dev X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_095806_448431_D7E33837 X-CRM114-Status: GOOD ( 13.30 ) 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 From: Mark Rutland A few fields in struct arm_pmu are only used with PMUv3, and soon we will need to add more for BRBE. Group the fields together so that we have a logical place to add more data in future. At the same time, remove the comment for reg_pmmir as it doesn't convey anything useful. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland Signed-off-by: Rob Herring (Arm) --- include/linux/perf/arm_pmu.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h index 4b5b83677e3f28b578c1d63a5f89b5f248e06876..c70d528594f26a39a74e00ec353824a484cb55e8 100644 --- a/include/linux/perf/arm_pmu.h +++ b/include/linux/perf/arm_pmu.h @@ -84,7 +84,6 @@ struct arm_pmu { struct pmu pmu; cpumask_t supported_cpus; char *name; - int pmuver; irqreturn_t (*handle_irq)(struct arm_pmu *pmu); void (*enable)(struct perf_event *event); void (*disable)(struct perf_event *event); @@ -102,18 +101,20 @@ struct arm_pmu { int (*map_event)(struct perf_event *event); DECLARE_BITMAP(cntr_mask, ARMPMU_MAX_HWEVENTS); bool secure_access; /* 32-bit ARM only */ -#define ARMV8_PMUV3_MAX_COMMON_EVENTS 0x40 - DECLARE_BITMAP(pmceid_bitmap, ARMV8_PMUV3_MAX_COMMON_EVENTS); -#define ARMV8_PMUV3_EXT_COMMON_EVENT_BASE 0x4000 - DECLARE_BITMAP(pmceid_ext_bitmap, ARMV8_PMUV3_MAX_COMMON_EVENTS); struct platform_device *plat_device; struct pmu_hw_events __percpu *hw_events; struct hlist_node node; struct notifier_block cpu_pm_nb; /* the attr_groups array must be NULL-terminated */ const struct attribute_group *attr_groups[ARMPMU_NR_ATTR_GROUPS + 1]; - /* store the PMMIR_EL1 to expose slots */ + + /* PMUv3 only */ + int pmuver; u64 reg_pmmir; +#define ARMV8_PMUV3_MAX_COMMON_EVENTS 0x40 + DECLARE_BITMAP(pmceid_bitmap, ARMV8_PMUV3_MAX_COMMON_EVENTS); +#define ARMV8_PMUV3_EXT_COMMON_EVENT_BASE 0x4000 + DECLARE_BITMAP(pmceid_ext_bitmap, ARMV8_PMUV3_MAX_COMMON_EVENTS); /* Only to be used by ACPI probing code */ unsigned long acpi_cpuid;