From patchwork Fri Mar 22 06:39:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 13599660 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2083.outbound.protection.outlook.com [40.107.13.83]) (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 17A821642C for ; Fri, 22 Mar 2024 06:39:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.13.83 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711089585; cv=fail; b=pjwr0JnW+rcCe/CC0FCJtsmEOLyH8fHmFNTn/NYP9bA3j7IaAQTXy0kIPCBuYlqUVWo9uExAyKoQeaNhXx6XZzoHMqW9hQGdAiVKLshoDtVQ3hsdQyNFVCMA5khNEyTMIkRgWIOszHKkiEJ3KO3btzPJ4vYrCLXRMjFLxKghirs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711089585; c=relaxed/simple; bh=r47Euoa2ii1USCQHfIC9SqFrj0X/J4wYJD4e7NGvd9Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=DAzhbBQYYKZBtp3Z0VCVhfCKFXB/WX9xlJDFETffafq9+l1V/Fmg9VJxYau7ghq3LLCaI0/tV12oZk+QP3ZmOIOdpN4PXjSQ5V8Ve2EozdbAIPn7FVI5aF9i/tyv5N8wnwwFToR77ncMp8VCYbJjxPd1xXkZGkkaRB1zFG5mS/0= 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=DYAx4f1o; arc=fail smtp.client-ip=40.107.13.83 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="DYAx4f1o" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z98F9MCZkabYB2upJwgOMDakqOxV7MyrLDBxKSmN+uxr1l3RN1xpQA9wqP+McIQxOsJcMhsNfKqBcHO6DTBxd9ApPe/ZDzdCXc3vhJLubue5saURNpGFp+O1m8q3fmN1y9LgiRYbBLVZjna3EG7M+VdXiFVpGZxMoOWzbFfbAJECsYceTen2RbWaIA0zDYBwyvgSeuK8XaHZ21z8ciDcNHdVOh/qATfa+5qi0b2FZOJWfwH5s8jrbcdK6/17JQIthDdRPJeq4RDWsl3BGS4fHl2fl96Lsm87lQxMjv8lCJpO/9i105WLZuAqD8gsbV5thIS/jG2km6vLcG4yMFVPzA== 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=H+CMt+Rcp1Y8LexpV0MGSjuehDYnZVCAQLAdLLv3SxI=; b=G6tj8HEeBiv1LN1OOcZRHhGFHII4GhIThHdtvKxPI4WRzyrZX7wliz/J5wZjjRn8KfoZ1UtJIzLeGDcLXp5TTiDeERKWzd7FLPD9LzgP8jF3JUt3D7IwdcSwYrAscMZUgF2rUFel3zmJnQkoy9h/zNfpy5yZKK1ENt/TxVU47GVDXinrLs+7Q/clKDAKdrBhZhfkPsh+spM27eTogR864oclj1VZsIRIL9KvMcy8vn7fEcCp2SsIqa3ygqRuyjvYkZmucL7huouxbVTv7HglU2fu8RMNVDMGITyXH2huPg4lzx2UE0Nians8MbfDz6DP0h3JPdFV3r+YD75f74k6Dg== 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=H+CMt+Rcp1Y8LexpV0MGSjuehDYnZVCAQLAdLLv3SxI=; b=DYAx4f1oYHSVJWZyDdMiZRPUS5MR6Ny1EoyGVvbY/yq/RU1phKK2kx0cghXT9IqCY4H1cxgkxWd7oDMmGMcs+La0EeCuWxJS46DysPRLUUJKGzzJCNFZdink33fY3Qir0pY5rkv6Tq/CWgAjW1aXhe0l2h7gvDnDNWlK7L6HHwI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8829.eurprd04.prod.outlook.com (2603:10a6:102:20c::17) by PAXPR04MB8928.eurprd04.prod.outlook.com (2603:10a6:102:20f::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.24; Fri, 22 Mar 2024 06:39:40 +0000 Received: from PAXPR04MB8829.eurprd04.prod.outlook.com ([fe80::1b13:505:8d50:f4e3]) by PAXPR04MB8829.eurprd04.prod.outlook.com ([fe80::1b13:505:8d50:f4e3%4]) with mapi id 15.20.7386.023; Fri, 22 Mar 2024 06:39:40 +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 v8 5/8] perf: imx_perf: fix counter start and config sequence Date: Fri, 22 Mar 2024 14:39:27 +0800 Message-Id: <20240322063930.749126-5-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240322063930.749126-1-xu.yang_2@nxp.com> References: <20240322063930.749126-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SG2PR02CA0121.apcprd02.prod.outlook.com (2603:1096:4:188::21) To PAXPR04MB8829.eurprd04.prod.outlook.com (2603:10a6:102:20c::17) 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: PAXPR04MB8829:EE_|PAXPR04MB8928:EE_ X-MS-Office365-Filtering-Correlation-Id: 995ba2e7-54f1-4c06-e484-08dc4a3ad99f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UUgkgyYKq+fGCEjfd4nw3WC12bsnfIQQYdr7w2pH+L0N9Ts/d0rrn5hW76PJUlaDlw90EsjkmQPnhF5tHUSwIW/kJbYIieAxzrZOFIyrLU4veotaeeMp6fsG52AGhFZ/Yt3CN6f6Zf/5EJDm/Pw8HLiM2AUzonU0YxeQC9qR6WtFecAGDAyVNtIgh6Ou18jDGmD80vnSGsBR57tqXtipFh5RIEVh3LFKgAi4O4ihogWnwp6V0NW8djN7XX/n7JPKiJ0J0sO7sEAJK0fIVudO3RcCJjjayN+1H6/66d9n53WE1NAHIBJQ51rtPFhph3Ki5b7CP0vnZtVffBDyoh4ftXQv3vLXkA34aQ9EdPMsI3aaNfWD86bkaourX0ju8vaxNSF1SfRK8FyTS/kJeLIcgSIbR0FYDcUXoXRPBe3Zh0SEVHTDdteWBF8pDsSN1jVH/6XYrStCSbCGLf36HA98E19yYIkxdo3GEV0yR9si2v/z+LIt6a7zVPhihopwnM0GcIpL+ShzATJKx0z1bj2Fg2ARyt35dI5LHL2ZRihVFegcLFGoIf+geWRT08foxlYS471uDgnVmJtgHh760E3DYdTGBsJgM0gjxEq3DhHYUMUiO7PFuo343GaqEYLy4r5vGsZXWkBA197eH5C/nY+W/1/Ew2rm6ZxgS/GunrvidVf38IcKbQioZNEisIo/8MpT9nL3oFw71KSN/TFnNGuwmO4kriCgZtfCpxgtRr/NC6U= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8829.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(7416005)(52116005)(1800799015)(366007)(376005)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uj8duaSwgp0yqbdiorrpiXaBQRzShGho9/AKwEcNcIAy7fEsuJRDJOA3OlkVRcO0Q94nUHUn1TNIH92Oa8MuTeeijebWSxv3J7a/QEzra2TKfTah12aB/0mx8Qdcxa0LlvWDfTMm2sqL5oW/wpGIApB+zB0KWr3PgwEDmActHyFzDGz3GDQtxRKHZPgHndharlfX6oXxn6NnQpXAoWHxNNURRwbibFZuvSCvI8FXJcaaut8AWxascSyidtqSux8JLPUgVGZgbXp6DNe4khThsv5PlLvlJl4v9WGC9hb1SUO3gyh1s8bDdNKpL8C2LQbJspxFGWHnJtJE2XrrB+aKEONkBRiGLPPRdr7r2sze8NK7A361gwHAw2xrtsCST3D7Hvni1UFxAuiQb9f4H+dn69ASf7eYdhNPCU/Ui0uu9K+U5PQKTw2KerbDt0BUyip0WlzQDo6W9a+Hy7/xhVm8j42y8Wm+DPrLMAu+4KJen1FoCNyBZHD83QWFdTdHD+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vZYvWix77gSwl5fQl X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 995ba2e7-54f1-4c06-e484-08dc4a3ad99f X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8829.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2024 06:39:40.6237 (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: nuBRZcJFOpnaIIBFiSfU5+lyKXEyR1ZiZilN24l/cpl5HtexZax9wpTnolJB42QcGHIcWzzMiTIfQMgXFA4QqQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8928 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. Fixes: 55691f99d417 ("drivers/perf: imx_ddr: Add support for NXP i.MX9 SoC DDRC PMU driver") cc: Signed-off-by: Xu Yang Reviewed-by: Frank Li --- Changes in v5: - new patch Changes in v6: - no changes Changes in v7: - no changes Changes in v8: - add fix tag --- 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 011377c01dea..fab6596d3e28 100644 --- a/drivers/perf/fsl_imx9_ddr_perf.c +++ b/drivers/perf/fsl_imx9_ddr_perf.c @@ -539,12 +539,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; }