From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.52.31 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796266607; b=gqfSk+vD2rv4h3KDgl1Gu+XZCUBDQCIFBlbaSibAyxoKymaWlBNkVe3DaW5Fh5zeWxnV 0ouuaFQ+nyFqJr7z3c10+/oQ+YTcNX/VfpSyuKkw/QDUWynupbCivava7iv4Sj04skBbY KXWYw1qljUIUEs+zVV1eQXZKPWFOwoAbjWSZwYw32bI072ea6LKcWF6GUkqIX6mckMbFG cf8N9M+Kzx24mrCxkNMYE/ZdZ5USpDHKBi65ytPnBkwchJuq8QMIKbHv6OiZtMDOvp8Vo ChVU19zqRWCqep2VNVNpmRQgHxyE8P6A1SCREQsyMXsyzQRiHc6hczTEAJaraX4TkRA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796266607; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF:Received:Received: Received:Received:Message-ID:Date:MIME-Version:User-Agent:Subject:To: References:Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:X-EOPAttributedMessage: X-MS-PublicTrafficType:X-MS-TrafficTypeDiagnostic: X-MS-Office365-Filtering-Correlation-Id:X-MS-Exchange-SenderADCheck: X-MS-Exchange-AntiSpam-Relay:X-Microsoft-Antispam: X-Microsoft-Antispam-Message-Info:X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=WWKqsdUfzO72BL32uiVHugmtptPQrZv3g0NAiydwXX8=; b=LbOc0TsL+TJP0V2odfkMU9HUwT3pup9tcBEKv+lTI5EbXzBCiyRrKoTl3uNiMp9K0db3 Cp2p4Wgaw7b+ansfCyxzJzOq9laUqvPjXltnm4UoLh4hoMekefUJO+19jVBKf2CMcLOep LdHpHyUPZ2fFMtRrHpeazDrvl3vuyTw4bhywp6rhNhQr+ajjvukvva7W2SCEkTU8NvLlw 6VRg2DKfUKQKa+tUwuCZa0ZS6NymzAre4QAt1W2MV89kM/Bjh2AzTfC/WQ+3xKOVb0PCc 2QGr7YVRHsSdqGYT/Y8wuDxpxEjwe1ZjLmGsvNoDPFMKLUr7J+t6ogh5TzTyjx3AjOw== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=ALEBxdmo; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.52.31 Received: from BL2PR02CU003.outbound.protection.outlook.com (mail-eastusazon11011031.outbound.protection.outlook.com [52.101.52.31]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4DBBB606A322; Thu, 3 Dec 2026 02:56:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4DBBB606A322 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, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=ALEBxdmo ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hkT1US50LNNMIrdmTwjBFMUdHeV1a+itK4/+7ff5C2gUzmnGWwrTlJTVBjsggQxpNyzf3kzp55E03IIrjmNHTExDhm6GWnlBvQ0bOza63lIV09CB0ukOhAecxH6eXyW2v3y3AoDF4TxwdHjUJF3n9dlnKSyU6NbZbdDCVDXPSTTj56lSHrqMaFbMTFiwGNmMNOQkatWKlOscUVTE2slJ/fTXdRteRA5b7WR2J6BTF9U4cmEyKvStr9mLVPYMA63fhV5AROoIxHMp+T8vUaE9oCYw3b6Sb6z1ZwVPJfHDwpcQIUaXVa3QNCuYJReQkxOVOVzJ/RQUTrjOa3Tg8ZD/Bg== 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=WWKqsdUfzO72BL32uiVHugmtptPQrZv3g0NAiydwXX8=; b=c0mwnJ+EQD6by7s9xvCgmUQtwqUuEK0MNMqxQQ1CUYltWVuJ04kHiMQqoLTJEX4EBppOT2hjDaKbJm3uGDQS0cL2ghdE57btrgd0MHJpCkmiPhTlXrt384W1uWzK5iXd+3y6OiFxSz+0Fzj9yNAnXEgkL5EpioeUl8Ate9MrmRwC3wMwv/J7vqQ2xoIoZ3TycanLVQD88fGZ4xhe1x2+ov2a4u5ZyqaT8RN48pJp7k6zqaYRmLsqeruu7Qz3vpoexpuokYyHlAb/eZP9KXgEajFfnvnjCSDh6xs2DF/P+q7UpJ5koICArzfTEHQ2hKpxRwFuHaQ7dKKIsb0prBmY7w== 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=WWKqsdUfzO72BL32uiVHugmtptPQrZv3g0NAiydwXX8=; b=ALEBxdmoPB2r12LNuncRXekmDxNTBRMg982ffSi9qbHzFrU8ZFyMOH7Fv/gt+UnhweWLKK70s/lMEUsOM4SdrSow7VYrqfKWrYFND0Ks0uLk/Mx1YkCfFBqpe1wxEDThtftU4jIvjvkClXsdO6FKrlZyWWa3gI8lwfPXvMI3M+o= Received: from PH7PR17CA0002.namprd17.prod.outlook.com (2603:10b6:510:324::22) by IA0PR12MB7505.namprd12.prod.outlook.com (2603:10b6:208:443::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.11; Thu, 3 Dec 2026 02:56:41 +0000 Received: from PH1PEPF00062F2D.namprd03.prod.outlook.com (2603:10b6:510:324:cafe::90) by PH7PR17CA0002.outlook.office365.com (2603:10b6:510:324::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.12 via Frontend Transport; Thu, 3 Dec 2026 02:56:39 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; 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=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by PH1PEPF00062F2D.mail.protection.outlook.com (10.167.243.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.709.6 via Frontend Transport; Thu, 3 Dec 2026 02:56:39 +0000 Received: from Satlexmb09.amd.com (10.181.42.218) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Wed, 2 Dec 2026 20:56:39 -0600 Received: from satlexmb08.amd.com (10.181.42.217) by satlexmb09.amd.com (10.181.42.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Wed, 2 Dec 2026 20:56:38 -0600 Received: from [10.136.42.27] (10.180.168.240) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server id 15.2.2562.57 via Frontend Transport; Wed, 2 Dec 2026 20:56:35 -0600 Message-ID: <892e8f3e-5b29-43f8-8cfa-04ff4f8fdad3@amd.com> Date: Thu, 3 Dec 2026 08:26:34 +0530 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/3] cpufreq: amd-pstate: Set asymmetric CPU capacity on hybrid platforms To: "Badole, Vishal" , , , , , , , , , , References: <20261125172031.741740-1-Vishal.Badole@amd.com> <20261125172031.741740-3-Vishal.Badole@amd.com> <7fb17998-e523-4264-91af-0af3c25b0143@amd.com> <955f1ea8-65da-4100-93dd-11bfebc4954c@amd.com> <3aea8e22-6721-4dfe-8429-a22d59085fed@amd.com> Content-Language: en-US From: K Prateek Nayak In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH1PEPF00062F2D:EE_|IA0PR12MB7505:EE_ X-MS-Office365-Filtering-Correlation-Id: c96a5e3d-bca7-46fe-d680-08df50e90d90 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|23010399003|1800799024|82310400026|376014|22082099003|18002099003|921020|10067099003|56012099006|261028144727099003|261102123227099003|261021121427099003|261026121527099003|261026140227099003|261022105027099003|261022075727099003|261009223027099003|4143699003|11063799006|6133799003; X-Microsoft-Antispam-Message-Info: j6w2f/mRMvDrxgLUyMAS0jLy13ygSkgzGB7UotonsKZI4Qr57RAsVYrPF6xYhvPfQl8xN58tzq3boqdYTO552arTNDOWAf+8zt3L4s8dQwwX/LrFcqwY3p3P4kuTc+iHt7917J/OLmnACPN7aKttYK3/XIWhcD+3TbsQL7WmpgySCG/x9VaPtx5g/LrEY9ixeqh1nn1AwWD85QdiiEQevaQC6bMRqFEaF/13OnihOWjiiK9k2H5hm7q7oOB0MWvahJSFnghiXfgqMsNVbZG89jjSH0CuwdlCVErZo1l+/0DMPyMPE2n92VXianQim4Yq1nVqtIVDPOSYuxxs2503Zh+RnmvtUZQxnsDl697n6GQydDxBIIgi/cdZFmCz3al4eNSKM76P9o42YVnWcsPuibYJU8By5SPgtNHBE8/2pacAT13aeGltpEWKvv/AktTNcWw/+S7dIBaOPR0I+tYLwjRfYbL6d9q9Cl6jbUzMZ1S7l507KBQoidEpIGr287D/eI3zqr7/SO1xnEqjCK29GWrdvVZZ/pxoIsxn+ufcOxAUuo/1o9rvAVuYPD+nQtJveQ0eLM7MIm/hxIv/8f2sX8gYOpQR4Irk3X0FVh+gd6iNI2CTvuHgAtzVLazlh4bp2Av4JlX5v+34hgvzttzn7G3gTV0CquRESx9Xluwfs/O/bSAk+Od2iVxzC0WOMC7nnH5moSqIAVSf+XoOGzC16SrqnKaRtjbElGLKC9Uk+ir6Tm6lhEhvuGBeiqUvDFpF X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700016)(23010399003)(1800799024)(82310400026)(376014)(22082099003)(18002099003)(921020)(10067099003)(56012099006)(261028144727099003)(261102123227099003)(261021121427099003)(261026121527099003)(261026140227099003)(261022105027099003)(261022075727099003)(261009223027099003)(4143699003)(11063799006)(6133799003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 18rzOdPfLMqiX+f7YhZGwjo7apORiBSyTi3p0VHJQCV+DDPDSRwTngrB77ni+fD6CWrGcl7j9jqGHJNkzI/e2DIfSmwKwUgs5JgOPz1MfvfQKtpoavXJHhFUvASxWb7CHO4+8RZ0vukMzodYNi2PSF9aLjYScECi3YajvyCN2yup+JWrOuY1xIoN6AW/Yyqjgu8AfKlA39By5zoMzDnCjNkw7fZriv7cLOr1LPXy8w8kuhybdy+MncAv4LM7nO8InLe+7TXr1j8o0q6c5NIel3R2Xgqbco/BtXftNdHyBNnXtS1udVksMgNrMUHnIxTVIwWzwDIgcuEhlRKWiQJRhoWW4lTseM5HiMLYpgRK0kDupRwVSBFNGb49atU5SQ83QjXc51Aj/e0NXCTO/A6kzJxT5UqdiVBsqLhQ7f/qFgAFpyTNfjzjRsenYNrqYvYs X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2026 02:56:39.4310 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c96a5e3d-bca7-46fe-d680-08df50e90d90 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=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: PH1PEPF00062F2D.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7505 Hello Vishal, On 12/2/2026 4:53 PM, Badole, Vishal wrote: >> So in amd_pstate_init_freq() we have: >> >>    max_freq = amd_get_max_frequency(cpudata->cpu) * 1000; >>    if (!max_freq) >>       max_freq = perf_to_freq(perf, nominal_freq, perf.highest_perf); >>    WRITE_ONCE(cpudata->max_freq, max_freq); >> >> >> "cpudata->max_freq" calculation already accounts for this branching and >> looking at the max_freq across all CPU is enough to capture the new and >> old systems right? >> >> New systems will have "max_freq" set based on amd_get_max_frequency(). >> Ols systems will use the difference in "perf.highest_perf" to calculate >> it differently between performance and efficiency cores. >> >> What am I missing? >> > > On older systems, frequency is calculated from the CPU performance > values, which remain unchanged. On newer systems, these values have > changed across CPU types, so the maximum frequency is obtained using > amd_get_max_frequency(). And that value per-CPU is cached as "cpudata->max_freq". You find the largest max_freq across the system as the reference and you use the current CPUs "max_freq" to set it up: arch_set_cpu_capacity(cpu, cpudata->max_freq, reference_max_freq, cpudata->max_freq, reference_max_freq); Why will this not work? > >>> >>> Also, the fallback branch can be entered when only the reference CPU lacks frequency data. In that case, the current CPU’s data->max_freq may contain an actual Fmax, so it is not always interchangeable with this perf_to_freq() calculation. >>> >>>>> + >>>>> +    arch_set_cpu_capacity(cpu, capacity, max_capacity, capacity_freq, base_freq); >>>> >>>> ... >>>> >>>> And that means they'll have same capacity, but different frequency scale. >>>> That reads a bit wrong to me. Different frequency scale will help cap the >>>> PELT tracking but the CPUs themself will appear as same capacity which >>>> would do the wrong thing. >>>> >>>> What do these highest_perf numbers look like on real hardware btw? >>>> >>> 255/254 for performance core and 252 efficiency core. >>> >>>>> +    topology_set_cpu_scale(cpu, arch_scale_cpu_capacity(cpu)); >>>>> +} >>>>> + >>>>> +static void amd_pstate_set_cpu_capacity(struct amd_cpudata *cpudata, >>>>> +                    bool highest_freq_available) >>>>> +{ >>>>> +    union perf_cached perf = READ_ONCE(cpudata->perf); >>>>> +    int cpu; >>>>> + >>>>> +    lockdep_assert_cpus_held(); >>>>> + >>>>> +    guard(mutex)(&sched_domains_mutex); >>>>> + >>>>> +    if (perf.highest_perf > amd_pstate_ref_highest_perf) { >>>> >>>> Btw there is other side to this where all CPUs of the highest >>>> capacity are offlined and you'll need to recaliberate the >>>> reference again if you have efficiency and low-power cores. >>>> >>> If performance cores are kept offline at boot using maxcpus=, the current logic already handles this by selecting the highest-performance online CPU as the reference. >>> >>> For runtime offlining, I don't think recalibration is necessary. Offlining performance cores does not change the maximum capabilities of the remaining efficiency and low-power cores. Keeping the existing reference preserves their relative capacities, even if no online CPU then has a capacity of 1024. >>> >>> Is there a scheduler requirement that the highest-capacity online CPU must always be normalized to 1024? >> >> I think so: task_util() can reach 1024 as its maximum independent of >> CPU capacity and the misfit check does: >> >>      fits = fits_capacity(util, capacity); >>                            ^        ^ >>                      Task util   CPU capacity >> >> CPU capacity is derived from arch_scale_cpu_capacity(). You'll always >> trigger a misfit but won't find any better CPU to migrate to if all >> your reference cores are offline and you've not updated your >> efficiency cores to 1024 capacity. >> > Thanks for sharing this information. > > On the AMD platforms CPU0 is a performance core I clearly remember you saying that might not be the case. If BSP is indeed the most powerful core always, you can skip all the for_each_online_cpu() loop and just consider the CPU0's max_freq as reference throughout. -- Thanks and Regards, Prateek