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.56.21 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796118047; b=ezPGoFqnIvuXmMItJssLQmgcHAKiSPKRCDD2+yRgyRlTbwYMPYRonB2TGT4Rj7lN+W/P WHobQLpTbcIxHxTQ4egBIFjecJlfDFT5Ri7aMiK4GutzPfqPyhl6gFTEV+qiAmawiWZ/p bx0KWo8k7cWVEhKdJN1G992ZoLbBv/pm8bt0UhMnEzLFaSRlwr+UvgdkjgrQzSEJHHrvi Ir4IYyJn8iLAolhZ16gzYNcJu9sLNyH1QKd+NQHmVBGdWFBLK7etJftTmXSH04tDRedhD onbOM1FCqnDsf23EkxK8dxo1vL+CpS4OxHDJv/Zg2jCM673V2M0nQpz2u4DQMQ9gFsA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796118047; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF: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=j06t/O/Jp6DrYCYv9zneaUazJvSJecLv5nleedppTs0=; b=V1R0J/U8Od3Pz7DhkOnFuCTqX/HXddoUYBEtNflUj31xDtnUiSlEI5m1dU9HjlfFI4xn BFQ3Qr7paN8RgRakxfG3uWzKFbQl+fv3yEaWbfp03+i2SkYPd0N+FbgJiVi7MzretxbYW 4W2RB90yn/x/uMgiIuoUlTZWPIqMXVeXLuW7Q+71W5VM5ZRwBf5xFA72Uq4LrCWYfI+n5 6RY5sJx6QvPlOLFWnTXTNW8Dluv64b1k+ExHb+ikmBB9dVPYtBudVAvjLQFOzmNI/7kum TTHhMpPnI8M9cZQAm+yLyUmauH37pEWLhH3gNyLxwd498qlxjQgB1XoyAdlLXISkenQ== 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="kosh/z+t"; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.56.21 Received: from BN1PR04CU002.outbound.protection.outlook.com (mail-eastus2azon11010021.outbound.protection.outlook.com [52.101.56.21]) (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 C1B9B606A31A; Tue, 1 Dec 2026 09:40:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C1B9B606A31A 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=kosh/z+t ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XGX7ScA3G2lZGJ4AwzSrg8JgBePwk5SWMYrv/2JKeROqzz6TDDXaJKyQ1sKe7ubfvBTNz++XM/2hotIyes3oH6FeWPkXtUbsZoAsXG9WWCTnBPpvzkJSQ1IxpIO0iJGaE+JedyjMuWQ6pomS66tQFYf3l5tA7Y+qkeDRjCQX0vAqyD+RmaFIHOjXisQ+dwRLrJrrHSAe9mKGUupGbmK1x0eiCljnsXNd8AH6cNKDDDByC/TOaaf9c3uAwcuZ7VGJP7ERUg3OM5wHzh1dBQ79kDX4o1P5XlqT18S+B9wiZSo4Vni/tKUg0c8owuzDY89mmqfzYEMj2X+uICE3hzjjIA== 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=j06t/O/Jp6DrYCYv9zneaUazJvSJecLv5nleedppTs0=; b=bd53aS62FS0StbofrVZeNWwcXpoOEWkkBoilLcOxhn7M9wC4f9iqhi7P2TMiIurlHBcEgORmo7hRhdoe/Z1JZ6ELYA6RDH13teWoj338ojIMQ+VQDnCCj+R2bGSFJ8jN29vLlcco6jsdFJsvqvx3MSlfweSR09v6Y1XaAe3amhAw7vcV/Y5w5VAjjlUBxu/dCg74hL+T/FiYmbmd5XLUEdKS1OHeE5jj9EF6ipCkXUBA0keQq5phdZeDvr4zz+cpHlVM77eMR6LAh8idL5xfU3me1MqObtpQRP+l2qDgzp4/5RUA0cLyBOV1S6YOrOkowiFH9IJuf7Nf84YOLLON7w== 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=j06t/O/Jp6DrYCYv9zneaUazJvSJecLv5nleedppTs0=; b=kosh/z+t6c0q9faAJ2P2VZmHU75aXzRDifdRRWb4NPedvFrRMl+Dc2oZWKeUZqbcFuf9rcdfOfgcBh64T0zRZvuJf2r/8Hqpm+XBVY8yA5JJIJzEiZYbZmUG0R66UPnxDaLK4tH04CWJcndE6YizYeO0V7pAPEWj1sCt15wN0Rg= Received: from BN9P223CA0013.NAMP223.PROD.OUTLOOK.COM (2603:10b6:408:10b::18) by LY0PR12MB991900.namprd12.prod.outlook.com (2603:10b6:404:215::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.13; Tue, 1 Dec 2026 09:40:41 +0000 Received: from BN3PEPF00022BCF.namprd03.prod.outlook.com (2603:10b6:408:10b:cafe::50) by BN9P223CA0013.outlook.office365.com (2603:10b6:408:10b::18) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.662.13 via Frontend Transport; Tue, 1 Dec 2026 09:40:41 +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 BN3PEPF00022BCF.mail.protection.outlook.com (10.167.248.170) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.5 via Frontend Transport; Tue, 1 Dec 2026 09:40:41 +0000 Received: from satlexmb07.amd.com (10.181.42.216) 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; Tue, 1 Dec 2026 03:40:41 -0600 Received: from [10.136.42.27] (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server id 15.2.2562.57 via Frontend Transport; Tue, 1 Dec 2026 03:40:38 -0600 Message-ID: <3aea8e22-6721-4dfe-8429-a22d59085fed@amd.com> Date: Tue, 1 Dec 2026 15:10:37 +0530 X-Mailing-List: linux-pm@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> Content-Language: en-US From: K Prateek Nayak In-Reply-To: <955f1ea8-65da-4100-93dd-11bfebc4954c@amd.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF00022BCF:EE_|LY0PR12MB991900:EE_ X-MS-Office365-Filtering-Correlation-Id: 826f5614-9254-4bf1-7e69-08df4f8f2a1d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|1800799024|23010399003|82310400026|376014|921020|10067099003|56012099006|261028144727099003|261026121527099003|261026140227099003|261102123227099003|261022075727099003|261022105027099003|261021121427099003|261009223027099003|18002099003|22082099003|4143699003|11063799006|6133799003; X-Microsoft-Antispam-Message-Info: 9EcZVneUGYz7hJYY6se+HD/R0cSTWYyM9H1LXNHgpj+MqDS+PTc/appaZ8dSGUGpNEg/2MPaUTibWknGZqoe7fQaLruR+qrgVmOCzQSJOe6mf3C5iLHp+nWaie68yvs7kBRJmUKGZwCmPHHE7OFSUPSGznfjSX/sPHaUSP4f+9+ubwef+wfb5GTDRDo2HguNNvnpzoEJxc13Orv+FNFG6d/lUhnpO/8yPPkiTab4G1ROEu/zzlLvCvgxz9t+NcnQ7bPLu9eGacck3epg5RlTOoXfiytHkNVs1io0al15IlvBUl5nhVt9jaUzDOFCzBgA5EQl9tWUmmPNnkJUIIEqfhICOUPtY2WRMCfeNQIKcVWOrZ+dbojyxGXbnSl9OAJ6Bk09jKvvQwGc8X5C6twACSFG2VYdhDQQczKKUlCn29ksm6A66T9xtwS/cNU+rThebr3V8NKL51TJD5dDjWx9U2ynQ3qnxDfZ7PhSpncxTNMLWfuIXkPbYEptNLxUZZwafUHN1zPrE/838weDYnBe1LpaDMx3Gk1e1X06C8le145LpIriuObrbXgE5r/GbDJtLoiDWORMCCTGy7nwGHEVZXeQ02qK9logiMqDCgISIichWNgY2MwUig7Kw5HeBTdwsnnjUskVFN0eMAkImYDWYcPUefinwm+nX9h237majZcKAdDbd84v3Muj7ET8PrX6gy8+cZXNlRx7VuKHTzgdjvp+1suIaKB9SU1IyxTDSpvTse3HQEs8L4JWDNVgqV20 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)(1800799024)(23010399003)(82310400026)(376014)(921020)(10067099003)(56012099006)(261028144727099003)(261026121527099003)(261026140227099003)(261102123227099003)(261022075727099003)(261022105027099003)(261021121427099003)(261009223027099003)(18002099003)(22082099003)(4143699003)(11063799006)(6133799003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VW4anbxe25/uq5+ON1K8djIUgS82R53YraAXG3f3e9On3DSIn3sDg4EGGoq1M2Lb7yJAvyx8+Ptp2fh3qHcKYmKUYAoLdYlkDa8GTE6QDGXCtIVkZhwzI8l+M53tafQ8jpzvjqBJl/51KEXaRFgNwTgQG2Cq9CyyepMiDZYO+FJir80eAjSKdv0pHKtn8Q31vWyFRs+cl1Gdhb0qvhBFDh4FAdHkpJdIyzU16DlkjH6NktQvGWWnCEJEiwc3z1Hj2oqLziyOIDeGRNVcOTXzm3G1aVlxak2koIk/h3goQ/PPCwipAJtHoy3yYnTXBBHplBVD1p4NCUBixwKYGch+al2avzv4RvS75RkF4MqJ/hEK1kYgKMfW/KlSwUFYFohBnDnbu7Qdj0Yc167kVL8G/l5sR0c9EBmKEBSpvM+PDNNwBSebDpl8NQZnaASOKHAy X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2026 09:40:41.4966 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 826f5614-9254-4bf1-7e69-08df4f8f2a1d 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: BN3PEPF00022BCF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LY0PR12MB991900 Hello Vishal, On 12/1/2026 2:48 PM, Badole, Vishal wrote: >>> +static void amd_pstate_update_cpu_capacity(struct amd_cpudata *data, >>> +                       bool highest_freq_available) >>> +{ >>> +    unsigned long capacity, max_capacity, capacity_freq, base_freq; >>> +    int cpu = data->cpu; >>> + >>> +    lockdep_assert_held(&sched_domains_mutex); >>> + >>> +    if (highest_freq_available && amd_pstate_ref_freq_khz) { >>> +        capacity = data->max_freq; >>> +        max_capacity = amd_pstate_ref_freq_khz; >>> +        capacity_freq = capacity; >>> +        base_freq = max_capacity; >>> +    } else { >>> +        union perf_cached perf = READ_ONCE(data->perf); >>> + >>> +        capacity = perf.highest_perf; >>> +        max_capacity = amd_pstate_ref_highest_perf; >>> +        capacity_freq = perf_to_freq(perf, data->nominal_freq, perf.highest_perf); >> >>                  So this is literally "data->max_freq" >> >>> +        base_freq = perf_to_freq(perf, data->nominal_freq, max_capacity); >> >>                  And this would likely be equal to "amd_pstate_ref_freq_khz" >> >>> +    } >> >>          Making both those branch pretty much the same. Why isn't just the >>          frequency reference enough? >> > Yes, when maximum-frequency data is unavailable for this CPU, this expression is equivalent to data->max_freq, which was calculated using perf_to_freq(). > > However, that is a frequency estimate derived from CPPC performance values, not necessarily the CPU’s actual maximum attainable frequency. In the frequency-based branch, data->max_freq comes from amd_get_max_frequency() and represents the maximum attainable frequency independently of those performance values. > > On older hardware, the highest-performance values of 196 for performance cores and 130 for efficiency cores aligned reasonably with their relative maximum frequencies. On newer hardware, these values are 255 and 252, which no longer reflect the Fmax difference between the core types. Performance-based scaling therefore gives almost equal capacities, whereas using the maximum attainable frequencies gives capacities of 1024 and 718. 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? > > 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 and Regards, Prateek