From patchwork Sun Apr 28 09:11:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Du, Xiaojian" X-Patchwork-Id: 793217 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2087.outbound.protection.outlook.com [40.107.93.87]) (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 0D8312EAE9 for ; Sun, 28 Apr 2024 09:11:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714295517; cv=fail; b=cj1f5GP63uzwEtED+ajjuSrx8dvf/A+L/j2+tQw+W9sZO249VDm/bNif0EqPKaXrfPBKl0u2XHtKgtpSIcjjzmuvlPQmbbWEwnFmSsaYCtlAx0IMQj6ZEX4960H+e5qwhDbswvNzpZo3gYBRFLiAt6IWkbjoaalOg9GAk9ztEdI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714295517; c=relaxed/simple; bh=OLKKB5zPlhMzilk3tDMs/jTu4Sd+5kLP7iwl20Pketc=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=q6gEzUzuUEr8c+B9fvIx7B4dr1GpIkGyQQhJyGEG9uU2dbnip/ZrKj6GFnxqKHlO10EY8QB0VPlMlheAhm38Tk70pVNuN3LPlLRNMdGKNh8XkfV3xsdMbyOwlzfmNPdX7HQ+2S1KiG4j6UavlI3sHkWjsPDLnswBt2Xyi1pKlqk= 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=KAj062rq; arc=fail smtp.client-ip=40.107.93.87 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="KAj062rq" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RJt40s0GQmrKcdEJHVal+2vpjgFy3pEbjFJ5LcU7O2H1dseE+yQ5k2aQLAYyVDGZqZXGoLQjEgnUAeEA67lghVvOg1NWf7YG09IsMtI45vC6RlHYsyXwLnqPK6yn2+oBKcTKr5ATtsFuGmHJ2ahrMdDepM/lZ92CoaZASw5E7gsFRiL31Lr2AfUpkDKl261oPh77sb7cPY6FJC6qn13DCN2Dm1ugexWZU+s9vdibVBW4DEhAWBkRr6UQF295cDHvCyYvhRP0DH8DjtwkU3RklVhSk6eWbny1uKvYXoHRIIxSQ5yPo5uMyk2z67WyI87+e0Rd+sd4MVKqytdMTp8GjQ== 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=8ZbiXL+THXYrW1qJoG05M7et2V7EPvyRWwx0UEzHQeU=; b=TTXod5wkixdCetzalwy83MHQWTyjuRrgafLUYkBq7wryzYolx9bkZwSH10wSxOHXyDHxnT00jGnZGuv8ygLU2CqJXxyTHTTWemp3iYaQcXgRyhAGcoDE4dg8SzgwSD15EZMne/QTwa2vCPZqWYpkKu1eDamfpM0xvhcHoe4b0y7fiQxwHTmGK3xHBx4YQlU7OXd+KjMAEexoO7rv8shXBC27r9sgQ8ZTPut0ZDv6YbT2IhC2IxBqMbIFF9yvgNrYYj2j6wlqY/BLaqCbjDJEMnKcjnnz8JwxASCTChrVPvztsxqyq3x8zJGQQZIV5Dzfu2q/+WBanrBhGD+cVVOehA== 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=8ZbiXL+THXYrW1qJoG05M7et2V7EPvyRWwx0UEzHQeU=; b=KAj062rqwAaMuPzUAfot2aHHBxQdcIE4A4715TBO3tGby/IzgV/xGtPgRjodFa8w3hr/4ePQFgZS2HM4GQO0VR6PpFd/HH+QoApWAdqaNO4K97nXmNC8h9MfnLc1sSDSFbs8GN0H4s6LzFm8+V18rZyOx/IZvmiuvdieeeq6UOQ= Received: from CH0PR04CA0068.namprd04.prod.outlook.com (2603:10b6:610:74::13) by LV8PR12MB9229.namprd12.prod.outlook.com (2603:10b6:408:191::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.32; Sun, 28 Apr 2024 09:11:53 +0000 Received: from CH3PEPF0000000B.namprd04.prod.outlook.com (2603:10b6:610:74:cafe::e4) by CH0PR04CA0068.outlook.office365.com (2603:10b6:610:74::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.32 via Frontend Transport; Sun, 28 Apr 2024 09:11:53 +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 CH3PEPF0000000B.mail.protection.outlook.com (10.167.244.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7519.19 via Frontend Transport; Sun, 28 Apr 2024 09:11:52 +0000 Received: from jenkins-amdgpu-2666v3.amd.com (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.35; Sun, 28 Apr 2024 04:11:50 -0500 From: Xiaojian Du To: , , , , CC: , Perry Yuan , Xiaojian Du Subject: [PATCH 1/2] x86/cpufeatures: Add AMD FAST CPPC feature flag Date: Sun, 28 Apr 2024 17:11:32 +0800 Message-ID: <20240428091133.592333-1-Xiaojian.Du@amd.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: CH3PEPF0000000B:EE_|LV8PR12MB9229:EE_ X-MS-Office365-Filtering-Correlation-Id: d04f614d-cfe1-40ee-c514-08dc67633ea3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|36860700004|1800799015|82310400014|376005; X-Microsoft-Antispam-Message-Info: F0CnI2UMJd2sv8j304gA/PDiDMATXln4cE5WPqAqPlqlCRTo/UULI4Mzhif79KUWnIU9hyGjXB8kbUbX85PAYRgllpFOSzxW2M8AReROnKdWdef2FWpGgUbkhhCo5BKBR2nImtii68zEebEjS9JuLmnZGUeRl1uMVfaTcMiAtqVBrqbRv2gcvM2UD126mUEBNMmsyxmUErfAwnxFiz7OeRyCM1myvk2qUSekredGFkoW/XUPZaOiWtZyHWPj7ZAx8zvBMQ7OA0NrfrRwqtg9A2L7HO4wmR4LyTAE8R4mO9fUk0LOiVSOn90E7jB3xFYI2tCFz8LNNh3i4eOPhCO7Dz3E5IADk3lFY+TX4A1Jv0nGjy2R4f7f9X3XHhu/x9p72j/GwSz0xhZvlMdVFCRHHEY2NmWBanhcBtQqoXPfYYWiPop4Nz8YQuuJTJ3Ez8NxCeJE6KcFEblEGUuu897cZja4DEs1IiagQ6wP+yNJBrXwH/cwFc6EkQ9pcjify3GlUeD//4UBAsrjc8pYvgIucMrz9FyrhRUDamYD1U5T4DF60DPCbHXY/kzbVQCIZn99PTnfjk/QEgYB7BSWlxPuWYrW2UdLTwFQsLSs+2hWZpFW6mY+4gS+jifjppXRdVbDFj8yaY5F5QVKcAqxj1LTU+BQcwPDAr0CvtFG2K4+IhXYpHyDjV5aYt1FxqJtKLjV76IblUpNbXQzbnAKpGBfemDEJoHfkq8MiUOpw+l7i1okDrbF9ltUAs3DbQya2LE3m7+hO86Uom2+/Wcf+6H4sjBatKz0au4I+8X3NDA925o4Oa1AM1ZBsz6OfPH+MC4MIs8tHC6jt8sNWGId9kk0OJdGIghVHcqlJvujLbHZcztKrMKQW0i6mOMx0v8MGn9LGxyR2arvqAxIiECSU3z9ZwBSrGHQ+UO3HPhMedbG0tLND/Va/FRA3GLGQVvPlLkC3sfV4Iss5gH2t9JeFu4YZpfDcmUwYKymBMLwDW09+kjRLWJ3BYgLYnnywvG0fZBpXiSOvhU2UvsBEyBcA/Kh7rBUbf+kzhm7DB5g+jqpb2LDkdFh+ifEUPo0Zq6+eAW+n6kUrNfo69+73EJIq5KWj8Jsh6TBZ/kzJ9jELjfrpBVvhFTWJB7zzbHHpD53V4TO28kBXo2KjXvotQLFGRWxkAyGSxTedFYNwk7CaA79N9178lgKtH9ib/rAdsFgSIhBpJZwMca21oq9bBjkIwc7yWRQbL2MCtA7VjNx44HHIIwE9IxXLL/yiyKJ5aNLRhnrtTk89tbizvjaoD/B/PJA6RZNKqcgO3a1yMfDz6fCxulgNAiZeK7gU7diy9lRqMZA 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:(13230031)(36860700004)(1800799015)(82310400014)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Apr 2024 09:11:52.9486 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d04f614d-cfe1-40ee-c514-08dc67633ea3 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: CH3PEPF0000000B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9229 From: Perry Yuan Some AMD Zen 4 processors support a new feature FAST CPPC which allows for a faster CPPC loop due to internal architectual enhancements. The goal of this faster loop is higher performance at the same power consumption. Reference: Page 99 of PPR for AMD Family 19h Model 61h rev.B1 https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/56713-B1_3_05.zip Signed-off-by: Perry Yuan Signed-off-by: Xiaojian Du --- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/kernel/cpu/scattered.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index 3c7434329661..6c128d463a14 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -470,6 +470,7 @@ #define X86_FEATURE_BHI_CTRL (21*32+ 2) /* "" BHI_DIS_S HW control available */ #define X86_FEATURE_CLEAR_BHB_HW (21*32+ 3) /* "" BHI_DIS_S HW control enabled */ #define X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT (21*32+ 4) /* "" Clear branch history at vmexit using SW loop */ +#define X86_FEATURE_FAST_CPPC (21*32 + 5) /* "" AMD Fast CPPC */ /* * BUG word(s) diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c index af5aa2c754c2..9c273c231f56 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -51,6 +51,7 @@ static const struct cpuid_bit cpuid_bits[] = { { X86_FEATURE_PERFMON_V2, CPUID_EAX, 0, 0x80000022, 0 }, { X86_FEATURE_AMD_LBR_V2, CPUID_EAX, 1, 0x80000022, 0 }, { X86_FEATURE_AMD_LBR_PMC_FREEZE, CPUID_EAX, 2, 0x80000022, 0 }, + { X86_FEATURE_FAST_CPPC, CPUID_EDX, 15, 0x80000007, 0 }, { 0, 0, 0, 0, 0 } }; From patchwork Sun Apr 28 09:11:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Du, Xiaojian" X-Patchwork-Id: 793006 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2056.outbound.protection.outlook.com [40.107.236.56]) (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 77E772EAE9 for ; Sun, 28 Apr 2024 09:12:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714295522; cv=fail; b=n55/lBlFIT+ol4I2eYjQc3CNPD2lw08mnmOf6t3uZUIT2t91xQ/6VxbyB/d7vO3ezNM0AJN1LH1qULApXzz0ciGL9mv/5b2PAaccKoSSzH+lcPbGNufYoky6whQYgFYtNVl2WzhfpU0tEY7dhni+/oNZCb3gJ9LuTDOeHF7lAOg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714295522; c=relaxed/simple; bh=9eqzXa1iwgTiH0uGFLgK/7PZRVtEuk3TwiboFBA75Iw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VgkjSrZZOfvm5xVzpdAAqQW+V6nBAaY4iK1Njee5H+Ym0lKo9REaKPU58NUtqeLxQe2Jn0P/ek28xUmB1ufI3PAup+Z78wtCKjz6R6c+y9i2Xz3vrL/Ebh0o46TxJyn9DumTSHa55rhwgYPqJTZSa9r3D4cy/RZozDmT/zD078I= 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=H1Rbu3/P; arc=fail smtp.client-ip=40.107.236.56 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="H1Rbu3/P" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WvFZaZsnzWvcy7sg7UFgKwQhqgvrfrDVaDmY8n3vm5aAXAbDU8myrH0aSR2sQsJa0GVbgWieQHdlRE2OpdQ90R0PvGZ9kzWlildQ6cwQwd0joJ3jQFo1g8zK5cvRqbcdrl2IRJeh5Xfl2zXTOTt7QSxpwcWPjYFxzbpBbNJtBAj9L+s20DIOFk7INmyi9pZEllOq/rS2JoqFYdEhR8yC+KLhR7GLgA2qzbYVzfiz8uMOO7+E+ubjKyDEDKhLVWstbOkMX4yYyshg4Hx2j2Zojv8YhNjL1flLoQQiiKzyKSQlDwJ4Lpw9Q5hpkt3s+/j4A9NCLjryIS6VwvWsliEwSA== 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=WD5keXYSgtpPpkiog9lQQg5mjM17XJl+MtHnlG6oVUc=; b=Mi0CwM5SRvJZNPrj5iyXlhTPqDOQWFIFhw/Fk8QcXRJxDkyqU0U3z0RfcQ1MB5sMSoBVgQFfOfkjATdrJ4jAGy1AU5Rk89j6ETAef8fgGpH3+XMqreLp5Pa64XJVtIxdfRGBCysVJm96c9MGBLWxZ+pJ7rbR6VxID5WhlHqh4Qdoma6Nu5f/hhbs6KLdDHxLClQV+ZadPTVnhsVtynQKHTomjhTWHDbIl+gcmuyCHzD/Epu/UClWN431OqbDA96fjVK/EZry2guYGc9mCBfmRYwm0wVzEciURDsd2GpNi5Y/9H3yHrx6B5ShIFH2CgE4MVx79pckSZZvx7Qkn0w6JQ== 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=WD5keXYSgtpPpkiog9lQQg5mjM17XJl+MtHnlG6oVUc=; b=H1Rbu3/P9giGXnEh5/WYjcItpg8UIiVcyDa0xPGHzVcU2487rrDxiZ2h/mZRXZNrLIwswaRXDiHfZ4HbzbIBy3BN+KLmKrLBL0Po8+oFf6N1iqESgzt7ELoJ+REEwdJX84HuW0RCOtOO4cSnQp90C23T/FuySaq092Rhxsbw9rk= Received: from DM6PR02CA0074.namprd02.prod.outlook.com (2603:10b6:5:1f4::15) by DM6PR12MB4204.namprd12.prod.outlook.com (2603:10b6:5:212::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.34; Sun, 28 Apr 2024 09:11:55 +0000 Received: from CH3PEPF0000000E.namprd04.prod.outlook.com (2603:10b6:5:1f4:cafe::2) by DM6PR02CA0074.outlook.office365.com (2603:10b6:5:1f4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.34 via Frontend Transport; Sun, 28 Apr 2024 09:11:55 +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 CH3PEPF0000000E.mail.protection.outlook.com (10.167.244.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7519.19 via Frontend Transport; Sun, 28 Apr 2024 09:11:55 +0000 Received: from jenkins-amdgpu-2666v3.amd.com (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.35; Sun, 28 Apr 2024 04:11:52 -0500 From: Xiaojian Du To: , , , , CC: , Xiaojian Du Subject: [PATCH 2/2] cpufreq: amd-pstate: change cpu freq transition delay for some models Date: Sun, 28 Apr 2024 17:11:33 +0800 Message-ID: <20240428091133.592333-2-Xiaojian.Du@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240428091133.592333-1-Xiaojian.Du@amd.com> References: <20240428091133.592333-1-Xiaojian.Du@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: CH3PEPF0000000E:EE_|DM6PR12MB4204:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a21a8f1-995c-4c74-e40e-08dc67634007 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|1800799015|36860700004|82310400014|376005; X-Microsoft-Antispam-Message-Info: Hqc69ARR2RgVdGronFIDsgiFUKv0M+r/bXeMBIeNcVSJuwwNJSB8tVMyTD892HDGTy/ScraNiRrw8VND2i+DfhTVSVMwx22C429IbiJcdEKxZMf5O/ceYd7joQ5bl+UPyvyVUxND3hnpmgk2LvDTv2ahJGk2qIQQQ0JqWQE+yR9iuXE081mX75a0nHGE8ybf2AMFybyUG6J/62W6v05YF2ICfyLPgFpBi7+x6TJkAbwpvUeyuXXmYLyU68k9Oe/RMTdCBEn978fTfmA1qiFKnPyKP7dod+ICYq0i3mvYv5ePuRFzxqIguEhXk2ExNSAJMyyHKb0/nEh8IiDcgbCGUk2CKx8VSgP6VtZFoWM7sBDPXjGDjS+U3bTOEC3MreVjladmAIVOWSfALCunZdOMMerhiRqrDMP6inbPSw1iEqUhrD0EoGpVkuKpLTMLAmwRZ2dgvt4yCqXxGly0tv237DTl2BSx82/2S4M++b2UEtiy1I6Dz9wv5qBVc2BWsP80dnsNpEfMmymXHvKdKyQsKn567CauJHn4ciHiLC6zPnJ26smbN/8Hjnxrk88gEyyqQLp9g2a1HZftohswM8Ib/l07B8OCVaDPOTDDsdwh4q20glO6Y4mqAcbd0b0FXEMLF7ufRef/tiXzDKQfKgdMyrvWy3MZuI4mzznQiWbv1WbWAZwagYjoqSyXVX3Ruw8m1IGnsPhqX6gyzEQ7OkPdyssrUxwcblo8NiP118ewbmJilUlXrJ37wp63iqemO0rbj0TpGJRWkZIom8DbKoAxNi0qgrmwOK0c4vLm40uyKI5Q6GWU9X4XWOFROcpEPY36isxgSDW65iNJIK3B1p00ipam3gUXW+/nmPquIfIKqeZrZ1RrUFjC0eFadDpZVf1pZmTquHWAXzZCPCGSRpy6Gqv2rsDAExo24hKhgKURVf6q+636wY2M2EwkH3cpQ59jyJC9XECfDfqtOYq6OXIJ4RAQwN7Gyn9GloLVxPCGYSPEFVev1cuZ++YANZOunNjeD16iR5/iDR/CEICkuHEbX4GBZaO6ENFP/WmlJUUl13oAMr/GQ0Vs7KOflc4Jks7k5cPsyourxgUXY+ydx6aVw/9gH+M0sqmuQUf9wPyfTdP2HDgQ0CGhgRar1hmrbBKvjVMkDPKDPDFn8Tt5cRQDYOQXe24BeuGR10VpEnVe5I20OayOor5EXrohd3V+/SU7wkWoA1H0qUHP9EXwJRrvg7/i8c9MoiRf34GxZ/BVO6NDdDSlhP1o7AYjggOxrPZw/N56a2b+y1Km5ldwjjKynONcyc6Q8AenYfygLO02yK802+itPR5qbOiOFJLRJcSKoPnAjRjSZwg4+b6cNaTXUH0KcXvh8trHOWDbernHMr8= 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:(13230031)(1800799015)(36860700004)(82310400014)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Apr 2024 09:11:55.2824 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2a21a8f1-995c-4c74-e40e-08dc67634007 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: CH3PEPF0000000E.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4204 Some of AMD ZEN4 APU/CPU have support for adjusting the CPU core clock more quickly and presicely according to CPU work loading. This is advertised by the Fast CPPC x86 feature. This change will only be effective in the *passive mode* of AMD pstate driver. From the test results of different transition delay values, 600us is chosen to make a balance between performance and power consumption. Some test results on AMD Ryzen 7840HS(Phoenix) APU: 1. Tbench (Energy less is better, Throughput more is better, PPW--Performance per Watt more is better) ============= =================== ============== =============== ============== =============== ============== =============== =============== Trans Delay Tbench governor:schedutil, 3-iterations average ============= =================== ============== =============== ============== =============== ============== =============== =============== 1000us Clients 1 2 4 8 12 16 32 Energy/Joules 2010 2804 8768 17171 16170 15132 15027 Throughput/(MB/s) 114 259 1041 3010 3135 4851 4605 PPW 0.0567 0.0923 0.1187 0.1752 0.1938 0.3205 0.3064 600us Clients 1 2 4 8 12 16 32 Energy/Joules 2115 (5.22%) 2388 (-14.84%) 10700(22.03%) 16716 (-2.65%) 15939 (-1.43%) 15053 (-0.52%) 15083 (0.37% ) Throughput/(MB/s) 122 (7.02%) 234 (-9.65% ) 1188 (14.12%) 3003 (-0.23%) 3143 (0.26% ) 4842 (-0.19%) 4603 (-0.04%) PPW 0.0576(1.59%) 0.0979(6.07% ) 0.111(-6.49%) 0.1796(2.51% ) 0.1971(1.70% ) 0.3216(0.34% ) 0.3051(-0.42%) ============= =================== ============== ================ ============= =============== ============== =============== =============== 2.Dbench (Energy less is better, Throughput more is better, PPW--Performance per Watt more is better) ============= =================== ============== =============== ============== =============== ============== =============== =============== Trans Delay Dbench governor:schedutil, 3-iterations average ============= =================== ============== =============== ============== =============== ============== =============== =============== 1000us Clients 1 2 4 8 12 16 32 Energy/Joules 4890 3779 3567 5157 5611 6500 8163 Throughput/(MB/s) 327 167 220 577 775 938 1397 PPW 0.0668 0.0441 0.0616 0.1118 0.1381 0.1443 0.1711 600us Clients 1 2 4 8 12 16 32 Energy/Joules 4915 (0.51%) 4912 (29.98%) 3506 (-1.71%) 4907 (-4.85% ) 5011 (-10.69%) 5672 (-12.74%) 8141 (-0.27%) Throughput/(MB/s) 348 (6.42%) 284 (70.06%) 220 (0.00% ) 518 (-10.23%) 712 (-8.13% ) 854 (-8.96% ) 1475 (5.58% ) PPW 0.0708(5.99%) 0.0578(31.07%) 0.0627(1.79% ) 0.1055(-5.64% ) 0.142(2.82% ) 0.1505(4.30% ) 0.1811(5.84% ) ============= =================== ============== =============== ============== =============== ============== =============== =============== 3.Hackbench(less time is better) ============= =========================== ========================== hackbench governor:schedutil ============= =========================== ========================== Trans Delay Process Mode Ave time(s) Thread Mode Ave time(s) 1000us 14.484 14.484 600us 14.418(-0.46%) 15.41(+6.39%) ============= =========================== ========================== 4.Perf_sched_bench(less time is better) ============= =================== ============== ============== ============== =============== =============== ============= Trans Delay perf_sched_bench governor:schedutil ============= =================== ============== ============== ============== =============== =============== ============= 1000us Groups 1 2 4 8 12 24 AveTime(s) 1.64 2.851 5.878 11.636 16.093 26.395 600us Groups 1 2 4 8 12 24 AveTime(s) 1.69(3.05%) 2.845(-0.21%) 5.843(-0.60%) 11.576(-0.52%) 16.092(-0.01%) 26.32(-0.28%) ============= ================== ============== ============== ============== =============== =============== ============== 5.Sysbench(higher is better) ============= ================== ============== ================= ============== ================ =============== ================= Sysbench governor:schedutil ============= ================== ============== ================= ============== ================ =============== ================= 1000us Thread 1 2 4 8 12 24 Ave events 6020.98 12273.39 24119.82 46171.57 47074.37 47831.72 600us Thread 1 2 4 8 12 24 Ave events 6154.82(2.22%) 12271.63(-0.01%) 24392.5(1.13%) 46117.64(-0.12%) 46852.19(-0.47%) 47678.92(-0.32%) ============= ================== ============== ================= ============== ================ =============== ================= In conclusion, a shorter transition delay of cpu clock will make a quite positive effect to improve PPW on Dbench test, in the meanwhile , keep stable performance on Tbench, Hackbench, Perf_sched_bench and Sysbench. Signed-off-by: Xiaojian Du Reviewed-by: Mario Limonciello --- drivers/cpufreq/amd-pstate.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 2015c9fcc3c9..8c8594f67af6 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -50,6 +50,7 @@ #define AMD_PSTATE_TRANSITION_LATENCY 20000 #define AMD_PSTATE_TRANSITION_DELAY 1000 +#define AMD_PSTATE_FAST_CPPC_TRANSITION_DELAY 600 #define AMD_PSTATE_PREFCORE_THRESHOLD 166 /* @@ -868,7 +869,11 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy) } policy->cpuinfo.transition_latency = AMD_PSTATE_TRANSITION_LATENCY; - policy->transition_delay_us = AMD_PSTATE_TRANSITION_DELAY; + + if (cpu_feature_enabled(X86_FEATURE_FAST_CPPC)) + policy->transition_delay_us = AMD_PSTATE_FAST_CPPC_TRANSITION_DELAY; + else + policy->transition_delay_us = AMD_PSTATE_TRANSITION_DELAY; policy->min = min_freq; policy->max = max_freq;