From patchwork Wed Jul 10 18:23:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 13729568 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 BFE50C3DA41 for ; Wed, 10 Jul 2024 18:24:43 +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-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=rnqldg6dingLWG2OSBdbSDnTbAO29gxEThyM7He2Etc=; b=zOq3CJzzZraPUTzhRK5SIseaPi fJy9nvxSw5fDQ32s8Juhu4xb6eBG3MmfNt8u55hQGXH0xw9LvQcy4v3Y1wc8JBxEN5ob81rxuwPUi qroIcPFin6p/2iP0Vs02KJGv6FBCSq9tzeMU2OrOhW/EOvqLnW1mowOTnUtQJhGQTscib3wKp/XdY jn8tNscpKFaF6Cq9wXhFXuzAtshketYA8Cs7AUuLCfodxJogC2w3rumU4oAE6GQWZBvFmq7lYdJxo IGJJaUfzDAfsgoUaRTtJClFMggIJTM9KOxR3KTncI8mpyq6k1sLC7M9op11LOvrE7f4WdKGns6DIh TUeKfF8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRbzU-0000000BPTx-2ayl; Wed, 10 Jul 2024 18:24:32 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRbzD-0000000BPPn-2Jwa for linux-arm-kernel@lists.infradead.org; Wed, 10 Jul 2024 18:24:16 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id EE66CCE169E; Wed, 10 Jul 2024 18:24:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7EBCC32781; Wed, 10 Jul 2024 18:24:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720635851; bh=8SZKFJyedywx5ZvuuHTT1yzw/aUPfNyJ0LEd/6JrPTw=; h=From:To:Cc:Subject:Date:From; b=GxLi6BBJwK5U8yqeJk0jx4GtVjdaV+COb7/MOEA/asH2MGcHHANg4Btt1al822Biz dVfKWcIW7e7hOqXIR/GHH4pLJKmLwWEWezCP7Fk+YhkdMtc3XHjADRYnZJteWDCN10 QNBXFuDAXhNyvZ4dZTpMg2mM7Tna3JV+vZ1/NsZrgMm7Iep6qSqQwCBVAi//yvhdwL IcCJ8zDv5vVbiNJcrNAsOg3ZDhQJwH5F03I3HAPsm635CjtPbb7HCEzvTW+G9T3FwU 6Oy1TMDPVLjmZ0Xx0aBrzHKLsloXLnadiXsh62mGtAD4+V2/+0gKaYxLAxbc/LX3xS MLWWTcV4hRllQ== From: "Rob Herring (Arm)" To: Will Deacon , Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] perf: arm_pmuv3: Fix chained event check for cycle counter Date: Wed, 10 Jul 2024 12:23:56 -0600 Message-ID: <20240710182357.3701635-1-robh@kernel.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240710_112415_793983_9EBA2553 X-CRM114-Status: GOOD ( 11.88 ) 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 Since commit b7e89b0f5bd7 ("perf: arm_pmu: Remove event index to counter remapping"), armv8pmu_event_is_chained() is incorrectly returning that the cycle counter is chained, but the cycle counter has always been 64-bit. The result is trying to configure counter #30 which typically doesn't exist. As ARMV8_PMU_MAX_GENERAL_COUNTERS is the number of counters (31), the comparison to the counter index needs to be '<' rather than '<='. Fixes: b7e89b0f5bd7 ("perf: arm_pmu: Remove event index to counter remapping") Signed-off-by: Rob Herring (Arm) Acked-by: Will Deacon --- drivers/perf/arm_pmuv3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/perf/arm_pmuv3.c b/drivers/perf/arm_pmuv3.c index 3b3a3334cc3f..0e22c68fb804 100644 --- a/drivers/perf/arm_pmuv3.c +++ b/drivers/perf/arm_pmuv3.c @@ -482,7 +482,7 @@ static bool armv8pmu_event_is_chained(struct perf_event *event) return !armv8pmu_event_has_user_read(event) && armv8pmu_event_is_64bit(event) && !armv8pmu_has_long_event(cpu_pmu) && - (idx <= ARMV8_PMU_MAX_GENERAL_COUNTERS); + (idx < ARMV8_PMU_MAX_GENERAL_COUNTERS); } /*