From patchwork Thu Mar 7 09:57:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 13585321 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2074.outbound.protection.outlook.com [40.107.104.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5068712AAE9 for ; Thu, 7 Mar 2024 09:57:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709805477; cv=fail; b=POwkRY1cPsAv1DOMsJ3DRSGIP+j2BmuJxFw8LJnMAoFULOwV2csMRfi2/Vvf4zqeg5rtQvZpf+N3bIx4fA9E+0xfc6Y+SOlIGKsRwXwOYLAr7WLWYu7HDvZt+dTTXuS8iyXJnyicYazZWPbIOSgjWZECycBXNyY+LhkAIsnrrBQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709805477; c=relaxed/simple; bh=rAIg/z5WFPmD9rJiqtZzUclV2yUnrpvZ+yUSZtT3/Ic=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=sZV6E0O+Jdn4DzbT8pLvO9Wqvw4i7u1R0dDaO3jmb5jkcinjrFVrOpqGGgyRgxSeVGK8ZxAZpxS7Hfr0R3yP0EWuZVPSH8bRruDFezQhujEJW2eEtVr6W8phi5qa4CQNL+8+SF3ixZR+yZ7R9dETFKSy7DIyt/PVkFYxTh7HOcs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=T71owC2d; arc=fail smtp.client-ip=40.107.104.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="T71owC2d" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ty/YywlsSV8WUYjVPQDO4DdEeestbsoXcsClpExgdAu54oUeBpLRc4KduhOcQEfFDzy3pa1EuHX4NG185+r1xV6C0OZ8uU6tWKrGGNIO/KB/csJgQfvJTyiifEe1lVMj9K87ZUoQwv7Lv8IpO6xwKdLdcgcSjE+1sn6jTu8wIIK/lMHzXwDqm0pJVa6DnA92MD8ol+q0aWP9Tptg26JKDLXCfUg/fI9oQ+xN0HlZNjLKctrIJbnFKxOpD2Yh+QFouYDn4BwRVW2Ec2XWRFpLO5ZvxNEewum/CXviH2mUeBBN4JAcGSTuWx+kpLwgBgoIhb7rT6riALq5OY+R/3Njeg== 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=TCpzQMQMQqszgg3W6CM2LVpPEFvKH19j+v/4y3aPj7k=; b=jbR6Ut8OxsudMyLvq5pBeJ7lkjeBOPYb96HrSXHtPc6ucNwGbaAZ64F07v+BhloOesWQcPs99Zt2IKidUI9+XyDAHcASnKeDxWVb6FN4ru7aP/nIEtR+bXPQdxQOtZF9/j3Bxzj7ycp3f+P/LJ/H1YVVPchcPUI3tNnX1iHi0fycU1WE3dkoWJeN4vf6m8vBJq4/G9CYFyOA0aV4E+duAeF0JkG1UpjNYIfzY6xqhYVNTnOX0WU0LXAa9WopggiSNpJRuR3gLAWpbP2sTw/q1wHm9thalkDdFfGAMmYM56etd1FztJWNqNvsOuwAg7xSEG/+mZXn7+JJDOfAyQYgNg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TCpzQMQMQqszgg3W6CM2LVpPEFvKH19j+v/4y3aPj7k=; b=T71owC2dInp/TXLcAWWsF4oPQgpr1/HRUBkKS/JVW4RasSQ/m8/KVLjMlNi3V7+yRW27AbP7W5rBGfzSjM21O2cB8to70gXMBDZ+ewtOCbD3bCjdySt5gdRRZXfz2xbWdQwtztv7fMLy5iT6wLKTeRV/bnVjBsLK4kqFRoU8Hc8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) by DU2PR04MB8504.eurprd04.prod.outlook.com (2603:10a6:10:2d3::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.38; Thu, 7 Mar 2024 09:57:52 +0000 Received: from DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::d45f:4483:c11:68b0]) by DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::d45f:4483:c11:68b0%7]) with mapi id 15.20.7339.035; Thu, 7 Mar 2024 09:57:52 +0000 From: Xu Yang To: Frank.li@nxp.com, will@kernel.org, mark.rutland@arm.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, john.g.garry@oracle.com, jolsa@kernel.org, namhyung@kernel.org, irogers@google.com Cc: mike.leach@linaro.org, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, adrian.hunter@intel.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, imx@lists.linux.dev Subject: [PATCH v6 5/7] perf: imx_perf: fix counter start and config sequence Date: Thu, 7 Mar 2024 17:57:28 +0800 Message-Id: <20240307095730.3792680-5-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240307095730.3792680-1-xu.yang_2@nxp.com> References: <20240307095730.3792680-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SG2PR06CA0212.apcprd06.prod.outlook.com (2603:1096:4:68::20) To DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8822:EE_|DU2PR04MB8504:EE_ X-MS-Office365-Filtering-Correlation-Id: 3ccc7ae2-1a1d-4539-821e-08dc3e8d0df4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2sfUP6yR4HYSabKxsJxef2rfq+d1mf0KVc854bunyp/DovfNErYZR88z2Yly6XzKOfLbxOkj+gUIFVFAY8FoCZ+jm/7po1lMan96tTbCCCnOKAQ9d0LY7NxA+VSGjgSC3eTSeWQ1FnOitmuan/GqYlTJQXJBsCwmKgvBxuXw0hkogF5dkLE63NSO77cqYfFTHgcw8mCkEcb4Tnz6CHrM3EPViAXhvI5atFC8eOeQ10c/KZHMHWeBeoRB5jNXU1aPI/RicHUIc0hiLrfkaQq6Da4U5qWd8ZOuvsFQIuxcSCEfEnXwIQiMsPqXfghJ0GAkvCNB2C6O5Ls2chRj+5Nu3ZJHLqFz0tfZMRF012DrrjL4Y9Dvz8lTQHdiPp+XGa0rreu4BqvCSgPfATq4XcNMtLhh3z5CV0JE9yS4xCLNZQ4Sa3szcmVMmcvzZuwSkNCpQkMBIsx3NnG3h/BmXXUTchLnQ0TBBrRKb3MI1MD18HP0lirfpFUXBMTAEocYnlEkOzT6kpp8b3pp8uT4N4+pEXZOKI1+PHCJHLLaiZhWN2a8LAm3fgLgD8j5pJB3+C5pYEpxub5zlTWkbJaELpTnei281CwCovoELjR3RLgk0vIU8kX7JIGYX3h3iD1LMliWPxPaK/0s1N7uJ84Nnz+3MPm/m/AcN69D43XUtesqEhyigyFPGcqVekpLO/CzIMjBLo3LqMneziw8vnz6XTfWHK/P83X7cRZx0waNGF0Rygw= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8822.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(38350700005)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PKWnbxceFK5pYxCzHLtLh8Hzc9uivulkr4HC9rahLyBj4cy+Bl36JvrmyhfgA5OwwbYgxfq1wRuMDCO1vtn3tuSfK1KgJO+BonwwnMzC5q0/NQMagLGAhZ2D1yOtGYKb5gO53fw8+JKf0IYIdiFxcKMmDru/9nZVkPVBZhF5HORgBbycb9fUB0xMS+kRmmqgkp2xDmEqHl67uezWQSp4kNha8mUUo/Wh+PAKi0jDeuTIWEofOgySnIfS6H5kh38O1p5X4uw/3Pq4ssTpFgmtcULXmY5GgfoXk2IaqTssB+UqnEio2q00AELGEE5Eaz0KFWYwxEVQYvaSrmR6LGpkou4dPhxr4tAr7NP3TzVv17UDHufOnGaplDdHG/Qe0SIB/1u9yRKgEo94nzgWZc8fSYPRDh6dh7OgnbhAu41QUp19i0rvbh6pkO9AhgCpSRW1RgkWsX3x9iira1OlF6hc9KSuFvyPpMnM4hHrwbkxK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PSKDF/z5MmgYbb64vZ9TL9b9MxFmc14ZbBEYrZ8OD X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ccc7ae2-1a1d-4539-821e-08dc3e8d0df4 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8822.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2024 09:57:52.8485 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XDQF9X5CZXcG6o0nkGdCvFRk7V1QnlsA27Nd4aKT00xl1KvJiAFcejQk+pjAxp2eGhkvhLmZUuzUfU8UIhX6xw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8504 In current driver, the counter will start firstly and then be configured. This sequence is not correct for AXI filter events since the correct AXI_MASK and AXI_ID are not set yet. Then the results may be inaccurate. Signed-off-by: Xu Yang --- Changes in v5: - new patch Changes in v6: - no changes --- drivers/perf/fsl_imx9_ddr_perf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/perf/fsl_imx9_ddr_perf.c b/drivers/perf/fsl_imx9_ddr_perf.c index 4e8a3a4349c5..52234b97d0cb 100644 --- a/drivers/perf/fsl_imx9_ddr_perf.c +++ b/drivers/perf/fsl_imx9_ddr_perf.c @@ -543,12 +543,12 @@ static int ddr_perf_event_add(struct perf_event *event, int flags) hwc->idx = counter; hwc->state |= PERF_HES_STOPPED; - if (flags & PERF_EF_START) - ddr_perf_event_start(event, flags); - /* read trans, write trans, read beat */ imx93_ddr_perf_monitor_config(pmu, event_id, counter, cfg1, cfg2); + if (flags & PERF_EF_START) + ddr_perf_event_start(event, flags); + return 0; }