From patchwork Thu Oct 17 05:39:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dhananjay Ugwekar X-Patchwork-Id: 836524 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2076.outbound.protection.outlook.com [40.107.236.76]) (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 037A6156243; Thu, 17 Oct 2024 05:40:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729143631; cv=fail; b=Jfz9N9SyE7HW7TJ9+KQ9NDh6HkRCTkr7ApDuFH1t3/iCIzU+f8066VYZNgN1VHt/pID1xNMtryau3zRWwz8csG9+UYso56K+Ybw3ZPmHR1y90KLp/gAebVxJTKhTLBby85AGeTrtbWiz36a7zsyyHsylY5EaXxTH+hbUQRDsI2Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729143631; c=relaxed/simple; bh=mvQ5QgmaGhCMt9pOeaI2FYN5k/BH5AnrZXVjAR54kx0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=E7J615bYM1bPd7wkRYD4Ce0a68saph4hB1hZ3gr0lnihoY7qkEhubbS53MdZCe/Ck/6yso3Cz3s1KLPZ32oFabIXc6TuwmLH3NeY6VYHHeBliiE0R6Y92HqHvXpuchSsPMfBMmAb0oRZDTeKFCU7E3Yvs1vepnK/1faog+vYrtc= 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=ZgrrPPzj; arc=fail smtp.client-ip=40.107.236.76 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="ZgrrPPzj" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SjReUTQFWgt30AxHR6GJi3Ul04ozgvrJS97t1UpjJ6gl26q3XwOz1eLNWsmnqSD8M8uOUy+Y9lmJWmHYtCI58fxr7ZJ+MSMgPm4wPGqPoeTGqCRn2KHsWSuFP14Sx5aqWNlbUxtBEDOZ1bT72vVhjdHTKyepihrMJV3UN8JsAfDISgMm0ACJGGnHwe1T2NHigZrDY1YPI9W2b6iCBt/oMbyfQLkRYfyCJErHKZatHydQrUoeQbIpWjdfN5AlccfG3iTlr1aIyDRg1MsY4F1GgRt02caz3ETF02QRUVHYd41XNZ8vE8T7nSIVeJuEE8v/cCqs68ycLCnfgXWsy71JKQ== 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=2DofXEulEPleTP7rSp8k6vCXeuRPe8tFtJfqnTrhOxE=; b=praX99EfAUl9khxjIn6lPEZ88Qu27QvBe6Wo2VOo6XEdVoRc29Z0JSqMBbBsSdT6hsjyYCT5+lJQD/AZPrOP3YoFv4JXTepHdS3ArKxCSESYADRFbM9YHc1AHttRrniLb9ffpvr+vaAyfNDvyqCUeT/QY8jexQQFfGdiF2jxe+jofETX3lU1lgF/ukXK0/KA0FZuXpNl7IISkwr+p3nYVCfaLpycYRN1Tsj+D0F83fExcbDTZ9QLPDbLPxVA3d3ZqCG0NVP/tDN7cw1UetHe/JZDF+4rkUEFnKbo+IOKgvbuhEW8qDJCYT0Wv1hgw+FSw/ce1k7yh95W6yagWpcq5w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=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=2DofXEulEPleTP7rSp8k6vCXeuRPe8tFtJfqnTrhOxE=; b=ZgrrPPzjawtLwLRkc1RXnPmfvqf14cCogag0nhP6AXFPxUqzBCIGZ1MDAnrO2m0t2wCum2TmAWJzHWX1JSmad7okHukQnWOmMCrpKFDGe/tnrL+5DzGNaoGaOZPwLPJpfGQMVPNaIhHKIwppP7ks8vyNlg6a9zDFBXzvIJKFa6s= Received: from DM6PR02CA0097.namprd02.prod.outlook.com (2603:10b6:5:1f4::38) by IA1PR12MB6137.namprd12.prod.outlook.com (2603:10b6:208:3eb::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18; Thu, 17 Oct 2024 05:40:23 +0000 Received: from DS3PEPF0000C37B.namprd04.prod.outlook.com (2603:10b6:5:1f4:cafe::62) by DM6PR02CA0097.outlook.office365.com (2603:10b6:5:1f4::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.19 via Frontend Transport; Thu, 17 Oct 2024 05:40:23 +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 DS3PEPF0000C37B.mail.protection.outlook.com (10.167.23.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8069.17 via Frontend Transport; Thu, 17 Oct 2024 05:40:23 +0000 Received: from shatadru.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.39; Thu, 17 Oct 2024 00:40:20 -0500 From: Dhananjay Ugwekar To: , , , , CC: , , "Dhananjay Ugwekar" Subject: [PATCH v3 1/2] cpufreq/amd-pstate: Remove the redundant verify() function Date: Thu, 17 Oct 2024 05:39:28 +0000 Message-ID: <20241017053927.25285-2-Dhananjay.Ugwekar@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241017053927.25285-1-Dhananjay.Ugwekar@amd.com> References: <20241017053927.25285-1-Dhananjay.Ugwekar@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: DS3PEPF0000C37B:EE_|IA1PR12MB6137:EE_ X-MS-Office365-Filtering-Correlation-Id: 96987f88-3b96-48f2-6ab7-08dcee6e3248 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: zoJQIx/pdaEn0D6G9JM7oR8NghQQ8TqDNlYZkE1r3p0RLqR8hZTFlOSEalRQHvRPKhQ/ZY8lhyCvs4EmhKBtQR5wip3GWA3vxY/BHY9x/DJfKbWhd77K9Xuj75oebdPpekC0Cp4KsFNerdOsmMTmQIYv+spSF+POuh7WAWnPE+fvfbTD/0ELY6Q88baXNRZ6mQGQGead2K0pj3Dnx9KQCmfnMuCrBCv3UBAUATI1ov3FwHGZBho9H3EM7qjXpyD9ZE2c6DAr1fNvns1jj44r2XhQt5TpWgxvJwaakhG0I2emFXyccjQ0VWyyOsKycvjHU0CbiqzlV71pSMPiyI82PEOA0yoWo9T59x/4M+ssC3h9ey6v/lP8Xe642TeTnPMOnyf/u5jS9PH0lbANbOkiQFsC2MqHV1Dfi55bJqu6zHQEeqSVbtGwM2QG6K9eW8VbjqNQDzhSTJRF4r1LqUNWMgBpTiSqGR7LDwZ5ybBT51uApUTHfPcixaD8euFhOcuZEZgiHw7MfVMgyFS5yfd9w2uOuZ9j9932xPYi4q+hIBGk+m305QXkBXi6TZwwjbGfYY0+YHS6ZxTFQ3AUtLY+eQJWR4mvhYMqrWbafIMxW2Mvd8xDG+q80Jz2mzbxy/5Nnnz6F4Pk8fENgkjCgI2aazkZKkL2Ez5/+h2IMPKEcfovFTuuE33Z9bbCoc+gj3wG3D+7M1GV4KT0R48LHjbrP/j/S7XwKOaQyMjVWV2iA4ibdDKR9Hd3yHgWrgCsmpYOm2ZjCCENQukmODFLsgDrqNKjUvBXMvFOdBBzdgHhxw2ydryNadCT7TElI156JYtiB62/5flbyjvueirCX+MJAifqreyzoSVq3LBDwE46NrAG3AmSKiTvaWITDzVPq9cC4fK/VtSatgA6EXLMuFOwlriKOip6uQUIklhPrn2sjyLss/mwdksLC7RDM1/RQuBiRsk94MedlpAwn3jus7Cn2Iq0BVDkCG29rPgups1jwUdLq8jV42j1Jwcm9M3hrYf4vAoUNY8ieFIyYle5aigNh37Z+iLTOM567BTRIsoOdCZAhgcR6L7GrWcloUhx9ZF3AYecME+BiFNuGJQ1BJag+JknKGq48z5YCNwvbvijjOU6aUA0wCu1/1mjdwGC7SwUuXgZ5t4kswmsqLP8ERVe4HO2isyw9r1VLMluUQ2STxPFhInNv9dnL1iNIpNQZ8pDa8VAfSfLsVAHxxq+13gsl7D5y2YNJjwrlejxoBOMMRTz3cpeKXWeFuWb7LrBkXPp8YI8qL/8AFHctmJ51gz0uOOlspSggmhKeTCoN6+O7LCiptcXMTaephrCfwWLRYwou9aT5rsGvylWG7gm1eSKxvE7o+Aoh39jMBgZZ89WSi+5lbjnprpy0vFoZnAdXZlUyYT4jj3wLDVOLuICS2bgRg== 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)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2024 05:40:23.6250 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 96987f88-3b96-48f2-6ab7-08dcee6e3248 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: DS3PEPF0000C37B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6137 Merge the two verify() callback functions and rename the cpufreq_policy_data argument for better readability. Signed-off-by: Dhananjay Ugwekar Reviewed-by: Mario Limonciello Reviewed-by: Gautham R. Shenoy --- drivers/cpufreq/amd-pstate.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index b7a17a3ef122..fa16d72d6058 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -527,10 +527,10 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf, cpufreq_cpu_put(policy); } -static int amd_pstate_verify(struct cpufreq_policy_data *policy) +static int amd_pstate_verify(struct cpufreq_policy_data *policy_data) { - cpufreq_verify_within_cpu_limits(policy); - + cpufreq_verify_within_cpu_limits(policy_data); + pr_debug("policy_max =%d, policy_min=%d\n", policy_data->max, policy_data->min); return 0; } @@ -1661,13 +1661,6 @@ static int amd_pstate_epp_cpu_offline(struct cpufreq_policy *policy) return 0; } -static int amd_pstate_epp_verify_policy(struct cpufreq_policy_data *policy) -{ - cpufreq_verify_within_cpu_limits(policy); - pr_debug("policy_max =%d, policy_min=%d\n", policy->max, policy->min); - return 0; -} - static int amd_pstate_epp_suspend(struct cpufreq_policy *policy) { struct amd_cpudata *cpudata = policy->driver_data; @@ -1723,7 +1716,7 @@ static struct cpufreq_driver amd_pstate_driver = { static struct cpufreq_driver amd_pstate_epp_driver = { .flags = CPUFREQ_CONST_LOOPS, - .verify = amd_pstate_epp_verify_policy, + .verify = amd_pstate_verify, .setpolicy = amd_pstate_epp_set_policy, .init = amd_pstate_epp_cpu_init, .exit = amd_pstate_epp_cpu_exit, From patchwork Thu Oct 17 05:39:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dhananjay Ugwekar X-Patchwork-Id: 837000 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2075.outbound.protection.outlook.com [40.107.243.75]) (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 2AC2144C97; Thu, 17 Oct 2024 05:41:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.75 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729143687; cv=fail; b=seomTLqDUU7gPyXg/Y7VPOKSDGMiZnzPZIMHTLyE3tbvrjo5HUNmV1TTukPg44J7WuHXRK0ctOByxYJBjqlYxm6KcBrRWcB4boNUgOjX5RTPrWmA4+uzFOZRzgKlgQb/u5CGrRB/hea8pVFv/V8Um1GtSJ6gIrFkLFt/5TrvddQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729143687; c=relaxed/simple; bh=jZ5JXoMpC6BApjj14bDc6X/KolISUFF5GKAiK6U9fBs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VTkYEajJ+WdVPf/vdNYwJLZSrS44MthDKz/507/Oeu+pZ6BmTAas2aVY5zDDrzWHpeLcOOYQDY9zmOnf6CCNw6i8qfh7nyNqhqG8QsnfpSOnt5knvuCUNoz67n8eWxCNcm/S/BGqQJSDPLP1DtnEefILNbBBHQE7xbx0+atsx0s= 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=j6GiaPq6; arc=fail smtp.client-ip=40.107.243.75 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="j6GiaPq6" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=J+db97TrFqukpeloW8Vdsert25xBvMYt5mK1Vw+OERYa2qq+WzD8ftN1GpNhGN6LBWLTM7KL1PCpsvZpDHVvLLDUG6pq30FITEN8vSfCWrdSEuQ6sRbm66YVP++9NLkRhWUrCYZdez8ervpmIx6xK9WEb9rMp4bxZ1YPWE0Lny0A5l7pDPiuDRI3dS1pShCi8+fII+Nlb7xpw+8JDENtuI9wAh7AfVqeqAEAfyNTyTGdK6DjtLvn1aEWXvGkTf7+dh8jrATF2x2BwSQRASpUv+JqMHqvaPBMDiDreCU6SYYVVKpMav37jImibLLVphZAVXuzcbrK8ELEhwMpT3ZsTw== 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=ddgOrU+Tz4uN3jKaCh3+P49Xv6ph3bimdKDgzkvibXA=; b=RDJMVsiAhmRhJNlL1p2zzy1IUvqjRaoNv610i7AE5nzX62XNo5BWOiDu0m/SKz6B4+vEtZHQUiAgEchaws2N7cZSJArDz2KHsTGxMrMWybQ0M8zqb/grqjNoTCr71Pa9F87q0Y8nalGaqtzCkTEkarzbtnpe6iYYOoKcAIupkLuXMdtQFG83NoOek0Z1lSJJHqVFVZYRn5oBj9p/GNRUEBbxN/En8/wzTrw//BbNfmw4iluefbRH5KgvT8gCJwv6o2lUMFQHdnuVQtXH0g7/rEoS9P8x8+f3OMom9KYIqvzUFPCIkluT4cYpV5iToG59A0cRlJdA+1owHLC9WM5apQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=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=ddgOrU+Tz4uN3jKaCh3+P49Xv6ph3bimdKDgzkvibXA=; b=j6GiaPq6jEzDWNv+J0BWzin7hlB95ah4I+F5bCiHKzbQA3a0d+euE9IPAJZGBmjzmCO80pdDBo7ER0puVt8Pc/iwDmue+C2rrAoQ0P+bFiwVm+F1IIvLIrfMIj0czCkOnbmvHtOFC2MXrRHfBKK4QaLMBRVIeDFzh5FJJFZzzEA= Received: from DM6PR07CA0123.namprd07.prod.outlook.com (2603:10b6:5:330::24) by PH8PR12MB6699.namprd12.prod.outlook.com (2603:10b6:510:1ce::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17; Thu, 17 Oct 2024 05:41:20 +0000 Received: from DS3PEPF0000C37E.namprd04.prod.outlook.com (2603:10b6:5:330:cafe::1b) by DM6PR07CA0123.outlook.office365.com (2603:10b6:5:330::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18 via Frontend Transport; Thu, 17 Oct 2024 05:41:19 +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 DS3PEPF0000C37E.mail.protection.outlook.com (10.167.23.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8069.17 via Frontend Transport; Thu, 17 Oct 2024 05:41:19 +0000 Received: from shatadru.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.39; Thu, 17 Oct 2024 00:41:16 -0500 From: Dhananjay Ugwekar To: , , , , CC: , , "Dhananjay Ugwekar" Subject: [PATCH v3 2/2] cpufreq/amd-pstate: Set the initial min_freq to lowest_nonlinear_freq Date: Thu, 17 Oct 2024 05:39:30 +0000 Message-ID: <20241017053927.25285-3-Dhananjay.Ugwekar@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241017053927.25285-1-Dhananjay.Ugwekar@amd.com> References: <20241017053927.25285-1-Dhananjay.Ugwekar@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: DS3PEPF0000C37E:EE_|PH8PR12MB6699:EE_ X-MS-Office365-Filtering-Correlation-Id: 9763d0ea-924e-40d4-6674-08dcee6e53a2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|376014|30052699003|82310400026; X-Microsoft-Antispam-Message-Info: K692eTuyRSWx+QUVO1yjrVjmM98GAL3Bv7BXtpOIZcPUHQf6RF9h3OqxLNDww7DbTgpPhdniY1lhRO8bazgo539FAHzdHKnf7SLSUe7zx/muWp8yfsGPQhc9lFBf0jfeQQvkrXER3mxxj7fJJ7+3RhiZxpgEFqJSf1fmlSagIL244IlNPijcljamrkWPGG1tStbvTOZPFEMNmjMeTralWqE58LVwVeaiLZniCG807qghV5QWZQ1F/vIY4oaOQHis+FpidId1VCE2nt40dqwte3CywBQ0SgpO6MY3BII1udDoIp8juPPddl6zN/X3LhrhQ8IdeW+DXUc5B/mZoMQF1dtySNQ+gyfvtv+hEwGueUAmGFIGYxvqT9Lojmq7nTJyDbjy3rDKWKskPW6mK30je0zuIN7Mf5bE5xGMS/yGrjHq+bt9LB6WHY5NRYkA4KwqZe889i8e7u5sRjyfC9J/GobYoYFuSdN4qHFY9Xk0eqsjTFUiR0sK9FnGapAlolC3SLqgkP9wyiGCvbwAuZ43rqmn+6eelNfy3vrkFdmOyXzkcCEUAiJJSFiyPoZtjLXq4HHbddGFjDH0H+9IVtoZXW8itWCPiOOtwReayvbrCpNVmYFjJt+bU1gYuN1mHH5GQ5HYhnUij1xihzudSpvVlM0wI6EkX8igsi/uNdH77AysjvXowMjf5EwEJH1s6rIKH56UaRBVJFXCgBvoo07mye2Cd7j9X9qpQPfVJbVY/C1Axbg1Dur5kAt6cw21WuDth0587knOHgUkHUFS3KMeg18bX1aGLrYO1v3Kg+SQ8VmKtGOUg/uuA8ha1p7cEAPGSZP1vmFekwqUNUFYoCCQWQg2IgI2fjsLYtfn9COZSClPKGkzW7e8I3a9qH7HPf9zjst9VuIR3+AjEN+nxSvt7NZtXK9oWie7OjGpPPdTkmGrd1vTN86bWRgm3EfV9o1/EcfDr3/b2W2aMcWv6nWtZQQKQbdta+MelakRljWq3QWGI4oOT1nriXhh9cv27+TWNLqw5u9dfeOTK4PRqQCO4NCvnvEjhm6etYVMjuBrbtAszsUBbMJ9Wu6MbBattJ958EnUc78lD7q5MQYqN8TI9B1mKgWAyGRyykwtsylIKfEyjHWhI7gP0N2Eh1TNEPQeVz4aetwDkTkDBWC4FVER1hTzubuxvQ0WI83Q6rdSBGmKSaHdAXuJAzs5CXkJxR8UU0LorE+jxF17QJIVn+MVHpBt/mpPeRqouQBfO+FTUh/dT+5i8KBSULEAPhtMZBB0WpZrollvEdWrgRxWEq3JnbmxFS5uWYnd2/9XegOddsGntFuIcNhTqlExXZJGn7yMXS2qWLuaLldUFOCYXkQjetoDmnHcqDfe0jCoNXZmuuaW60RhVJZx7l0xD1Zgf5zhh3Wy4DXP6teHkOipnJu/dw== 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)(36860700013)(376014)(30052699003)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2024 05:41:19.5639 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9763d0ea-924e-40d4-6674-08dcee6e53a2 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: DS3PEPF0000C37E.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6699 According to the AMD architectural programmer's manual volume 2 [1], in section "17.6.4.1 CPPC_CAPABILITY_1" lowest_nonlinear_perf is described as "Reports the most energy efficient performance level (in terms of performance per watt). Above this threshold, lower performance levels generally result in increased energy efficiency. Reducing performance below this threshold does not result in total energy savings for a given computation, although it reduces instantaneous power consumption". So lowest_nonlinear_perf is the most power efficient performance level, and going below that would lead to a worse performance/watt. Also, setting the minimum frequency to lowest_nonlinear_freq (instead of lowest_freq) allows the CPU to idle at a higher frequency which leads to more time being spent in a deeper idle state (as trivial idle tasks are completed sooner). This has shown a power benefit in some systems, in other systems, power consumption has increased but so has the throughput/watt. Modify the initial policy_data->min set by cpufreq-core to lowest_nonlinear_freq, in the ->verify() callback. Also set the cpudata->req[0] to FREQ_QOS_MIN_DEFAULT_VALUE (i.e. 0), so that it also gets overriden by the check in verify function. Link: https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf [1] Signed-off-by: Dhananjay Ugwekar --- drivers/cpufreq/amd-pstate.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index fa16d72d6058..833fc17a39f2 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -529,8 +529,27 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf, static int amd_pstate_verify(struct cpufreq_policy_data *policy_data) { + /* + * Initialize lower frequency limit (i.e.policy->min) with + * lowest_nonlinear_frequency which is the most energy efficient + * frequency. Override the initial value set by cpufreq core and + * amd-pstate qos_requests. + */ + if (policy_data->min == FREQ_QOS_MIN_DEFAULT_VALUE) { + struct cpufreq_policy *policy = cpufreq_cpu_get(policy_data->cpu); + struct amd_cpudata *cpudata; + + if (!policy) + return -EINVAL; + + cpudata = policy->driver_data; + policy_data->min = cpudata->lowest_nonlinear_freq; + cpufreq_cpu_put(policy); + } + cpufreq_verify_within_cpu_limits(policy_data); pr_debug("policy_max =%d, policy_min=%d\n", policy_data->max, policy_data->min); + return 0; } @@ -996,7 +1015,7 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy) policy->fast_switch_possible = true; ret = freq_qos_add_request(&policy->constraints, &cpudata->req[0], - FREQ_QOS_MIN, policy->cpuinfo.min_freq); + FREQ_QOS_MIN, FREQ_QOS_MIN_DEFAULT_VALUE); if (ret < 0) { dev_err(dev, "Failed to add min-freq constraint (%d)\n", ret); goto free_cpudata1;