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: 161144 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp722701vqu; Thu, 2 Nov 2023 17:17:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEfZPjEp4+nWasN9xp51LVQkTt5LdZna3AqS9xfQxgVI/ypiuhGymtYxprwuBcqr/4vKew2 X-Received: by 2002:a92:d706:0:b0:359:3fd2:1dda with SMTP id m6-20020a92d706000000b003593fd21ddamr7004977iln.0.1698970659904; Thu, 02 Nov 2023 17:17:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698970659; cv=pass; d=google.com; s=arc-20160816; b=tmAlG7siQHvE1zAiAuO6FLGv6QcDHLWbGTAGxtlapr0V2f9sNP+c4KorqsYUQ/eDOM q/1xs6vaNrjybDNbOjFgHUIiQfsl2AyXmYEeobYdDd0N+Gqv5UrzawSHpjmwrv7N/KKk QyOkEvFGYIPVrBOJ0uK7j3zewg9xI/JQX4iUfaQzLEsDwJQ4SJs5sfCLVB+4nEO6PZTD 1fw9CX1dQp4qt4iwaz3sqSc7IydWf60YlD9qren8zgqStH4bIanfoKWKtkSbWfzptMOO iSSYoFphghUJEsIXHhipR1e/BznxmYWySJ8ulszjlay9dHR+Tc5t8wJNSR0JSilTc38K evcw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=GGketpKI5rmxKh18ibSP1FRO9u2E+nT9JpG8FKhYiYM=; fh=arWQeR5RfbnWmJiENbxdlPrDM9tRS+UDLnlP62rJanE=; b=kwEOhqNECr57S0txsybw/arOwKkBSFqRfS/Yi8ZY8wekXFJQZ5paBR+Dj9kokiqa+X vSxQboL5gwhfRdwtSU3chOHW7kbS1O0ClidZTkpNNHMR/532JVIcNkMqtXX2YFAL3MjK ZQPKgOcC9CS5FCndqwVUs6jvGSVvQEqye3Ccm9rEzx7Zcg7tpqEP++Ad2eUliJrZB1KL OcRQWILjHXjW5McIZboLjVJP+ris4pbK3m1mKImFJ4BSQk1IfSqd7edR1ItfaUS+eo9l ZGfSgjsCgbI8Gux3sFu7upzplD3aIsJHS/eQOiBptsyN1yFiG/bnwg/6IZED/lePZWZr jmLA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=C053Ac7Z; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id fj16-20020a056a003a1000b006be1dd2313asi505961pfb.210.2023.11.02.17.17.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 17:17:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=C053Ac7Z; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 2D26282CC42D; Thu, 2 Nov 2023 17:17:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232056AbjKCAR0 (ORCPT + 37 others); Thu, 2 Nov 2023 20:17:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229597AbjKCARY (ORCPT ); Thu, 2 Nov 2023 20:17:24 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2119.outbound.protection.outlook.com [40.107.93.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D8A4136 for ; Thu, 2 Nov 2023 17:17:18 -0700 (PDT) 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+ldFU3SfO5beVeJHLE3FFG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KiD1dKQEJ/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-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 02 Nov 2023 17:17:39 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781499858805226515 X-GMAIL-MSGID: 1781499858805226515 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).