From nobody Sat Feb 7 17:55:21 2026 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2079.outbound.protection.outlook.com [40.107.102.79]) (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 7713B25A35B; Wed, 9 Apr 2025 07:57:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744185470; cv=fail; b=SXciG09svhMgUSU6muCdEONBjhIg3XXQtKgQj8pZa8VMK/5anE2kjZ56sp9xrdf6amPFNJkT2SDKpOYl39xZC5KrOOOt2VLGe+fYLzSJvPk2UQgRF5FcAaG/pKWEtN/urynI8qMy0I6WvNi6gNH9yyEs5E6Obt+UqEtKHBAd3UM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744185470; c=relaxed/simple; bh=lX42mYwSzIgmhuvi0CTTnxE9rjt7fDv4CUZP0eghrqY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=b84pPUdKbS7l1eK4R44Wp2fQBX1cHhcW+4RZLN/AwzyyFgQ63rawy83qkMquZf8V0yv5aEk8yS0l51L3Ss4AHfKb33K5EUzx06NwXyYuTNb7yuQ5i2qW9qVgFGDWshTsNPTSbLfv7WAnJtoXq6aqRxZh1PQAargGm7THVQFZhkY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=CQPdufbx; arc=fail smtp.client-ip=40.107.102.79 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="CQPdufbx" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DMs+jSA0m4KJ+SsTfnM/FVp0gJjSliCdrfQ00oPVBpzHkljIfA47PEwmBYjiW7RDQ1qc5uQGGhOVP6dDGMOuQIbx1teJ65XnHy/bn5RL6MnRhNXBKmDxGtun6HS/kRBt59opsmYLJ85C+onqGDGbAcTtW8rGOk1ejvtrL0KYam3ocVxao0rLqF+0R0XW0xJ5/sx1AR4RCPeETJ0xjSxuUR5aICgKkqNSIJI1fFYeG0EQrU1GKItasHjmcAUxKu8dn1raHGYO7MLbFUpD0Yvdsm2fq+vgf5zPBiV+J5qrbSIh3Tjym8BSrBkaaA+ntfphPyN1JdWTAf5yE/Nu33L01w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Drr00yrM7KFJK28I3xFwU4757HqNUeqx4S3tEcYLPk4=; b=wWKbi/5XHwrBc6REN4HYJ+kvnYVmgzOe7LiQ2IlCsJ8U+WkM5efwjebwxfWJzsVbiA4elRhFABCeHFclqhxLcubR9QD4TjwfUFXgQrMsLVSafcZKomsc3vCvJYPo0P17oBUzyQbmYDUGN29Db7e2g+7bIbjDWsEy/ZiH2PKCc4hJ88ZoiYFJsUjWQLXMZjTBV3f/u2fLlXeMCHhj0T9uPk/Y/Ls0P8FsczkTJXHHaBLq2eCVG4/RRP6kmN37n8+BQQbLMslLX9sCgRLIRPH7QexWkzPD3Z96mdM8SZHSqdx628AskHit3gC8u0SnEac4wyrdq2IfjP7VlV0zsD7L6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Drr00yrM7KFJK28I3xFwU4757HqNUeqx4S3tEcYLPk4=; b=CQPdufbxnNLXB1mnJ/uKDNHEnILCAhXtN3AtamqQ9slf0tOZv4QzZVkdTZz74EUuZfo09+EWrJrLIRmvDCFy+o60lzNXoPK/A5SsXjUCDRrga/2i9zt92miZKsIKLazlFhAgg0q8M5mU3nPdShKzUHlHmyOVRAX7dp4+W0by/cU= Received: from MW4PR03CA0188.namprd03.prod.outlook.com (2603:10b6:303:b8::13) by IA1PR12MB9061.namprd12.prod.outlook.com (2603:10b6:208:3ab::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8606.29; Wed, 9 Apr 2025 07:57:43 +0000 Received: from SJ5PEPF000001D5.namprd05.prod.outlook.com (2603:10b6:303:b8:cafe::41) by MW4PR03CA0188.outlook.office365.com (2603:10b6:303:b8::13) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8606.35 via Frontend Transport; Wed, 9 Apr 2025 07:57:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ5PEPF000001D5.mail.protection.outlook.com (10.167.242.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8632.13 via Frontend Transport; Wed, 9 Apr 2025 07:57:42 +0000 Received: from sindhu.amdval.net (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 9 Apr 2025 02:57:36 -0500 From: Sandipan Das To: , CC: , , , , , , , , , , , , , , , , , , , Subject: [PATCH 1/4] perf/x86/amd/uncore: Remove unused member from amd_uncore_ctx Date: Wed, 9 Apr 2025 13:27:06 +0530 Message-ID: <7be0fe62aa7e7819659c7a22e165215cf6284076.1744184837.git.sandipan.das@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D5:EE_|IA1PR12MB9061:EE_ X-MS-Office365-Filtering-Correlation-Id: 60c0e263-2643-4611-56e2-08dd773c3526 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|1800799024|7416014|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?L+7ylpul+4hV43mSfG0Q3O6G6pYrgAXJ5jlU0kG5RLPbxk3LdEiUZWBZc1wF?= =?us-ascii?Q?XXOg+YCXgdHeVKjG0lOmQAJ98hwRH0XGDXA+fvUZQ49Qqd7Xb6MhCHfAwpzM?= =?us-ascii?Q?KPqW2SU554FQ3SkPP9vrjSrXTfOLaGMjZR0ynpshJBCoZFlGHqGZwt6RWI0e?= =?us-ascii?Q?mkGkXxEAN8axNJjGJ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7SMuR?= =?us-ascii?Q?MIF2Qneqwi8O8QvBvqaVG3XihbIkmxOLjIswxh8AbXjNzb3VW/C6/O9yOhqr?= =?us-ascii?Q?ncwXMGNgiwXBEASJgvin1JcVzn2wXytRQjwQ9S4575E38HS8dknXO6SHUg3v?= =?us-ascii?Q?d5xtcdz/dHyNy3uaUVwzF7Gf6dQR51uy/MUEgayGEGXXiXoNkhB+19xnKVK0?= =?us-ascii?Q?HkX3IMMlxn0SoTh/gPmoibboN5xn9AKMEbFlMgrGUhWDZQsz0Ng5PRZyE+aI?= =?us-ascii?Q?hsDKBTtDMOzLkBDfvOreVggaQRUUtLPyEkpWjf0y3zUyMOVonEW8IrK2nmxM?= =?us-ascii?Q?N+6eoAstEIL7PdAXLxYdsBVdyVWbZq9ueKD1fVqjL+ADdMDwqDeI3Pm7c8Dm?= =?us-ascii?Q?gyJTuoQi7miB/BzwKpYbYkglTMSiSkdfsTOE5mEW4ruXevgUb5tH5g=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(1800799024)(7416014)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2025 07:57:42.8520 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 60c0e263-2643-4611-56e2-08dd773c3526 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001D5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB9061 Content-Type: text/plain; charset="utf-8" Remove unused member "node" from struct amd_uncore_ctx. Signed-off-by: Sandipan Das --- arch/x86/events/amd/uncore.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c index 49c26ce2b115..010024f09f2c 100644 --- a/arch/x86/events/amd/uncore.c +++ b/arch/x86/events/amd/uncore.c @@ -38,7 +38,6 @@ struct amd_uncore_ctx { int refcnt; int cpu; struct perf_event **events; - struct hlist_node node; }; =20 struct amd_uncore_pmu { --=20 2.43.0 From nobody Sat Feb 7 17:55:21 2026 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2043.outbound.protection.outlook.com [40.107.92.43]) (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 E4E2325A34D; Wed, 9 Apr 2025 07:58:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744185489; cv=fail; b=R4jNWROAMZnnDseC5ZCp2JmDD25o3Jv48iCggju8L+70KzneYR+7rGbtIE6Whd+kTs1Bhg4pMzJvqSLzNCB6nm/sDpBtap7JV6tnkFBmBPIOIg30MlL4vV61HGmSJJIdGkVBzLIBuCxq4VnXWl8XSuXLejNx22kO9UHcQAig/xU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744185489; c=relaxed/simple; bh=fx60cR793brpc8ZHZrpbwG9qAMSb9AvodTSU8vNgROk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IKg11P1zteqtTTWOK1tnmsGEX1k/b26tNZFaM7guu2YAE68OCXaL5DqO7DOys/68a8Vlwc7czAHo3pTsA2NMClK+vtQ8VjG5YzAk93o7kAhlvzBt8rxulIxiN8WvBnIol/aE8Rf325BeNePDN/7p+NdXiEE7R85SZuYgTN97AxY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=VSN9Fhjy; arc=fail smtp.client-ip=40.107.92.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="VSN9Fhjy" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RbCxrdrZoCan9LNifiSZvErseoDObpKdzqElMjHehv4IZqPc5sg0XCSJAyk2DvcLymp3O86+NOTHS8Wf9fdT/VDQuClUiOapWrX+DIlzRc5wZon4cwYPAySlQ01Ze46jb+BGcxOTiIMo4p5kEI+NOuV+kbC7NDhvVmwPabktw/0f/uVdBPozXZvPdfuGWz7yyt1o65I6c3UCpCQIqvazBIq+UeAOqVVFJTE0zz4O4ZhGbUFBJMYbGhN/G/yKNdF791sMsNKv4572dgXNFnMiIyXwOXJfhuTZa4PFcF5pJQwolSLeptcZ+gy4AgnmqRn8wNkYOWbJnFqnxOEK6BGhmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=gbAbUOKJHKW5feB1DbNVW5QP5r24hXZNDI4IkxP7/JU=; b=au5OnSTY+6biXL8hv6Kvfij0KulhWEh3ofMO9s+fu41YqsyzbcxhmXu4MTOjV3a4DTZFC6pHA247/ph7KeSbbyTkC/Wj4cNq7XljVL5/lNGeXODo82uYDNYpoES3Ss0VENV4MuCDeFbfsqUunhNNkIqj6Gg4SDdhCsQIjhKsXRtYHAickNoQUzgtev1vuXPlIuQKd/8ko9h58yVPBO3Nd8rU7wnfqoomdMLVaIpLZi2gUPmqneJyU6QQEAMRc26z2bYRGnLJhnCU4e8VBhWqPOmX4CbKQxcTd3q+m/MzKPuzj5TcjIGolgJG2hJrWkWmJ8eHarhZElMKhclKQhU+WA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gbAbUOKJHKW5feB1DbNVW5QP5r24hXZNDI4IkxP7/JU=; b=VSN9FhjyceR44D9BTSrvL4mz3JPr+SvTcw8NQcy8rjLW6O8K7gsbHLMwufZp8DlDD55Lla6jcBmAiXdVGAtgk2gXGR54RH23Mi7idwROd2/v/vpFsQq2DJWRDgFsU4IcTBntaAhpZodLvO5bWnBBuAh4+DYSDtGalI2ghhVgvwY= Received: from SJ0PR05CA0032.namprd05.prod.outlook.com (2603:10b6:a03:33f::7) by LV2PR12MB5751.namprd12.prod.outlook.com (2603:10b6:408:17d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8606.32; Wed, 9 Apr 2025 07:58:02 +0000 Received: from SJ5PEPF000001D7.namprd05.prod.outlook.com (2603:10b6:a03:33f:cafe::34) by SJ0PR05CA0032.outlook.office365.com (2603:10b6:a03:33f::7) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8632.10 via Frontend Transport; Wed, 9 Apr 2025 07:58:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ5PEPF000001D7.mail.protection.outlook.com (10.167.242.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8632.13 via Frontend Transport; Wed, 9 Apr 2025 07:58:02 +0000 Received: from sindhu.amdval.net (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 9 Apr 2025 02:57:54 -0500 From: Sandipan Das To: , CC: , , , , , , , , , , , , , , , , , , , Subject: [PATCH 2/4] perf/x86/amd/uncore: Use hrtimer for handling overflows Date: Wed, 9 Apr 2025 13:27:07 +0530 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D7:EE_|LV2PR12MB5751:EE_ X-MS-Office365-Filtering-Correlation-Id: 5e728bb1-fa0c-441f-0bf0-08dd773c40dd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|36860700013|7416014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ialmGmwwKOMsc1UHc8NhBzslETIjPvv4Skva7PPhK+x82L9pNfUpwWeMXhJL?= =?us-ascii?Q?mm4DyLHrtn1kqIMQLmjWkdJiski8TwcMAg4pYWpYbihyhST56SSO5Xc+qG5S?= =?us-ascii?Q?H5qTqQoNtjM5ohneSZ185g7rFww7BR9vIwKWZEadQffu7n7aHDRgxvVamaxD?= =?us-ascii?Q?IQ1rtET9ePe24yzetybpB8+PhTUHqM1oKtrXnBiSvsGOeaDFUcuYevdap96/?= =?us-ascii?Q?gMg6mEyvHR5EEqn6+hTqEcsmVG2qq9wzvlWv8fopTTM8ruf5yEJXGpNPY/t/?= =?us-ascii?Q?8EGDsPAY3fB08o6QWIS60xX3uJf8nywTnHvPVtwokpeN8AdUqlh7YpBV6scf?= =?us-ascii?Q?gLE+MiZtAtLEcGA+c2F57zWCk7Lmv8O9F+bXVSYvuPb5OSiwODQAsUvQKiWk?= =?us-ascii?Q?EX/yQKE6ep8+99p+4ygJEgXHRuk74X3YROhQSQZQNYR2O2TuA0zaaVesz7MM?= =?us-ascii?Q?uzWErAsGSYufF3cpyjHLAL2QzqfbhELiH4kaxurZmhsZHKvhwgt32MUwQ9UE?= =?us-ascii?Q?xHcAvLkoccdLZqXL0wj8Oac97sHWZLRkru0CbWD7fNZODjcd1Nv9lvgipln/?= =?us-ascii?Q?PXpZ61tF/VpuSNqDGuAYiewP4Yrw72gQ5K9DX/+vSPu27OftljQEggT8x8cA?= =?us-ascii?Q?3R7Ep8HDZJPDELZ5RImGlHpydDX+aq64Rz4xZWdMb72X23gxUkwl4gH/n8vs?= =?us-ascii?Q?8owJKl3sgai75hR7UtjMz3qx3fvd/7YcPs/sFWRUwSHsXQn6pNJlDMkkNT6y?= =?us-ascii?Q?9bXnS+kveigSu/QNxVh6iVhhMmEGw+yf0zsyknIjNQTCycGmMYs+qPqZLk28?= =?us-ascii?Q?tcSF9fQr0Y3/AmES7/sRSuxtPnz7zSlKxdpptaDK3b4Ge767w1iC8T0hRqFY?= =?us-ascii?Q?WEDjHrpgbMVEdmJqVVpH6Ul3Q7T4FoV6gb2ZbPPxjoyWq3+6fCNEJO4xmjw2?= =?us-ascii?Q?PpiZgBe/SmXJvEQdy6vqkqHcaTLfTisHYl0Yg53PwpwAMudpgxTr+9zm5N1n?= =?us-ascii?Q?n7KbUF68rJ+6/TwG9q66+NFXRD/ijy8hVD5lPGzlkxoGhObrCJTsm5hyByVc?= =?us-ascii?Q?Oqs2o5/U1F8Ya7VwITNmI7f1mt1ssQZwQte9+3cyUDhasDkaysoleQrLUu+X?= =?us-ascii?Q?VMcUeRTNSA6RaNK5buWOr2C++TwynwnvwlyhWbyVwFeYBqPR7FV7QXeS1UQD?= =?us-ascii?Q?w8CuFUgARR7VJooT10/bkCXKHWmnWWJt4G065JxOMBJlMrsBR8dm6IQdCY9L?= =?us-ascii?Q?xBfnkB06A/m2mXk3MI3ZR1lYrVTSLFp01oL9+TsBGCzcfrrvWkKQaxUyBVVV?= =?us-ascii?Q?5rBRDOe48xHKeLHzqgdjiCpxiG1Cj7Vi/2pu/sZay6GgkDqH/AZRXlcq1Udi?= =?us-ascii?Q?UtvS+ni7BHT4GGbGJUn1K5e0mEyptI8F5PWpq8J5VTRcACWI8LWJTYUEkKq2?= =?us-ascii?Q?f6LTmyO9n+Cv5Si36CC+o0pUS12W8aol6DnhJIFkdsZofMR/4BNe1DL/g1WF?= =?us-ascii?Q?A8VYDHw8r7kKy3U=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(36860700013)(7416014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2025 07:58:02.5043 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5e728bb1-fa0c-441f-0bf0-08dd773c40dd X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001D7.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5751 Content-Type: text/plain; charset="utf-8" Uncore counters do not provide mechanisms like interrupts to report overflows and the accumulated user-visible count is incorrect if there is more than one overflow between two successive read requests for the same event because the value of prev_count goes out-of-date for calculating the correct delta. To avoid this, start a hrtimer to periodically initiate a pmu->read() of the active counters for keeping prev_count up-to-date. It should be noted that the hrtimer duration should be lesser than the shortest time it takes for a counter to overflow for this approach to be effective. Signed-off-by: Sandipan Das --- arch/x86/events/amd/uncore.c | 72 ++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c index 010024f09f2c..ee6528f2189f 100644 --- a/arch/x86/events/amd/uncore.c +++ b/arch/x86/events/amd/uncore.c @@ -21,6 +21,7 @@ #define NUM_COUNTERS_NB 4 #define NUM_COUNTERS_L2 4 #define NUM_COUNTERS_L3 6 +#define NUM_COUNTERS_MAX 64 =20 #define RDPMC_BASE_NB 6 #define RDPMC_BASE_LLC 10 @@ -38,6 +39,10 @@ struct amd_uncore_ctx { int refcnt; int cpu; struct perf_event **events; + unsigned long active_mask[BITS_TO_LONGS(NUM_COUNTERS_MAX)]; + int nr_active; + struct hrtimer hrtimer; + u64 hrtimer_duration; }; =20 struct amd_uncore_pmu { @@ -87,6 +92,51 @@ static struct amd_uncore_pmu *event_to_amd_uncore_pmu(st= ruct perf_event *event) return container_of(event->pmu, struct amd_uncore_pmu, pmu); } =20 +static enum hrtimer_restart amd_uncore_hrtimer(struct hrtimer *hrtimer) +{ + struct amd_uncore_ctx *ctx; + struct perf_event *event; + unsigned long flags; + int bit; + + ctx =3D container_of(hrtimer, struct amd_uncore_ctx, hrtimer); + + if (!ctx->nr_active || ctx->cpu !=3D smp_processor_id()) + return HRTIMER_NORESTART; + + /* + * Disable local interrupts to prevent pmu->start() or pmu->stop() + * from interrupting the update process + */ + local_irq_save(flags); + + for_each_set_bit(bit, ctx->active_mask, NUM_COUNTERS_MAX) { + event =3D ctx->events[bit]; + event->pmu->read(event); + } + + local_irq_restore(flags); + + hrtimer_forward_now(hrtimer, ns_to_ktime(ctx->hrtimer_duration)); + return HRTIMER_RESTART; +} + +static void amd_uncore_start_hrtimer(struct amd_uncore_ctx *ctx) +{ + hrtimer_start(&ctx->hrtimer, ns_to_ktime(ctx->hrtimer_duration), + HRTIMER_MODE_REL_PINNED); +} + +static void amd_uncore_cancel_hrtimer(struct amd_uncore_ctx *ctx) +{ + hrtimer_cancel(&ctx->hrtimer); +} + +static void amd_uncore_init_hrtimer(struct amd_uncore_ctx *ctx) +{ + hrtimer_setup(&ctx->hrtimer, amd_uncore_hrtimer, CLOCK_MONOTONIC, HRTIMER= _MODE_REL); +} + static void amd_uncore_read(struct perf_event *event) { struct hw_perf_event *hwc =3D &event->hw; @@ -117,18 +167,26 @@ static void amd_uncore_read(struct perf_event *event) =20 static void amd_uncore_start(struct perf_event *event, int flags) { + struct amd_uncore_pmu *pmu =3D event_to_amd_uncore_pmu(event); + struct amd_uncore_ctx *ctx =3D *per_cpu_ptr(pmu->ctx, event->cpu); struct hw_perf_event *hwc =3D &event->hw; =20 + if (!ctx->nr_active++) + amd_uncore_start_hrtimer(ctx); + if (flags & PERF_EF_RELOAD) wrmsrl(hwc->event_base, (u64)local64_read(&hwc->prev_count)); =20 hwc->state =3D 0; + __set_bit(hwc->idx, ctx->active_mask); wrmsrl(hwc->config_base, (hwc->config | ARCH_PERFMON_EVENTSEL_ENABLE)); perf_event_update_userpage(event); } =20 static void amd_uncore_stop(struct perf_event *event, int flags) { + struct amd_uncore_pmu *pmu =3D event_to_amd_uncore_pmu(event); + struct amd_uncore_ctx *ctx =3D *per_cpu_ptr(pmu->ctx, event->cpu); struct hw_perf_event *hwc =3D &event->hw; =20 wrmsrl(hwc->config_base, hwc->config); @@ -138,6 +196,11 @@ static void amd_uncore_stop(struct perf_event *event, = int flags) event->pmu->read(event); hwc->state |=3D PERF_HES_UPTODATE; } + + if (!--ctx->nr_active) + amd_uncore_cancel_hrtimer(ctx); + + __clear_bit(hwc->idx, ctx->active_mask); } =20 static int amd_uncore_add(struct perf_event *event, int flags) @@ -490,6 +553,9 @@ static int amd_uncore_ctx_init(struct amd_uncore *uncor= e, unsigned int cpu) goto fail; } =20 + amd_uncore_init_hrtimer(curr); + curr->hrtimer_duration =3D 60LL * NSEC_PER_SEC; + cpumask_set_cpu(cpu, &pmu->active_mask); } =20 @@ -879,12 +945,18 @@ static int amd_uncore_umc_event_init(struct perf_even= t *event) =20 static void amd_uncore_umc_start(struct perf_event *event, int flags) { + struct amd_uncore_pmu *pmu =3D event_to_amd_uncore_pmu(event); + struct amd_uncore_ctx *ctx =3D *per_cpu_ptr(pmu->ctx, event->cpu); struct hw_perf_event *hwc =3D &event->hw; =20 + if (!ctx->nr_active++) + amd_uncore_start_hrtimer(ctx); + if (flags & PERF_EF_RELOAD) wrmsrl(hwc->event_base, (u64)local64_read(&hwc->prev_count)); =20 hwc->state =3D 0; + __set_bit(hwc->idx, ctx->active_mask); wrmsrl(hwc->config_base, (hwc->config | AMD64_PERFMON_V2_ENABLE_UMC)); perf_event_update_userpage(event); } --=20 2.43.0 From nobody Sat Feb 7 17:55:21 2026 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2072.outbound.protection.outlook.com [40.107.93.72]) (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 DC36125A63D; Wed, 9 Apr 2025 07:58:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744185505; cv=fail; b=NfGOA/zneX539FAa3unL/SatYnK3qoHVZdM0NjlwNLp2TGQIgLAAEIVzc5/C+EHo0DerKrrK7EHEdBbmjttBW1Tw5rScwGFI7iAEtgKwdSiT0sKFnJ5QVUQHR7Naoe5fTKq4HSHMUIc5AdhFdcxs12Yq1JyX/g6YUXnjuk0J1Zg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744185505; c=relaxed/simple; bh=y5OyOvxWPI0Sgyc5Xzb5xJ52K26uTVHxZuEjA429l+g=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FO9FCnpo8uXaioq9G73QyeKXKhABpntHEnyWTQQcCvUGpjIsSohDlmWocCoPvT50xhUg/325PIWGf+8l1hfWy1E+1+p3p8hKTHWSP5mpPt6C6JKqK0YddpRLyh4XE7C10DCD/l9x0DXzTtGiG/fP+V+cCELmb+hRVjGZN2hbfTg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=qgkt11fk; arc=fail smtp.client-ip=40.107.93.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="qgkt11fk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wBH7tc6uTIzjmH9veWKXDFNLokzH7feoknEIYa6nVzh6+O1YTHuW6TJ3BI/QoFaumrZFFPYnf2l8tSU/2t/Hm2yxF/rJqLIWhNXgtVOMLoI7WiGTo/6ZetlecbU/WTHhPP9H7y0fouGxqhl5ClTVdgeHrxgwzYwCl7Soy3OMaIZ6HQdt6RWj9s/2bRchX9VpVhGhG3TZ9yXcp2WktW7ioA5Q2sq4nIUHSITLcymTUI+ETVyr5Rk0Sa32kI+q1Qy8v677n/wkGr2ajvZxDL9BkVGStmNlYy6ku+7cGv0/IsFzvSnYLrtplY6IE3/p221DxapHYTJQrCsgKrs/MVuSmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=gGNuXVhQ6GrRE43gBjT/Y0+b7lPutRJhOI6Ve9LELHA=; b=YS5KMRF6Wmy8VhcJV8UakeL+3TPE4Waus2IAJb1ddaK3SlEDEFfdKR4ldu+qKm956xrXIh3V8EM5Xuxt/XvcBI2gt6eiEWM+dQ2SX0wY3NFpFMxYSF1jrKkaS+PhLjVhQrFB+3DVrqCqw/oLbV9rLDK6y+yb0s6vgsZC4YP6t+6QQ6ACjqJnIMGFstOq+aJa1fBDaQ/8joID2bRZChupPme23xY47KdW3SMTwTl5uHiU8b4jhZO1QpIDctxF6QjzL6I05pD2gj7Tw34O+e2vP3HkKdiIKardi9zWG6N4+EZt2MssZvn18f+Hy2wTUApUSvuPSgfSnJf2C/M6FuPT+g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gGNuXVhQ6GrRE43gBjT/Y0+b7lPutRJhOI6Ve9LELHA=; b=qgkt11fkQwVCSy3eix/MiAyte6ZELBd8wwXzDM5fMoy8t6MJjikwR6We++s9L/W706b56zfyjuoT4jMpuek228mlDRV9yG2Bq/UsBmvmQHQu0RZsdSV/LwbxmrawXZG9o5ijb/D+kiF0V3Tj7nggLof9JTdaEt1uCRAZZNGRJ/s= Received: from BY1P220CA0024.NAMP220.PROD.OUTLOOK.COM (2603:10b6:a03:5c3::9) by SN7PR12MB8791.namprd12.prod.outlook.com (2603:10b6:806:32a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8606.33; Wed, 9 Apr 2025 07:58:20 +0000 Received: from SJ5PEPF000001D2.namprd05.prod.outlook.com (2603:10b6:a03:5c3:cafe::dc) by BY1P220CA0024.outlook.office365.com (2603:10b6:a03:5c3::9) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8632.20 via Frontend Transport; Wed, 9 Apr 2025 07:58:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ5PEPF000001D2.mail.protection.outlook.com (10.167.242.54) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8632.13 via Frontend Transport; Wed, 9 Apr 2025 07:58:19 +0000 Received: from sindhu.amdval.net (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 9 Apr 2025 02:58:13 -0500 From: Sandipan Das To: , CC: , , , , , , , , , , , , , , , , , , , Subject: [PATCH 3/4] perf/x86/amd/uncore: Add parameter to configure hrtimer Date: Wed, 9 Apr 2025 13:27:08 +0530 Message-ID: <42f99bafa99d25b24e5446167490d4d1720d11cb.1744184837.git.sandipan.das@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D2:EE_|SN7PR12MB8791:EE_ X-MS-Office365-Filtering-Correlation-Id: 9f563426-031a-47de-aa49-08dd773c4b3e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|36860700013|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?pYZlCezo9kNFefSgRJGnPalVPLeTZkbkJoTTCCI1x1unNPw1xREfT38Gq8c0?= =?us-ascii?Q?fMVilV+Y2pqYtxjdD81qwyQ8nGGIVWgs+NymIhzoNXkxLRarkAGTpy299aPT?= =?us-ascii?Q?/u1r5nqNcw2TbeQ0kMHfSfPKL2AH5DAUlVRfp6rfnovPFXQFobs1aXw/xSCt?= =?us-ascii?Q?JTbaQh4VIMo/alxK77UTOOLrTm00jDrqFdpNWFk9ctuzn1ai3e2ntrIU2+Dt?= =?us-ascii?Q?SzOURQEQwYntNztZYmbB8Brjm8AOaLaGiXMf1yH4l/e0o4Rw3m9DJ4e0xyMn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BO5S39P2me4//mw3537qD42bBCAswowJlHgGj89?= =?us-ascii?Q?1RNQNRlnNjrH1OUXx53ercr7fg73NWvnbv0lkrrec2isZEUKJJHRPiDqkkA3?= =?us-ascii?Q?x347wvU/BRGV3ITJgjJ/IZMK3jeqFw2ILwu8E4PljSXjrxKGYz3sKkRUYPyT?= =?us-ascii?Q?+N/XsfmjdB4u5CYgr2idRjbCXzlirrzl2d7XCqaO9nfOn/xtk6qlvYPuLVJI?= =?us-ascii?Q?hqcgSXBCebtwxpWSyMioPc0MmUgO1XbO43mIMzlUB7nV9slwAP9t5t1WPZsH?= =?us-ascii?Q?cIJjeTCf9hhIg1bcqAsUlmaRxnNSZ/nr85QjlkAoQixnnZyf0ZJ6UlXK2xyU?= =?us-ascii?Q?+ieq4lXOayQaZMYPvZh0hBhQTGjpUaFL3VWq?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(7416014)(36860700013)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2025 07:58:19.9057 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9f563426-031a-47de-aa49-08dd773c4b3e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001D2.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8791 Content-Type: text/plain; charset="utf-8" Introduce a module parameter for configuring the hrtimer duration in milliseconds. The default duration is 60000 milliseconds and the intent is to allow users to customize it to suit jitter tolerances. It should be noted that a longer duration will reduce jitter but affect accuracy if the programmed events cause the counters to overflow multiple times in a single interval. Signed-off-by: Sandipan Das --- arch/x86/events/amd/uncore.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c index ee6528f2189f..8135dd60668c 100644 --- a/arch/x86/events/amd/uncore.c +++ b/arch/x86/events/amd/uncore.c @@ -87,6 +87,10 @@ struct amd_uncore { =20 static struct amd_uncore uncores[UNCORE_TYPE_MAX]; =20 +/* Interval for hrtimer, defaults to 60000 milliseconds */ +static unsigned int update_interval =3D 60 * MSEC_PER_SEC; +module_param(update_interval, uint, 0444); + static struct amd_uncore_pmu *event_to_amd_uncore_pmu(struct perf_event *e= vent) { return container_of(event->pmu, struct amd_uncore_pmu, pmu); @@ -554,7 +558,7 @@ static int amd_uncore_ctx_init(struct amd_uncore *uncor= e, unsigned int cpu) } =20 amd_uncore_init_hrtimer(curr); - curr->hrtimer_duration =3D 60LL * NSEC_PER_SEC; + curr->hrtimer_duration =3D (u64)update_interval * NSEC_PER_MSEC; =20 cpumask_set_cpu(cpu, &pmu->active_mask); } --=20 2.43.0 From nobody Sat Feb 7 17:55:21 2026 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2070.outbound.protection.outlook.com [40.107.93.70]) (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 E1C5F25A35E; Wed, 9 Apr 2025 07:58:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.70 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744185524; cv=fail; b=YjuFoa6SV49iksC/ur+crNEXuPi90JPLdiD/aEdmr/FDyYYdphyMArZoXUTHeHG7duoWRRDnRAfRv4hVqlEtAKVn+tkp7jo0vsD4D9T6hfN4vyoElHk/C/iEUOb8Go9lkD4Csz7O2kTWihzhzFzqCTQ6aBGOzK9hSX9ocOGnym4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744185524; c=relaxed/simple; bh=EQw2bcF067O36lua6IAUKIXn9+so6VYeoyvH+KuBb4c=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QMquPxT1Dn1+5gAu6deFHxqULPqT0OfVh54wfL84MWy4fxOoavz/STxmjxdDWb1NdrASQocv5pVu4XE49x/cgezyO3wVq3JX1Xv7huQ6uRfrDpXKs+oFaXv1yoi9/ookU4535u/Cmwuh/vFpCpB/RfCcXVY0H3X2/tOVngdYx0I= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=TXVtdMMe; arc=fail smtp.client-ip=40.107.93.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="TXVtdMMe" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yibAen9reA9ut5VFHrte22oKDBaIZzQVsYdSkXclsQHIFfz3GNjAEANdyNuHLrahDDreF3jNyd2p8OOhrpifS3nnS27Ac2SXQieAMXjbV58Hn9/fohcwXSjy3dx7IZWAkoINU0qp6NmIenn8Ip4bGp6hopalJ19ld/u7AVV/JWOEBjtFb42yp4cV1oDv2nTGQocLwPmrUaMIl5eFmQINHyth1xRpQzXSwomiCZ30oiTcy5juTW8uo0bYy7hhM37RGkbj2lY8WMTAlDUs5vbAIfZj15kKEsdoBQqJ6lLK3uhw6xSFA19SfdEogxJWzVumZUm5mvtH9zPW4H+zWXH9Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=bvee5zeZ8b/e2tICwns+kHBROTnp+iw3PwNKtHaPDF8=; b=YCXlmnIuSnnCBVn545uqRyYTSi2bse123dk91ptnPznAJlpqoWVv8mlKU0QNnyFjCvW8zF6W/wwX9QYD5LI9Oac4GRqAGArdoOnHxqDC/WkTcxq+hrvS7mY809eGK0P5tYQUdLy7IfNRnnKZxq97vNjdpcG0wb2z9QbePi6xvVyUwdJ1deJM+7QVyoj/+EKITo2mdcp5XFTHr7jT++NkPhLBb68cEfx81tZ/aQmhViAqR3p+Ux6a4Vv+Z2D+bgDvL3SJq+9ceqsdHaQgsB9fC9x8WYOD4vbf4agiPhaQ7IRPlNN2wCEq+n1DXNc155uN7uhXG1oUd8HP+vDL2vsv9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bvee5zeZ8b/e2tICwns+kHBROTnp+iw3PwNKtHaPDF8=; b=TXVtdMMeRp0f427nYqH/9yjg+c15T+2f/J72ncJ37GAJ5PrPKViL0lSone5UF2vKMP0N0opqs6IR1ldI18aYkvncQ4535Ey8sCQ5Zhx4GxH9o/GS4tLACNfquD5zlHV8cXRF+lLcnbWD7Tix7cn1WIY8EwFsruEo2zA2SPJljD0= Received: from BY5PR20CA0005.namprd20.prod.outlook.com (2603:10b6:a03:1f4::18) by SJ2PR12MB9005.namprd12.prod.outlook.com (2603:10b6:a03:53d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8606.32; Wed, 9 Apr 2025 07:58:38 +0000 Received: from SJ5PEPF000001D3.namprd05.prod.outlook.com (2603:10b6:a03:1f4:cafe::6b) by BY5PR20CA0005.outlook.office365.com (2603:10b6:a03:1f4::18) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8606.34 via Frontend Transport; Wed, 9 Apr 2025 07:58:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ5PEPF000001D3.mail.protection.outlook.com (10.167.242.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8632.13 via Frontend Transport; Wed, 9 Apr 2025 07:58:38 +0000 Received: from sindhu.amdval.net (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 9 Apr 2025 02:58:32 -0500 From: Sandipan Das To: , CC: , , , , , , , , , , , , , , , , , , , Subject: [PATCH 4/4] perf/x86/amd/uncore: Prevent UMC counters from saturating Date: Wed, 9 Apr 2025 13:27:09 +0530 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D3:EE_|SJ2PR12MB9005:EE_ X-MS-Office365-Filtering-Correlation-Id: b1db04eb-dd31-426d-bf5e-08dd773c566a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|376014|36860700013|82310400026|30052699003; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?6Khj82S7xwAz+7/O91pcUDuDwMvVzZvt1dxmE6/HCYmOXAxX6RLQTLU+WARW?= =?us-ascii?Q?np4s03+GHdfXYuav+/uwo33WHDAF3RhjdQ6y8POjzzhIKWR0AUnPUnk/W9ZU?= =?us-ascii?Q?+XLDu0czDFESrFWWjTY9XQyTt7A40VCvAV0HX2dEXBthhv4t7lVqjmzub3j8?= =?us-ascii?Q?na5IH7Upr133SlmoeuGtPI/3NYh5dUkRGX4WiZW/NcWfPNMGWlq2TML9OWcC?= =?us-ascii?Q?5K1/rHWVA/y59CbaFeYE5QwZhlAKU6jI+04wh2L41XnBfdSuGIkeZnpuJlWT?= =?us-ascii?Q?jXm+L2dQgWkdl31b+BROL/aOnVQlJ871uWWeN72nQ2w94XpDdr++RvPwGVBT?= =?us-ascii?Q?GT94ZYas7/8XTw4GoRv8ZgD8tnKGetYR9Q9Mh0C7BgvYiEz84MtFkP3PY4bf?= =?us-ascii?Q?NGQoRjEK9rny8w6GUZbUtk1m7le5Ce53Np1TBquhKrpF0Y3jjCHJfd0Z2RVk?= =?us-ascii?Q?zmxIleuf0VC5nOLdFzQdoEMAAcpNTaMY8+BP164U9wYTzasLV1/53IfK8NFa?= =?us-ascii?Q?h0vtEO5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us-ascii?Q?TXvXbsUUMGiF8VKNgcEtFJsxzFhlBn3ag9q3Dqwv1ty0ISW1AVVE+b0VfkI4?= =?us-ascii?Q?9EmCNiXWEsgSq4k=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(376014)(36860700013)(82310400026)(30052699003);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2025 07:58:38.6651 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b1db04eb-dd31-426d-bf5e-08dd773c566a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001D3.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB9005 Content-Type: text/plain; charset="utf-8" Unlike L3 and DF counters, UMC counters (PERF_CTRs) set the Overflow bit (bit 48) and saturate on overflow. A subsequent pmu->read() of the event reports an incorrect accumulated count as there is no difference between the previous and the current values of the counter. To avoid this, inspect the current counter value and proactively reset the corresponding PERF_CTR register on every pmu->read(). Combined with the periodic reads initiated by the hrtimer, the counters never get a chance saturate but the resolution reduces to 47 bits. Fixes: 25e56847821f ("perf/x86/amd/uncore: Add memory controller support") Signed-off-by: Sandipan Das --- arch/x86/events/amd/uncore.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c index 8135dd60668c..fe746d803a5d 100644 --- a/arch/x86/events/amd/uncore.c +++ b/arch/x86/events/amd/uncore.c @@ -965,6 +965,36 @@ static void amd_uncore_umc_start(struct perf_event *ev= ent, int flags) perf_event_update_userpage(event); } =20 +static void amd_uncore_umc_read(struct perf_event *event) +{ + struct hw_perf_event *hwc =3D &event->hw; + u64 prev, new, shift; + s64 delta; + + shift =3D COUNTER_SHIFT + 1; + prev =3D local64_read(&hwc->prev_count); + + /* + * UMC counters do not have RDPMC assignments. Read counts directly + * from the corresponding PERF_CTR. + */ + rdmsrl(hwc->event_base, new); + + /* + * Unlike the other uncore counters, UMC counters saturate and set the + * Overflow bit (bit 48) on overflow. Since they do not roll over, + * proactively reset the corresponding PERF_CTR when bit 47 is set so + * that the counter never gets a chance to saturate. + */ + if (new & BIT_ULL(63 - COUNTER_SHIFT)) + wrmsrl(hwc->event_base, 0); + + local64_set(&hwc->prev_count, new); + delta =3D (new << shift) - (prev << shift); + delta >>=3D shift; + local64_add(delta, &event->count); +} + static void amd_uncore_umc_ctx_scan(struct amd_uncore *uncore, unsigned int cpu) { @@ -1043,7 +1073,7 @@ int amd_uncore_umc_ctx_init(struct amd_uncore *uncore= , unsigned int cpu) .del =3D amd_uncore_del, .start =3D amd_uncore_umc_start, .stop =3D amd_uncore_stop, - .read =3D amd_uncore_read, + .read =3D amd_uncore_umc_read, .capabilities =3D PERF_PMU_CAP_NO_EXCLUDE | PERF_PMU_CAP_NO_INTERRUPT, .module =3D THIS_MODULE, }; --=20 2.43.0