From patchwork Fri Nov 3 00:16:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilkka Koskinen X-Patchwork-Id: 13444281 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 CFC78C4167D for ; Fri, 3 Nov 2023 00:18:10 +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:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=SMXpDwUSv0jg/AeLJ7nQr1rKG4L3shH5+cvMcdoAwWk=; b=EskpFyBJt7sp+M AGRnssoOBL4oWNUUhx+D+qll3PDjDfJtAsS5XHP3qY7crVJYebeJBX7+4XiqpWGkQVoSKsbDppf3N RRQCVDAdJiBOhfLEn1SYzrqcOg4TdL/H0f8F5uwbK/4SImPnJmJFahhy8TjMJnp5X6H2EFpbOP5o3 0q7KOWRHXeCGe/f+JxSlfgZmxlg5sReL9hr9+WocBcNG3hMpzTUpuJk0l61oAPTAMvy9pXRvHnurY xIh8/edt795rLV0tTolr61A1rIA3lkFqifPN2Rv6nHzkC/f8X3TFVQoeEHHdMKiYp8Nyh/Sc3PasC o4Kn16nY5UzO80sEbgxQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qyhsT-00AV7i-0b; Fri, 03 Nov 2023 00:17:33 +0000 Received: from mail-dm6nam10on20722.outbound.protection.outlook.com ([2a01:111:f400:7e88::722] helo=NAM10-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qyhsN-00AV6c-23 for linux-arm-kernel@lists.infradead.org; Fri, 03 Nov 2023 00:17:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KJ1AT0CNWg5AkGdjOnRQ+A2L+t3XwGAulrOkTzD/zqwRhQlyLBVVctnH6KLszaXO/gixo4lOB0mM1J082Hl/JyiKvQ1M8JVKmKHVGgCsw3J/ZLiJmpjmIBo7Z0ccK8gkBIjlo9OZhEL4ZHho0e059DksLlQ0KkpktD012sSIsjw92A9IywwAs4dyKOALsNW2gr1Aap7uPtX7yIU64/9TYb4D99sWduDxiVEts1Z5IiZqH4A1Vt91jzA3xHeKUShOqJMSnGHf60drWF8FnDHwlL7jdOLwOfAYn0Uk9fnDkm1qcpURK+EQX0BpAUuZkJ3kpKzi5NhRXZvZp/0+FYtSFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GGketpKI5rmxKh18ibSP1FRO9u2E+nT9JpG8FKhYiYM=; b=BDDMfK2oG/G6JiGC3tcNP8LjPyyyKIg87WZD61fEvR0i53en7OFzuLB6+BH2SgSuduwIAsVilcZ3Dy1Lfx1aDegDpMgp1nDFB/WZX/RkuMjwbZiokR2M4AwoPvkHLcp2JVQV3HIdY8uSrHWfcPDiODEiXdyrz10bJRFFvHHQyizgVOlVtUDT5dskNOxzWOZqo5MnD031vhnr1Ln7FXIVMC1IeCl5ZXbqfYkuCYA7X/oCWRt4Ilx1jB5WAX5zBt55OzoDhSn4RjZgYzME3YPiew3dAVSqhXxc7ua7/AxxkoVg6kCt7T0l8b0Q974XzBeHayOwdPKoxVp7XmMw2nYWNw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GGketpKI5rmxKh18ibSP1FRO9u2E+nT9JpG8FKhYiYM=; b=C053Ac7ZCKG+K6TP2lJZwF4RSiFUruTI60X0lnZvk1JH9Lbmr5RvaetJeG6cNERgHriQE5rEhuxj2GdVwZ12Vy0lDrXDN8zcFxa04bZMXq8o9Fi/HxSpqSuoLmDcdZ35D7wDWzE+RrOGk070aYK2d5joiLwU5ETCSoIvGrIMnXE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from DM5PR0102MB3590.prod.exchangelabs.com (2603:10b6:4:a4::25) by DM8PR01MB6808.prod.exchangelabs.com (2603:10b6:8:23::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.19; Fri, 3 Nov 2023 00:17:15 +0000 Received: from DM5PR0102MB3590.prod.exchangelabs.com ([fe80::f7a2:1a96:ba3f:d70f]) by DM5PR0102MB3590.prod.exchangelabs.com ([fe80::f7a2:1a96:ba3f:d70f%4]) with mapi id 15.20.6933.024; Fri, 3 Nov 2023 00:17:13 +0000 From: Ilkka Koskinen To: Besar Wicaksono , Suzuki K Poulose , Robin Murphy , Will Deacon , Mark Rutland , Raag Jadav , Ilkka Koskinen Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] perf: arm_cspmu: Reject events meant for other PMUs Date: Thu, 2 Nov 2023 17:16:54 -0700 Message-Id: <20231103001654.35565-1-ilkka@os.amperecomputing.com> X-Mailer: git-send-email 2.40.1 X-ClientProxiedBy: CH0P223CA0020.NAMP223.PROD.OUTLOOK.COM (2603:10b6:610:116::10) To DM5PR0102MB3590.prod.exchangelabs.com (2603:10b6:4:a4::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR0102MB3590:EE_|DM8PR01MB6808:EE_ X-MS-Office365-Filtering-Correlation-Id: 8dd68dfc-19c3-4da4-d1b8-08dbdc023a36 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pObBRVra+uSdYbZUa7qJGSRBYqK9DzUAKbwSnueQ5IxA9QOPF7gnTa42E1khwfxdTAXaXLqSHur13m0R4+jPKAxXs3cqNSg7/dveJLVLVkTLAsASirUBFGccFS4vl1sHNSGJ03AXX/uWeKOaIjNiaqelYJVkM5H8XcvCZrIL0dGJlC6I7tn5fVm/hR/mD4IVtery1B+4Kx4F4MH+C8of5/B8DSmOAXLBOqkz7uyflfytd8xGFAvRDYzREK388jkhTpPaYwoLMZrd2HbDCHV+uZKaIvaGPQ+5HMYc4gsSp21dTF16U8mUpGaiDbpKBn3sN7Bxal53snm47ZIbeq3JYgiqMi0ldEEdVO1s5mabxTQOnW2dp+lv9mg/m7fSK3E6nhXl+pUw4mE/9ed/TCWQYFdfRK6NV7URdsY8aYtHI6MGg66RnC3yghzucJej+CopOJe72u4gSGnMYVzJIolDqx72G9WrwtSUQ+Yf53Jxe87fsTDKa1fgSfFsFLbHMePaiLKSOdHagsROc9hdHvEKMLEuWWHl9+9lXNMJQ1X27WD/RclPh2dhphr9nt3/7uIKFjTxF8hXXvLtphegtEb3jJwJHa6f0oXprl4XQ2tRiuSty1cqsBCGI6FHAkr8h3oB X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR0102MB3590.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230031)(39850400004)(376002)(396003)(346002)(136003)(366004)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(66899024)(2906002)(6486002)(478600001)(1076003)(2616005)(26005)(41300700001)(38350700005)(38100700002)(86362001)(52116002)(6506007)(6666004)(6512007)(66476007)(66556008)(66946007)(110136005)(316002)(5660300002)(8676002)(8936002)(4326008)(7049001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Y0RaV71QYrTF7bXjBEVJjnTnZwEzefkDkfp1RKpRzcj13J3bI7CymU4kB73qw6smKVv1TPFC+eM5iuF2qHR/20oOSvx+GPWfLlshWVdK3TTXb9Df04B4Pfo9GAfuH/lXPdBQnJrAmdG3qcWuM/P+7XRtDdEvpfMIGNPbpA7kRg9YVeZLkBdYC1Afg/VJZFVPefWX6W7XCeKNGvwPwbX1Tb0gbTSPGBzShcaRjtwaHJcM+uRSe+t2HIe0kPi4+x8Oc6gNuT9NwChcRx3JBc9jT1WkT0zODKebmoyzIxWFn+Pch3Lamb8wZkWeb/+jgiSeoTCiE0Cq3mXXlHEgcck/CVIxEKLsDjK6vxHmm1cKtIuoCZVazTz23eQ9659jOOvwL5n01o65D5DleYSstfM2aIP6gT36RufEJ+ldFU3SfO5beVeJHLE3FFGNoVOx2DNaqu4tN3dRUmL7E7+mmAwLus6hUd5Fg7QLev5DBdN2Cytgk7RHt3chwGU/XmbSwynVER1+DC3BWilX1Xz8rgAFM/EYWM9hGxc2Tnm2+NBlgzAynakijzOYKP4o0vhI2tgnArFnBYiL2OsPgH8TMERFmwCCepBZVDWrK9MrvUiPkd0tAIG9CKLWhD7x9SuBtwy9dgKGduOVcY+y2Y2QmFreX/D9iu90/hKfgyE4WZH9CMWXLbLyGJHf41Bp/0JYK9DOGEJJyb9OeVJ6yqDXdJ2wjSgP2/fHPMDF1Zw7++SdJTfL2nmcZblOiKl9lIWKsBPdhTv5s2aVaOYyFc6fWvwpBViuw5F2raKHlFc+vuWAnp/ULAtksX6DPDcMLV7PWapacF84rMDTPt91TOTH2GEkZGd8cHQKMiUTZTQU7YFokQLuTUyw2Ez/rhej4Of1t37SY2O2nB7vCSOkEBkbd11YnXGCeiE/hmdoBhwpPYfEC8KsJdUxcexFtiF4W9Nrf4D2OAKVPmJ+au7R1MMA1duJQkGhMpzETBlNpFM+rqY22siwMoo13wZ9ayGNAjVBPvlLyScxo2QWjwoSmmTmcr5CAmH6wYXEttG+Zcv95RDzXK9ajQh36aJQGXtz5WmUHrpGz3LOdKKrjVu7DbolL5IOFEf+0GxFOfjacy810l8y1i6gBbYRYdA6XKg6M9oKic+wFaRy+ptxso/217m7kyYbayH5y9jJIJXAUiDhVX8BBE+krBSYeDGk0W144alD9C2LcasspHf8G8uTTIvtTah0sijgrYL7bV07i8mv2M9M7CfKYf881FK9ugBa9y+s/Yj6c8pftvur/PMp4XuInKRlg6eLy9yfa+lB1NmgawWZTdrixyPTbGRzX33CzZKcVYTNU7314jH+IgPezpHQH1r56xXpnEtMbdINYM85UwuHbZGQ59rsW6owLyd8h6i/H7aWzQ04LWjB8rhEI/znLwE/DzbVk6WbxYsZQH1d/arfiD0pg34ZBOuIjpJ6LEidgkGKLofsLjEk6h73e9g6foVxtdpp+jxOJlFksW+DdWyaK4FCLSaNmF51OuMWThKiD1dKQEJ/jrMAIwVZs3CEnzmy5AuKoDl1cBSzdjnfQzzq7JlbCa6oLwP11H/gYbudsclV2qqgwPRfwKcMpeg3LYPREK/v3JDtk4PGT+VkCVSK3lg= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8dd68dfc-19c3-4da4-d1b8-08dbdc023a36 X-MS-Exchange-CrossTenant-AuthSource: DM5PR0102MB3590.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2023 00:17:13.3763 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5cAlY/byVRFSVs6Pay3vWFR53uX7cXB20GjvS9r7w/q8Bp/mA897Cq5/9pshsi1gS14H9NoAt/K1qovniAQUj47yUGhaneiM81+IoSGe3qL18PkomIZfpR/gtV2zUEck X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR01MB6808 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231102_171727_856785_369101E2 X-CRM114-Status: GOOD ( 11.50 ) 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 Coresight PMU driver didn't reject events meant for other PMUs. This caused some of the Core PMU events disappearing from the output of "perf list". In addition, trying to run e.g. $ perf stat -e r2 sleep 1 made Coresight PMU driver to handle the event instead of letting Core PMU driver to deal with it. Cc: stable@vger.kernel.org Fixes: e37dfd65731d ("perf: arm_cspmu: Add support for ARM CoreSight PMU driver") Signed-off-by: Ilkka Koskinen Reviewed-by: Besar Wicaksono Reviewed-by: Anshuman Khandual Acked-by: Mark Rutland Acked-by: Will Deacon --- drivers/perf/arm_cspmu/arm_cspmu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c index 42b72042f6b3..2cc35dded007 100644 --- a/drivers/perf/arm_cspmu/arm_cspmu.c +++ b/drivers/perf/arm_cspmu/arm_cspmu.c @@ -676,6 +676,9 @@ static int arm_cspmu_event_init(struct perf_event *event) cspmu = to_arm_cspmu(event->pmu); + if (event->attr.type != event->pmu->type) + return -ENOENT; + /* * Following other "uncore" PMUs, we do not support sampling mode or * attach to a task (per-process mode).