Message ID | 20231009024932.2563622-1-li.meng@amd.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp1621728vqo; Sun, 8 Oct 2023 19:50:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGkutE9PjQ2uGUw1HEEXEPdJMiAKsdEMxpusWqpspLp9LagSFln016WvoICqdkh5v0N7Wpc X-Received: by 2002:a05:6870:2315:b0:1bb:6485:7988 with SMTP id w21-20020a056870231500b001bb64857988mr17239603oao.35.1696819839973; Sun, 08 Oct 2023 19:50:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696819839; cv=pass; d=google.com; s=arc-20160816; b=083uqoSunkM6wFeGhG8UCwJ9X8CeuKAUa3LnBB7fCsjlUd53Mzfi3AGZ+9hzZzN2qO l5zV7d29Wdm3QKmatX2844kIf7ocRIacXH5lqhHsS3L3NwazK+8LhNbF/eRuGafhLkQy D8ysy/J0EbmZOrsKLVKnmfiHmVtVRvag/TeeoR22BC5SyfFYOJTw9LPsuKjRKALn+cvS v0AmYb4ijU+gfHpGKTRd5igoTqC9iDaeXXjIY6gtKRZWEu0ncKjuMKzySDsQoJrjNyfy Lp/Tkfw+R5T/idw+OiZCXfQwebHfm7Uevhed1XnIBR+MR2bV13QS8R626+BGcKp689IA n8/w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=F5Hayc1H1AKOfEqLFqaTG1oIViw83FqMWU0AywWnwG0=; fh=Ux3YgDYVPXDd/Bh2648Da5vJU6LEkGipfecwSr9Umfo=; b=OnIdQ/Y3AWB/P6Lc6Ve0ttz3gZxN2aWiQ/3RQ31SWY6T7uFfsURJGzLOwf0UH+C45u YdUza/RQJrR2yhYGJanigokYC7QaRURBip17XbSE4peP/2BuC5nrAraB5aOo76i70AV0 EXrzQdCdrYnpDfSX0lhvQasP2t8MCIpzz7XLLSDshZCmR5ynOJdX/KNZo3fRPVcO2cuh efc1q0yTHjb3VehGbt5xAypnqDQhLrNS9yX9eTBSqrqo62pU3TNSkbp7o0Dbr5vlfKu7 aswzN5MmBWU2EeM6YRohTTD7o6MGsnfa5Koq1QaeLR2R6QJBeLGIBjELxlTbR6Vg1XdV xvnw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=IM4JVZL7; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id v2-20020a056a00148200b0068fb5ca50cdsi6774776pfu.126.2023.10.08.19.50.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Oct 2023 19:50:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=IM4JVZL7; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 320508099CDF; Sun, 8 Oct 2023 19:50:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345033AbjJICuA (ORCPT <rfc822;ezelljr.billy@gmail.com> + 19 others); Sun, 8 Oct 2023 22:50:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231542AbjJICt7 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 8 Oct 2023 22:49:59 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2072.outbound.protection.outlook.com [40.107.96.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83173A4; Sun, 8 Oct 2023 19:49:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E3GpHuGNqGcOAmSCkKi2BxQ+/82no7gMXl4e3eKsqfpGY/dj46n75j7HaP9BCJOJ1p9iTKx3bg20OTlwiZOlfN5L8U7MDfo4txpFWhYez0a9dOxp4p9BX+bwJvWe59o+Z8EdVAKxtAWKbS5JU9BNXUCsHneKHzg3MviZL5yOGcrcz+ekFZDL3tCwSUm0UxJc43MpC4OCJGHjh/HyEsltjCYS9tCXv89VBcgW102O2tYtGhb6AoaH37s14j/8C/XDuiJ3g8j3RkeVjvf1qKHJFRqve9V4mjmw4wNYYb747YUfynHB0X/EHmQygckhL5lTHDBzsAEynWDZMumTlW5jaw== 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=F5Hayc1H1AKOfEqLFqaTG1oIViw83FqMWU0AywWnwG0=; b=L6Bnh+N1vVzTTk1uJrvoSi5uLO2w1jj9D2+Ba9bo9jspi6SYn0C/JGXu30PtH/Fc9S5Pwy4eUY2Xa1ZpC+WKTBTJ9Q+rSXf7bVXHidpqogmeDifamNsPlV9GXqEvKgTSQIgpL6ax/US40238a8OKxex2ZX5TQ6WYTtizmF28GRrdDVSr8zi0nxklLzTFV9vxDWWZITNSpbUjlTZTe4Xy6G+0JYAW2lwvAXWwGDI1IR2QMerjK2SB5f4Hs9DMoIJEUV+X8+YzK36YLlEOYhsl4AdcurrQRF8fU8MwqrWyWD1oqBCIMS5/0KdFSpNUiC4u6hBY77wYsPp0I3iKbp10ow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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 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=F5Hayc1H1AKOfEqLFqaTG1oIViw83FqMWU0AywWnwG0=; b=IM4JVZL7REZtSWw2wqiwX00XQUW0+ZqqKVdN5sjGdNaZlaZwE4//u6ZMmTftFV0ZiNSeKkdvyN6EehGmbPCUW56WCKEyZ1Qac4KdLEipuwOTUae0QT6XrekxCsuURowRdIjT02Uw12n7qiV9Dtlun579nKij9oX52ruVx0WeVkc= Received: from SA9PR13CA0082.namprd13.prod.outlook.com (2603:10b6:806:23::27) by DM4PR12MB5358.namprd12.prod.outlook.com (2603:10b6:5:39c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.36; Mon, 9 Oct 2023 02:49:53 +0000 Received: from SN1PEPF000252A2.namprd05.prod.outlook.com (2603:10b6:806:23:cafe::a5) by SA9PR13CA0082.outlook.office365.com (2603:10b6:806:23::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.20 via Frontend Transport; Mon, 9 Oct 2023 02:49: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 SN1PEPF000252A2.mail.protection.outlook.com (10.167.242.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Mon, 9 Oct 2023 02:49:53 +0000 Received: from jasmine-meng.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.27; Sun, 8 Oct 2023 21:49:48 -0500 From: Meng Li <li.meng@amd.com> To: "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>, Huang Rui <ray.huang@amd.com> CC: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <x86@kernel.org>, <linux-acpi@vger.kernel.org>, Shuah Khan <skhan@linuxfoundation.org>, <linux-kselftest@vger.kernel.org>, "Nathan Fontenot" <nathan.fontenot@amd.com>, Deepak Sharma <deepak.sharma@amd.com>, Alex Deucher <alexander.deucher@amd.com>, Mario Limonciello <mario.limonciello@amd.com>, Shimmer Huang <shimmer.huang@amd.com>, "Perry Yuan" <Perry.Yuan@amd.com>, Xiaojian Du <Xiaojian.Du@amd.com>, Viresh Kumar <viresh.kumar@linaro.org>, Borislav Petkov <bp@alien8.de>, Meng Li <li.meng@amd.com> Subject: [PATCH V8 0/7] amd-pstate preferred core Date: Mon, 9 Oct 2023 10:49:25 +0800 Message-ID: <20231009024932.2563622-1-li.meng@amd.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] 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: SN1PEPF000252A2:EE_|DM4PR12MB5358:EE_ X-MS-Office365-Filtering-Correlation-Id: 16388e59-00c2-48c5-7e07-08dbc8726a19 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vSFxi2BwewJlUS44reFMyEEu5+sm59hGGyAWw1Q2XCbtYzoL2lv94N7IrGgvvoBRDsJQYVt7wv6QDplc84fnIOGSXW0ukpsrLg2RVMiDl3oo4Tz1jDklm6zSvg9vNZMPDXAbu3tFeSTG5rI77ajTXFb77gvp6EPlQZOniiFxJJDqiZnVz85pkgf64rWq5qteAlKGawXIx0pcZn1WdjXbYqJoJXeG9ZJ12+8vt1QHl3q6Xlt/L4xm5n2sz+pled+wbju/G54hKRoAKvU39O7sW1io5kyPju7LMoaw2lGcKVDYL6Yc0Wl53KYrI/2OFUBhomaPIE5kh9+Ki9m+rs75yqoNljR1Bwb6JZ7/p4c21HK+g8WLXXMt+1mgsSLyzDIKYKABChoG3Wkd8lHwLK/GjDt/aSGUwoLa4iFzUIglmxTn4ssixH0ue19x6aR3Y8bvIVUQ8rdXdTlTvHLu/+DSArVOugG6usW1rC6KFoHEwiR9decSf45tAILX6F9SlGUEzoZIDCZhMqk0MrNyTdONpJIbAF3fi5tq+j6pfa4OQpvCTd4ssED/cbQGtGqq+qdb5zfrIkHWegY20L+fPEXeEwwxqQne9zscXey3F4DZYq7vUZrUmOzFtDl1HUs9QtfYcaPShbG6DKv5ZRXydbwe8syUT5F2DF9da1Kuef1AuEhJWg5rRnaita6al2ykvkMKFV0NAz2q+5dTKAxGXFM+xbNICYh1Gf1BqkNEIiuGgpt9mtjIxbGjXtnlZV9sJrlkXTtUEflwJ2H1T15XB5NB5Q== 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)(4636009)(39860400002)(376002)(136003)(346002)(396003)(230922051799003)(451199024)(186009)(64100799003)(1800799009)(82310400011)(36840700001)(46966006)(40470700004)(40480700001)(40460700003)(83380400001)(1076003)(2616005)(336012)(426003)(26005)(47076005)(16526019)(36860700001)(316002)(54906003)(70206006)(70586007)(110136005)(6636002)(8936002)(5660300002)(8676002)(4326008)(41300700001)(7696005)(6666004)(2906002)(82740400003)(478600001)(36756003)(356005)(81166007)(86362001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2023 02:49:53.4314 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 16388e59-00c2-48c5-7e07-08dbc8726a19 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: SN1PEPF000252A2.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5358 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sun, 08 Oct 2023 19:50:13 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779244560122891324 X-GMAIL-MSGID: 1779244560122891324 |
Series |
amd-pstate preferred core
|
|
Message
Meng Li
Oct. 9, 2023, 2:49 a.m. UTC
Hi all: The core frequency is subjected to the process variation in semiconductors. Not all cores are able to reach the maximum frequency respecting the infrastructure limits. Consequently, AMD has redefined the concept of maximum frequency of a part. This means that a fraction of cores can reach maximum frequency. To find the best process scheduling policy for a given scenario, OS needs to know the core ordering informed by the platform through highest performance capability register of the CPPC interface. Earlier implementations of amd-pstate preferred core only support a static core ranking and targeted performance. Now it has the ability to dynamically change the preferred core based on the workload and platform conditions and accounting for thermals and aging. Amd-pstate driver utilizes the functions and data structures provided by the ITMT architecture to enable the scheduler to favor scheduling on cores which can be get a higher frequency with lower voltage. We call it amd-pstate preferred core. Here sched_set_itmt_core_prio() is called to set priorities and sched_set_itmt_support() is called to enable ITMT feature. Amd-pstate driver uses the highest performance value to indicate the priority of CPU. The higher value has a higher priority. Amd-pstate driver will provide an initial core ordering at boot time. It relies on the CPPC interface to communicate the core ranking to the operating system and scheduler to make sure that OS is choosing the cores with highest performance firstly for scheduling the process. When amd-pstate driver receives a message with the highest performance change, it will update the core ranking. Changes form V7->V8: - all: - - pick up Review-By flag added by Mario and Ray. - cpufreq: amd-pstate: - - use hw_prefcore embeds into cpudata structure. - - delete preferred core init from cpu online/off. Changes form V6->V7: - x86: - - Modify kconfig about X86_AMD_PSTATE. - cpufreq: amd-pstate: - - modify incorrect comments about scheduler_work(). - - convert highest_perf data type. - - modify preferred core init when cpu init and online. - acpi: cppc: - - modify link of CPPC highest performance. - cpufreq: - - modify link of CPPC highest performance changed. Changes form V5->V6: - cpufreq: amd-pstate: - - modify the wrong tag order. - - modify warning about hw_prefcore sysfs attribute. - - delete duplicate comments. - - modify the variable name cppc_highest_perf to prefcore_ranking. - - modify judgment conditions for setting highest_perf. - - modify sysfs attribute for CPPC highest perf to pr_debug message. - Documentation: amd-pstate: - - modify warning: title underline too short. Changes form V4->V5: - cpufreq: amd-pstate: - - modify sysfs attribute for CPPC highest perf. - - modify warning about comments - - rebase linux-next - cpufreq: - - Moidfy warning about function declarations. - Documentation: amd-pstate: - - align with ``amd-pstat`` Changes form V3->V4: - Documentation: amd-pstate: - - Modify inappropriate descriptions. Changes form V2->V3: - x86: - - Modify kconfig and description. - cpufreq: amd-pstate: - - Add Co-developed-by tag in commit message. - cpufreq: - - Modify commit message. - Documentation: amd-pstate: - - Modify inappropriate descriptions. Changes form V1->V2: - acpi: cppc: - - Add reference link. - cpufreq: - - Moidfy link error. - cpufreq: amd-pstate: - - Init the priorities of all online CPUs - - Use a single variable to represent the status of preferred core. - Documentation: - - Default enabled preferred core. - Documentation: amd-pstate: - - Modify inappropriate descriptions. - - Default enabled preferred core. - - Use a single variable to represent the status of preferred core. Meng Li (7): x86: Drop CPU_SUP_INTEL from SCHED_MC_PRIO for the expansion. acpi: cppc: Add get the highest performance cppc control cpufreq: amd-pstate: Enable amd-pstate preferred core supporting. cpufreq: Add a notification message that the highest perf has changed cpufreq: amd-pstate: Update amd-pstate preferred core ranking dynamically Documentation: amd-pstate: introduce amd-pstate preferred core Documentation: introduce amd-pstate preferrd core mode kernel command line options .../admin-guide/kernel-parameters.txt | 5 + Documentation/admin-guide/pm/amd-pstate.rst | 59 +++++- arch/x86/Kconfig | 5 +- drivers/acpi/cppc_acpi.c | 13 ++ drivers/acpi/processor_driver.c | 6 + drivers/cpufreq/amd-pstate.c | 186 ++++++++++++++++-- drivers/cpufreq/cpufreq.c | 13 ++ include/acpi/cppc_acpi.h | 5 + include/linux/amd-pstate.h | 10 + include/linux/cpufreq.h | 5 + 10 files changed, 285 insertions(+), 22 deletions(-)
Comments
Hello. On pondělí 9. října 2023 4:49:25 CEST Meng Li wrote: > Hi all: > > The core frequency is subjected to the process variation in semiconductors. > Not all cores are able to reach the maximum frequency respecting the > infrastructure limits. Consequently, AMD has redefined the concept of > maximum frequency of a part. This means that a fraction of cores can reach > maximum frequency. To find the best process scheduling policy for a given > scenario, OS needs to know the core ordering informed by the platform through > highest performance capability register of the CPPC interface. > > Earlier implementations of amd-pstate preferred core only support a static > core ranking and targeted performance. Now it has the ability to dynamically > change the preferred core based on the workload and platform conditions and > accounting for thermals and aging. > > Amd-pstate driver utilizes the functions and data structures provided by > the ITMT architecture to enable the scheduler to favor scheduling on cores > which can be get a higher frequency with lower voltage. > We call it amd-pstate preferred core. > > Here sched_set_itmt_core_prio() is called to set priorities and > sched_set_itmt_support() is called to enable ITMT feature. > Amd-pstate driver uses the highest performance value to indicate > the priority of CPU. The higher value has a higher priority. > > Amd-pstate driver will provide an initial core ordering at boot time. > It relies on the CPPC interface to communicate the core ranking to the > operating system and scheduler to make sure that OS is choosing the cores > with highest performance firstly for scheduling the process. When amd-pstate > driver receives a message with the highest performance change, it will > update the core ranking. > > Changes form V7->V8: > - all: > - - pick up Review-By flag added by Mario and Ray. > - cpufreq: amd-pstate: > - - use hw_prefcore embeds into cpudata structure. > - - delete preferred core init from cpu online/off. Could you please let me know if this change means a fix for the report I've sent previously? [1] Would you also be able to Cc me on the next iteration of this patchset? Thank you! [1] https://lore.kernel.org/lkml/5973628.lOV4Wx5bFT@natalenko.name/ > > Changes form V6->V7: > - x86: > - - Modify kconfig about X86_AMD_PSTATE. > - cpufreq: amd-pstate: > - - modify incorrect comments about scheduler_work(). > - - convert highest_perf data type. > - - modify preferred core init when cpu init and online. > - acpi: cppc: > - - modify link of CPPC highest performance. > - cpufreq: > - - modify link of CPPC highest performance changed. > > Changes form V5->V6: > - cpufreq: amd-pstate: > - - modify the wrong tag order. > - - modify warning about hw_prefcore sysfs attribute. > - - delete duplicate comments. > - - modify the variable name cppc_highest_perf to prefcore_ranking. > - - modify judgment conditions for setting highest_perf. > - - modify sysfs attribute for CPPC highest perf to pr_debug message. > - Documentation: amd-pstate: > - - modify warning: title underline too short. > > Changes form V4->V5: > - cpufreq: amd-pstate: > - - modify sysfs attribute for CPPC highest perf. > - - modify warning about comments > - - rebase linux-next > - cpufreq: > - - Moidfy warning about function declarations. > - Documentation: amd-pstate: > - - align with ``amd-pstat`` > > Changes form V3->V4: > - Documentation: amd-pstate: > - - Modify inappropriate descriptions. > > Changes form V2->V3: > - x86: > - - Modify kconfig and description. > - cpufreq: amd-pstate: > - - Add Co-developed-by tag in commit message. > - cpufreq: > - - Modify commit message. > - Documentation: amd-pstate: > - - Modify inappropriate descriptions. > > Changes form V1->V2: > - acpi: cppc: > - - Add reference link. > - cpufreq: > - - Moidfy link error. > - cpufreq: amd-pstate: > - - Init the priorities of all online CPUs > - - Use a single variable to represent the status of preferred core. > - Documentation: > - - Default enabled preferred core. > - Documentation: amd-pstate: > - - Modify inappropriate descriptions. > - - Default enabled preferred core. > - - Use a single variable to represent the status of preferred core. > > Meng Li (7): > x86: Drop CPU_SUP_INTEL from SCHED_MC_PRIO for the expansion. > acpi: cppc: Add get the highest performance cppc control > cpufreq: amd-pstate: Enable amd-pstate preferred core supporting. > cpufreq: Add a notification message that the highest perf has changed > cpufreq: amd-pstate: Update amd-pstate preferred core ranking > dynamically > Documentation: amd-pstate: introduce amd-pstate preferred core > Documentation: introduce amd-pstate preferrd core mode kernel command > line options > > .../admin-guide/kernel-parameters.txt | 5 + > Documentation/admin-guide/pm/amd-pstate.rst | 59 +++++- > arch/x86/Kconfig | 5 +- > drivers/acpi/cppc_acpi.c | 13 ++ > drivers/acpi/processor_driver.c | 6 + > drivers/cpufreq/amd-pstate.c | 186 ++++++++++++++++-- > drivers/cpufreq/cpufreq.c | 13 ++ > include/acpi/cppc_acpi.h | 5 + > include/linux/amd-pstate.h | 10 + > include/linux/cpufreq.h | 5 + > 10 files changed, 285 insertions(+), 22 deletions(-) > >
[AMD Official Use Only - General] Hi Oleksandr: > -----Original Message----- > From: Oleksandr Natalenko <oleksandr@natalenko.name> > Sent: Monday, October 9, 2023 2:55 PM > To: Rafael J . Wysocki <rafael.j.wysocki@intel.com>; Huang, Ray > <Ray.Huang@amd.com>; Meng, Li (Jassmine) <Li.Meng@amd.com> > Cc: linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org; > x86@kernel.org; linux-acpi@vger.kernel.org; Shuah Khan > <skhan@linuxfoundation.org>; linux-kselftest@vger.kernel.org; Fontenot, > Nathan <Nathan.Fontenot@amd.com>; Sharma, Deepak > <Deepak.Sharma@amd.com>; Deucher, Alexander > <Alexander.Deucher@amd.com>; Limonciello, Mario > <Mario.Limonciello@amd.com>; Huang, Shimmer > <Shimmer.Huang@amd.com>; Yuan, Perry <Perry.Yuan@amd.com>; Du, > Xiaojian <Xiaojian.Du@amd.com>; Viresh Kumar <viresh.kumar@linaro.org>; > Borislav Petkov <bp@alien8.de>; Meng, Li (Jassmine) <Li.Meng@amd.com> > Subject: Re: [PATCH V8 0/7] amd-pstate preferred core > > Hello. > > On pondělí 9. října 2023 4:49:25 CEST Meng Li wrote: > > Hi all: > > > > The core frequency is subjected to the process variation in semiconductors. > > Not all cores are able to reach the maximum frequency respecting the > > infrastructure limits. Consequently, AMD has redefined the concept of > > maximum frequency of a part. This means that a fraction of cores can > > reach maximum frequency. To find the best process scheduling policy > > for a given scenario, OS needs to know the core ordering informed by > > the platform through highest performance capability register of the CPPC > interface. > > > > Earlier implementations of amd-pstate preferred core only support a > > static core ranking and targeted performance. Now it has the ability > > to dynamically change the preferred core based on the workload and > > platform conditions and accounting for thermals and aging. > > > > Amd-pstate driver utilizes the functions and data structures provided > > by the ITMT architecture to enable the scheduler to favor scheduling > > on cores which can be get a higher frequency with lower voltage. > > We call it amd-pstate preferred core. > > > > Here sched_set_itmt_core_prio() is called to set priorities and > > sched_set_itmt_support() is called to enable ITMT feature. > > Amd-pstate driver uses the highest performance value to indicate the > > priority of CPU. The higher value has a higher priority. > > > > Amd-pstate driver will provide an initial core ordering at boot time. > > It relies on the CPPC interface to communicate the core ranking to the > > operating system and scheduler to make sure that OS is choosing the > > cores with highest performance firstly for scheduling the process. > > When amd-pstate driver receives a message with the highest performance > > change, it will update the core ranking. > > > > Changes form V7->V8: > > - all: > > - - pick up Review-By flag added by Mario and Ray. > > - cpufreq: amd-pstate: > > - - use hw_prefcore embeds into cpudata structure. > > - - delete preferred core init from cpu online/off. > > Could you please let me know if this change means a fix for the report I've > sent previously? [1] > [Meng, Li (Jassmine)] Yes. I have deleted online handle function of amd pstate driver. It doesn't re-initialize preferred core. This online function will set incorrect des perf value. > Would you also be able to Cc me on the next iteration of this patchset? [Meng, Li (Jassmine)] OK. > > Thank you! > > [1] https://lore.kernel.org/lkml/5973628.lOV4Wx5bFT@natalenko.name/ > > > > > Changes form V6->V7: > > - x86: > > - - Modify kconfig about X86_AMD_PSTATE. > > - cpufreq: amd-pstate: > > - - modify incorrect comments about scheduler_work(). > > - - convert highest_perf data type. > > - - modify preferred core init when cpu init and online. > > - acpi: cppc: > > - - modify link of CPPC highest performance. > > - cpufreq: > > - - modify link of CPPC highest performance changed. > > > > Changes form V5->V6: > > - cpufreq: amd-pstate: > > - - modify the wrong tag order. > > - - modify warning about hw_prefcore sysfs attribute. > > - - delete duplicate comments. > > - - modify the variable name cppc_highest_perf to prefcore_ranking. > > - - modify judgment conditions for setting highest_perf. > > - - modify sysfs attribute for CPPC highest perf to pr_debug message. > > - Documentation: amd-pstate: > > - - modify warning: title underline too short. > > > > Changes form V4->V5: > > - cpufreq: amd-pstate: > > - - modify sysfs attribute for CPPC highest perf. > > - - modify warning about comments > > - - rebase linux-next > > - cpufreq: > > - - Moidfy warning about function declarations. > > - Documentation: amd-pstate: > > - - align with ``amd-pstat`` > > > > Changes form V3->V4: > > - Documentation: amd-pstate: > > - - Modify inappropriate descriptions. > > > > Changes form V2->V3: > > - x86: > > - - Modify kconfig and description. > > - cpufreq: amd-pstate: > > - - Add Co-developed-by tag in commit message. > > - cpufreq: > > - - Modify commit message. > > - Documentation: amd-pstate: > > - - Modify inappropriate descriptions. > > > > Changes form V1->V2: > > - acpi: cppc: > > - - Add reference link. > > - cpufreq: > > - - Moidfy link error. > > - cpufreq: amd-pstate: > > - - Init the priorities of all online CPUs > > - - Use a single variable to represent the status of preferred core. > > - Documentation: > > - - Default enabled preferred core. > > - Documentation: amd-pstate: > > - - Modify inappropriate descriptions. > > - - Default enabled preferred core. > > - - Use a single variable to represent the status of preferred core. > > > > Meng Li (7): > > x86: Drop CPU_SUP_INTEL from SCHED_MC_PRIO for the expansion. > > acpi: cppc: Add get the highest performance cppc control > > cpufreq: amd-pstate: Enable amd-pstate preferred core supporting. > > cpufreq: Add a notification message that the highest perf has changed > > cpufreq: amd-pstate: Update amd-pstate preferred core ranking > > dynamically > > Documentation: amd-pstate: introduce amd-pstate preferred core > > Documentation: introduce amd-pstate preferrd core mode kernel > command > > line options > > > > .../admin-guide/kernel-parameters.txt | 5 + > > Documentation/admin-guide/pm/amd-pstate.rst | 59 +++++- > > arch/x86/Kconfig | 5 +- > > drivers/acpi/cppc_acpi.c | 13 ++ > > drivers/acpi/processor_driver.c | 6 + > > drivers/cpufreq/amd-pstate.c | 186 ++++++++++++++++-- > > drivers/cpufreq/cpufreq.c | 13 ++ > > include/acpi/cppc_acpi.h | 5 + > > include/linux/amd-pstate.h | 10 + > > include/linux/cpufreq.h | 5 + > > 10 files changed, 285 insertions(+), 22 deletions(-) > > > > > > > -- > Oleksandr Natalenko (post-factum)
Hello. On pondělí 9. října 2023 9:23:29 CEST Meng, Li (Jassmine) wrote: > [AMD Official Use Only - General] > > Hi Oleksandr: > > > -----Original Message----- > > From: Oleksandr Natalenko <oleksandr@natalenko.name> > > Sent: Monday, October 9, 2023 2:55 PM > > To: Rafael J . Wysocki <rafael.j.wysocki@intel.com>; Huang, Ray > > <Ray.Huang@amd.com>; Meng, Li (Jassmine) <Li.Meng@amd.com> > > Cc: linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org; > > x86@kernel.org; linux-acpi@vger.kernel.org; Shuah Khan > > <skhan@linuxfoundation.org>; linux-kselftest@vger.kernel.org; Fontenot, > > Nathan <Nathan.Fontenot@amd.com>; Sharma, Deepak > > <Deepak.Sharma@amd.com>; Deucher, Alexander > > <Alexander.Deucher@amd.com>; Limonciello, Mario > > <Mario.Limonciello@amd.com>; Huang, Shimmer > > <Shimmer.Huang@amd.com>; Yuan, Perry <Perry.Yuan@amd.com>; Du, > > Xiaojian <Xiaojian.Du@amd.com>; Viresh Kumar <viresh.kumar@linaro.org>; > > Borislav Petkov <bp@alien8.de>; Meng, Li (Jassmine) <Li.Meng@amd.com> > > Subject: Re: [PATCH V8 0/7] amd-pstate preferred core > > > > Hello. > > > > On pondělí 9. října 2023 4:49:25 CEST Meng Li wrote: > > > Hi all: > > > > > > The core frequency is subjected to the process variation in semiconductors. > > > Not all cores are able to reach the maximum frequency respecting the > > > infrastructure limits. Consequently, AMD has redefined the concept of > > > maximum frequency of a part. This means that a fraction of cores can > > > reach maximum frequency. To find the best process scheduling policy > > > for a given scenario, OS needs to know the core ordering informed by > > > the platform through highest performance capability register of the CPPC > > interface. > > > > > > Earlier implementations of amd-pstate preferred core only support a > > > static core ranking and targeted performance. Now it has the ability > > > to dynamically change the preferred core based on the workload and > > > platform conditions and accounting for thermals and aging. > > > > > > Amd-pstate driver utilizes the functions and data structures provided > > > by the ITMT architecture to enable the scheduler to favor scheduling > > > on cores which can be get a higher frequency with lower voltage. > > > We call it amd-pstate preferred core. > > > > > > Here sched_set_itmt_core_prio() is called to set priorities and > > > sched_set_itmt_support() is called to enable ITMT feature. > > > Amd-pstate driver uses the highest performance value to indicate the > > > priority of CPU. The higher value has a higher priority. > > > > > > Amd-pstate driver will provide an initial core ordering at boot time. > > > It relies on the CPPC interface to communicate the core ranking to the > > > operating system and scheduler to make sure that OS is choosing the > > > cores with highest performance firstly for scheduling the process. > > > When amd-pstate driver receives a message with the highest performance > > > change, it will update the core ranking. > > > > > > Changes form V7->V8: > > > - all: > > > - - pick up Review-By flag added by Mario and Ray. > > > - cpufreq: amd-pstate: > > > - - use hw_prefcore embeds into cpudata structure. > > > - - delete preferred core init from cpu online/off. > > > > Could you please let me know if this change means a fix for the report I've > > sent previously? [1] > > > [Meng, Li (Jassmine)] Yes. > I have deleted online handle function of amd pstate driver. > It doesn't re-initialize preferred core. > This online function will set incorrect des perf value. Thank you for the confirmation. I've built v6.5.5 with this patchset applied, and now the frequency is as expected after the suspend-resume cycle. I've also added the following modification to accommodate recent feedback: ``` commit 1450ac395434c532f995521e1a2497d09ddf106c Author: Oleksandr Natalenko <oleksandr@natalenko.name> Date: Mon Oct 9 11:19:50 2023 +0200 cpufreq/amd-pstate: show prefcore_ranking separately Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index d3369247c6c9c..86999d861e87b 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -954,6 +954,17 @@ static ssize_t show_amd_pstate_highest_perf(struct cpufreq_policy *policy, u32 perf; struct amd_cpudata *cpudata = policy->driver_data; + perf = READ_ONCE(cpudata->highest_perf); + + return sysfs_emit(buf, "%u\n", perf); +} + +static ssize_t show_amd_pstate_prefcore_ranking(struct cpufreq_policy *policy, + char *buf) +{ + u32 perf; + struct amd_cpudata *cpudata = policy->driver_data; + perf = READ_ONCE(cpudata->prefcore_ranking); return sysfs_emit(buf, "%u\n", perf); @@ -1172,6 +1183,7 @@ cpufreq_freq_attr_ro(amd_pstate_max_freq); cpufreq_freq_attr_ro(amd_pstate_lowest_nonlinear_freq); cpufreq_freq_attr_ro(amd_pstate_highest_perf); +cpufreq_freq_attr_ro(amd_pstate_prefcore_ranking); cpufreq_freq_attr_ro(amd_pstate_hw_prefcore); cpufreq_freq_attr_rw(energy_performance_preference); cpufreq_freq_attr_ro(energy_performance_available_preferences); @@ -1182,6 +1194,7 @@ static struct freq_attr *amd_pstate_attr[] = { &amd_pstate_max_freq, &amd_pstate_lowest_nonlinear_freq, &amd_pstate_highest_perf, + &amd_pstate_prefcore_ranking, &amd_pstate_hw_prefcore, NULL, }; @@ -1190,6 +1203,7 @@ static struct freq_attr *amd_pstate_epp_attr[] = { &amd_pstate_max_freq, &amd_pstate_lowest_nonlinear_freq, &amd_pstate_highest_perf, + &amd_pstate_prefcore_ranking, &amd_pstate_hw_prefcore, &energy_performance_preference, &energy_performance_available_preferences, ``` with the following output as a result: ``` [~]> grep . /sys/devices/system/cpu*/cpufreq/policy*/amd_pstate_highest_perf /sys/devices/system/cpu/cpufreq/policy0/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy1/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy2/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy3/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy4/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy5/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy6/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy7/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy8/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy9/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy10/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy11/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy12/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy13/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy14/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy15/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy16/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy17/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy18/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy19/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy20/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy21/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy22/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy23/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy24/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy25/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy26/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy27/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy28/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy29/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy30/amd_pstate_highest_perf:166 /sys/devices/system/cpu/cpufreq/policy31/amd_pstate_highest_perf:166 [~]> grep . /sys/devices/system/cpu*/cpufreq/policy*/amd_pstate_hw_prefcore /sys/devices/system/cpu/cpufreq/policy0/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy1/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy2/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy3/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy4/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy5/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy6/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy7/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy8/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy9/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy10/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy11/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy12/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy13/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy14/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy15/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy16/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy17/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy18/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy19/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy20/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy21/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy22/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy23/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy24/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy25/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy26/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy27/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy28/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy29/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy30/amd_pstate_hw_prefcore:supported /sys/devices/system/cpu/cpufreq/policy31/amd_pstate_hw_prefcore:supported [~]> grep . /sys/devices/system/cpu*/cpufreq/policy*/amd_pstate_prefcore_ranking /sys/devices/system/cpu/cpufreq/policy0/amd_pstate_prefcore_ranking:226 /sys/devices/system/cpu/cpufreq/policy1/amd_pstate_prefcore_ranking:231 /sys/devices/system/cpu/cpufreq/policy2/amd_pstate_prefcore_ranking:211 /sys/devices/system/cpu/cpufreq/policy3/amd_pstate_prefcore_ranking:236 /sys/devices/system/cpu/cpufreq/policy4/amd_pstate_prefcore_ranking:216 /sys/devices/system/cpu/cpufreq/policy5/amd_pstate_prefcore_ranking:236 /sys/devices/system/cpu/cpufreq/policy6/amd_pstate_prefcore_ranking:206 /sys/devices/system/cpu/cpufreq/policy7/amd_pstate_prefcore_ranking:221 /sys/devices/system/cpu/cpufreq/policy8/amd_pstate_prefcore_ranking:191 /sys/devices/system/cpu/cpufreq/policy9/amd_pstate_prefcore_ranking:201 /sys/devices/system/cpu/cpufreq/policy10/amd_pstate_prefcore_ranking:186 /sys/devices/system/cpu/cpufreq/policy11/amd_pstate_prefcore_ranking:196 /sys/devices/system/cpu/cpufreq/policy12/amd_pstate_prefcore_ranking:171 /sys/devices/system/cpu/cpufreq/policy13/amd_pstate_prefcore_ranking:166 /sys/devices/system/cpu/cpufreq/policy14/amd_pstate_prefcore_ranking:176 /sys/devices/system/cpu/cpufreq/policy15/amd_pstate_prefcore_ranking:181 /sys/devices/system/cpu/cpufreq/policy16/amd_pstate_prefcore_ranking:226 /sys/devices/system/cpu/cpufreq/policy17/amd_pstate_prefcore_ranking:231 /sys/devices/system/cpu/cpufreq/policy18/amd_pstate_prefcore_ranking:211 /sys/devices/system/cpu/cpufreq/policy19/amd_pstate_prefcore_ranking:236 /sys/devices/system/cpu/cpufreq/policy20/amd_pstate_prefcore_ranking:216 /sys/devices/system/cpu/cpufreq/policy21/amd_pstate_prefcore_ranking:236 /sys/devices/system/cpu/cpufreq/policy22/amd_pstate_prefcore_ranking:206 /sys/devices/system/cpu/cpufreq/policy23/amd_pstate_prefcore_ranking:221 /sys/devices/system/cpu/cpufreq/policy24/amd_pstate_prefcore_ranking:191 /sys/devices/system/cpu/cpufreq/policy25/amd_pstate_prefcore_ranking:201 /sys/devices/system/cpu/cpufreq/policy26/amd_pstate_prefcore_ranking:186 /sys/devices/system/cpu/cpufreq/policy27/amd_pstate_prefcore_ranking:196 /sys/devices/system/cpu/cpufreq/policy28/amd_pstate_prefcore_ranking:171 /sys/devices/system/cpu/cpufreq/policy29/amd_pstate_prefcore_ranking:166 /sys/devices/system/cpu/cpufreq/policy30/amd_pstate_prefcore_ranking:176 /sys/devices/system/cpu/cpufreq/policy31/amd_pstate_prefcore_ranking:181 ``` When I run `dd if=/dev/zero of=/dev/null`, the load lands onto cores 3, 5, 19 or 21, IOW, those that have the highest `amd_pstate_prefcore_ranking` value given `schedutil` is in use. If all of the above is as expected, please add: Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name> > > Would you also be able to Cc me on the next iteration of this patchset? > [Meng, Li (Jassmine)] OK. Thanks. > > > > Thank you! > > > > [1] https://lore.kernel.org/lkml/5973628.lOV4Wx5bFT@natalenko.name/ > > > > > > > > Changes form V6->V7: > > > - x86: > > > - - Modify kconfig about X86_AMD_PSTATE. > > > - cpufreq: amd-pstate: > > > - - modify incorrect comments about scheduler_work(). > > > - - convert highest_perf data type. > > > - - modify preferred core init when cpu init and online. > > > - acpi: cppc: > > > - - modify link of CPPC highest performance. > > > - cpufreq: > > > - - modify link of CPPC highest performance changed. > > > > > > Changes form V5->V6: > > > - cpufreq: amd-pstate: > > > - - modify the wrong tag order. > > > - - modify warning about hw_prefcore sysfs attribute. > > > - - delete duplicate comments. > > > - - modify the variable name cppc_highest_perf to prefcore_ranking. > > > - - modify judgment conditions for setting highest_perf. > > > - - modify sysfs attribute for CPPC highest perf to pr_debug message. > > > - Documentation: amd-pstate: > > > - - modify warning: title underline too short. > > > > > > Changes form V4->V5: > > > - cpufreq: amd-pstate: > > > - - modify sysfs attribute for CPPC highest perf. > > > - - modify warning about comments > > > - - rebase linux-next > > > - cpufreq: > > > - - Moidfy warning about function declarations. > > > - Documentation: amd-pstate: > > > - - align with ``amd-pstat`` > > > > > > Changes form V3->V4: > > > - Documentation: amd-pstate: > > > - - Modify inappropriate descriptions. > > > > > > Changes form V2->V3: > > > - x86: > > > - - Modify kconfig and description. > > > - cpufreq: amd-pstate: > > > - - Add Co-developed-by tag in commit message. > > > - cpufreq: > > > - - Modify commit message. > > > - Documentation: amd-pstate: > > > - - Modify inappropriate descriptions. > > > > > > Changes form V1->V2: > > > - acpi: cppc: > > > - - Add reference link. > > > - cpufreq: > > > - - Moidfy link error. > > > - cpufreq: amd-pstate: > > > - - Init the priorities of all online CPUs > > > - - Use a single variable to represent the status of preferred core. > > > - Documentation: > > > - - Default enabled preferred core. > > > - Documentation: amd-pstate: > > > - - Modify inappropriate descriptions. > > > - - Default enabled preferred core. > > > - - Use a single variable to represent the status of preferred core. > > > > > > Meng Li (7): > > > x86: Drop CPU_SUP_INTEL from SCHED_MC_PRIO for the expansion. > > > acpi: cppc: Add get the highest performance cppc control > > > cpufreq: amd-pstate: Enable amd-pstate preferred core supporting. > > > cpufreq: Add a notification message that the highest perf has changed > > > cpufreq: amd-pstate: Update amd-pstate preferred core ranking > > > dynamically > > > Documentation: amd-pstate: introduce amd-pstate preferred core > > > Documentation: introduce amd-pstate preferrd core mode kernel > > command > > > line options > > > > > > .../admin-guide/kernel-parameters.txt | 5 + > > > Documentation/admin-guide/pm/amd-pstate.rst | 59 +++++- > > > arch/x86/Kconfig | 5 +- > > > drivers/acpi/cppc_acpi.c | 13 ++ > > > drivers/acpi/processor_driver.c | 6 + > > > drivers/cpufreq/amd-pstate.c | 186 ++++++++++++++++-- > > > drivers/cpufreq/cpufreq.c | 13 ++ > > > include/acpi/cppc_acpi.h | 5 + > > > include/linux/amd-pstate.h | 10 + > > > include/linux/cpufreq.h | 5 + > > > 10 files changed, 285 insertions(+), 22 deletions(-) > > > > > > > > > > > > -- > > Oleksandr Natalenko (post-factum) >
[AMD Official Use Only - General] Hi Oleksandr: > -----Original Message----- > From: Oleksandr Natalenko <oleksandr@natalenko.name> > Sent: Monday, October 9, 2023 9:00 PM > To: Rafael J . Wysocki <rafael.j.wysocki@intel.com>; Huang, Ray > <Ray.Huang@amd.com>; Meng, Li (Jassmine) <Li.Meng@amd.com> > Cc: linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org; > x86@kernel.org; linux-acpi@vger.kernel.org; Shuah Khan > <skhan@linuxfoundation.org>; linux-kselftest@vger.kernel.org; Fontenot, > Nathan <Nathan.Fontenot@amd.com>; Sharma, Deepak > <Deepak.Sharma@amd.com>; Deucher, Alexander > <Alexander.Deucher@amd.com>; Limonciello, Mario > <Mario.Limonciello@amd.com>; Huang, Shimmer > <Shimmer.Huang@amd.com>; Yuan, Perry <Perry.Yuan@amd.com>; Du, > Xiaojian <Xiaojian.Du@amd.com>; Viresh Kumar <viresh.kumar@linaro.org>; > Borislav Petkov <bp@alien8.de> > Subject: Re: [PATCH V8 0/7] amd-pstate preferred core > > Hello. > > On pondělí 9. října 2023 9:23:29 CEST Meng, Li (Jassmine) wrote: > > [AMD Official Use Only - General] > > > > Hi Oleksandr: > > > > > -----Original Message----- > > > From: Oleksandr Natalenko <oleksandr@natalenko.name> > > > Sent: Monday, October 9, 2023 2:55 PM > > > To: Rafael J . Wysocki <rafael.j.wysocki@intel.com>; Huang, Ray > > > <Ray.Huang@amd.com>; Meng, Li (Jassmine) <Li.Meng@amd.com> > > > Cc: linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org; > > > x86@kernel.org; linux-acpi@vger.kernel.org; Shuah Khan > > > <skhan@linuxfoundation.org>; linux-kselftest@vger.kernel.org; > > > Fontenot, Nathan <Nathan.Fontenot@amd.com>; Sharma, Deepak > > > <Deepak.Sharma@amd.com>; Deucher, Alexander > > > <Alexander.Deucher@amd.com>; Limonciello, Mario > > > <Mario.Limonciello@amd.com>; Huang, Shimmer > <Shimmer.Huang@amd.com>; > > > Yuan, Perry <Perry.Yuan@amd.com>; Du, Xiaojian > > > <Xiaojian.Du@amd.com>; Viresh Kumar <viresh.kumar@linaro.org>; > > > Borislav Petkov <bp@alien8.de>; Meng, Li (Jassmine) > > > <Li.Meng@amd.com> > > > Subject: Re: [PATCH V8 0/7] amd-pstate preferred core > > > > > > Hello. > > > > > > On pondělí 9. října 2023 4:49:25 CEST Meng Li wrote: > > > > Hi all: > > > > > > > > The core frequency is subjected to the process variation in > semiconductors. > > > > Not all cores are able to reach the maximum frequency respecting > > > > the infrastructure limits. Consequently, AMD has redefined the > > > > concept of maximum frequency of a part. This means that a fraction > > > > of cores can reach maximum frequency. To find the best process > > > > scheduling policy for a given scenario, OS needs to know the core > > > > ordering informed by the platform through highest performance > > > > capability register of the CPPC > > > interface. > > > > > > > > Earlier implementations of amd-pstate preferred core only support > > > > a static core ranking and targeted performance. Now it has the > > > > ability to dynamically change the preferred core based on the > > > > workload and platform conditions and accounting for thermals and > aging. > > > > > > > > Amd-pstate driver utilizes the functions and data structures > > > > provided by the ITMT architecture to enable the scheduler to favor > > > > scheduling on cores which can be get a higher frequency with lower > voltage. > > > > We call it amd-pstate preferred core. > > > > > > > > Here sched_set_itmt_core_prio() is called to set priorities and > > > > sched_set_itmt_support() is called to enable ITMT feature. > > > > Amd-pstate driver uses the highest performance value to indicate > > > > the priority of CPU. The higher value has a higher priority. > > > > > > > > Amd-pstate driver will provide an initial core ordering at boot time. > > > > It relies on the CPPC interface to communicate the core ranking to > > > > the operating system and scheduler to make sure that OS is > > > > choosing the cores with highest performance firstly for scheduling the > process. > > > > When amd-pstate driver receives a message with the highest > > > > performance change, it will update the core ranking. > > > > > > > > Changes form V7->V8: > > > > - all: > > > > - - pick up Review-By flag added by Mario and Ray. > > > > - cpufreq: amd-pstate: > > > > - - use hw_prefcore embeds into cpudata structure. > > > > - - delete preferred core init from cpu online/off. > > > > > > Could you please let me know if this change means a fix for the > > > report I've sent previously? [1] > > > > > [Meng, Li (Jassmine)] Yes. > > I have deleted online handle function of amd pstate driver. > > It doesn't re-initialize preferred core. > > This online function will set incorrect des perf value. > > Thank you for the confirmation. I've built v6.5.5 with this patchset applied, > and now the frequency is as expected after the suspend-resume cycle. > > I've also added the following modification to accommodate recent feedback: > > ``` > commit 1450ac395434c532f995521e1a2497d09ddf106c > Author: Oleksandr Natalenko <oleksandr@natalenko.name> > Date: Mon Oct 9 11:19:50 2023 +0200 > > cpufreq/amd-pstate: show prefcore_ranking separately > > Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name> > > diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c > index d3369247c6c9c..86999d861e87b 100644 > --- a/drivers/cpufreq/amd-pstate.c > +++ b/drivers/cpufreq/amd-pstate.c > @@ -954,6 +954,17 @@ static ssize_t show_amd_pstate_highest_perf(struct > cpufreq_policy *policy, > u32 perf; > struct amd_cpudata *cpudata = policy->driver_data; > > + perf = READ_ONCE(cpudata->highest_perf); > + > + return sysfs_emit(buf, "%u\n", perf); > +} > + > +static ssize_t show_amd_pstate_prefcore_ranking(struct cpufreq_policy > *policy, > + char *buf) > +{ > + u32 perf; > + struct amd_cpudata *cpudata = policy->driver_data; > + > perf = READ_ONCE(cpudata->prefcore_ranking); > > return sysfs_emit(buf, "%u\n", perf); > @@ -1172,6 +1183,7 @@ cpufreq_freq_attr_ro(amd_pstate_max_freq); > cpufreq_freq_attr_ro(amd_pstate_lowest_nonlinear_freq); > > cpufreq_freq_attr_ro(amd_pstate_highest_perf); > +cpufreq_freq_attr_ro(amd_pstate_prefcore_ranking); > cpufreq_freq_attr_ro(amd_pstate_hw_prefcore); > cpufreq_freq_attr_rw(energy_performance_preference); > cpufreq_freq_attr_ro(energy_performance_available_preferences); > @@ -1182,6 +1194,7 @@ static struct freq_attr *amd_pstate_attr[] = { > &amd_pstate_max_freq, > &amd_pstate_lowest_nonlinear_freq, > &amd_pstate_highest_perf, > + &amd_pstate_prefcore_ranking, > &amd_pstate_hw_prefcore, > NULL, > }; > @@ -1190,6 +1203,7 @@ static struct freq_attr *amd_pstate_epp_attr[] = { > &amd_pstate_max_freq, > &amd_pstate_lowest_nonlinear_freq, > &amd_pstate_highest_perf, > + &amd_pstate_prefcore_ranking, > &amd_pstate_hw_prefcore, > &energy_performance_preference, > &energy_performance_available_preferences, > ``` > > with the following output as a result: > > ``` > [~]> grep . > /sys/devices/system/cpu*/cpufreq/policy*/amd_pstate_highest_perf > /sys/devices/system/cpu/cpufreq/policy0/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy1/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy2/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy3/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy4/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy5/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy6/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy7/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy8/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy9/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy10/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy11/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy12/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy13/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy14/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy15/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy16/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy17/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy18/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy19/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy20/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy21/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy22/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy23/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy24/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy25/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy26/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy27/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy28/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy29/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy30/amd_pstate_highest_perf:166 > /sys/devices/system/cpu/cpufreq/policy31/amd_pstate_highest_perf:166 > > [~]> grep . > /sys/devices/system/cpu*/cpufreq/policy*/amd_pstate_hw_prefcore > /sys/devices/system/cpu/cpufreq/policy0/amd_pstate_hw_prefcore:suppo > rted > /sys/devices/system/cpu/cpufreq/policy1/amd_pstate_hw_prefcore:suppo > rted > /sys/devices/system/cpu/cpufreq/policy2/amd_pstate_hw_prefcore:suppo > rted > /sys/devices/system/cpu/cpufreq/policy3/amd_pstate_hw_prefcore:suppo > rted > /sys/devices/system/cpu/cpufreq/policy4/amd_pstate_hw_prefcore:suppo > rted > /sys/devices/system/cpu/cpufreq/policy5/amd_pstate_hw_prefcore:suppo > rted > /sys/devices/system/cpu/cpufreq/policy6/amd_pstate_hw_prefcore:suppo > rted > /sys/devices/system/cpu/cpufreq/policy7/amd_pstate_hw_prefcore:suppo > rted > /sys/devices/system/cpu/cpufreq/policy8/amd_pstate_hw_prefcore:suppo > rted > /sys/devices/system/cpu/cpufreq/policy9/amd_pstate_hw_prefcore:suppo > rted > /sys/devices/system/cpu/cpufreq/policy10/amd_pstate_hw_prefcore:supp > orted > /sys/devices/system/cpu/cpufreq/policy11/amd_pstate_hw_prefcore:supp > orted > /sys/devices/system/cpu/cpufreq/policy12/amd_pstate_hw_prefcore:supp > orted > /sys/devices/system/cpu/cpufreq/policy13/amd_pstate_hw_prefcore:supp > orted > /sys/devices/system/cpu/cpufreq/policy14/amd_pstate_hw_prefcore:supp > orted > /sys/devices/system/cpu/cpufreq/policy15/amd_pstate_hw_prefcore:supp > orted > /sys/devices/system/cpu/cpufreq/policy16/amd_pstate_hw_prefcore:supp > orted > /sys/devices/system/cpu/cpufreq/policy17/amd_pstate_hw_prefcore:supp > orted > /sys/devices/system/cpu/cpufreq/policy18/amd_pstate_hw_prefcore:supp > orted > /sys/devices/system/cpu/cpufreq/policy19/amd_pstate_hw_prefcore:supp > orted > /sys/devices/system/cpu/cpufreq/policy20/amd_pstate_hw_prefcore:supp > orted > /sys/devices/system/cpu/cpufreq/policy21/amd_pstate_hw_prefcore:supp > orted > /sys/devices/system/cpu/cpufreq/policy22/amd_pstate_hw_prefcore:supp > orted > /sys/devices/system/cpu/cpufreq/policy23/amd_pstate_hw_prefcore:supp > orted > /sys/devices/system/cpu/cpufreq/policy24/amd_pstate_hw_prefcore:supp > orted > /sys/devices/system/cpu/cpufreq/policy25/amd_pstate_hw_prefcore:supp > orted > /sys/devices/system/cpu/cpufreq/policy26/amd_pstate_hw_prefcore:supp > orted > /sys/devices/system/cpu/cpufreq/policy27/amd_pstate_hw_prefcore:supp > orted > /sys/devices/system/cpu/cpufreq/policy28/amd_pstate_hw_prefcore:supp > orted > /sys/devices/system/cpu/cpufreq/policy29/amd_pstate_hw_prefcore:supp > orted > /sys/devices/system/cpu/cpufreq/policy30/amd_pstate_hw_prefcore:supp > orted > /sys/devices/system/cpu/cpufreq/policy31/amd_pstate_hw_prefcore:supp > orted > > [~]> grep . > /sys/devices/system/cpu*/cpufreq/policy*/amd_pstate_prefcore_ranking > /sys/devices/system/cpu/cpufreq/policy0/amd_pstate_prefcore_ranking:22 > 6 > /sys/devices/system/cpu/cpufreq/policy1/amd_pstate_prefcore_ranking:23 > 1 > /sys/devices/system/cpu/cpufreq/policy2/amd_pstate_prefcore_ranking:21 > 1 > /sys/devices/system/cpu/cpufreq/policy3/amd_pstate_prefcore_ranking:23 > 6 > /sys/devices/system/cpu/cpufreq/policy4/amd_pstate_prefcore_ranking:21 > 6 > /sys/devices/system/cpu/cpufreq/policy5/amd_pstate_prefcore_ranking:23 > 6 > /sys/devices/system/cpu/cpufreq/policy6/amd_pstate_prefcore_ranking:20 > 6 > /sys/devices/system/cpu/cpufreq/policy7/amd_pstate_prefcore_ranking:22 > 1 > /sys/devices/system/cpu/cpufreq/policy8/amd_pstate_prefcore_ranking:19 > 1 > /sys/devices/system/cpu/cpufreq/policy9/amd_pstate_prefcore_ranking:20 > 1 > /sys/devices/system/cpu/cpufreq/policy10/amd_pstate_prefcore_ranking:1 > 86 > /sys/devices/system/cpu/cpufreq/policy11/amd_pstate_prefcore_ranking:1 > 96 > /sys/devices/system/cpu/cpufreq/policy12/amd_pstate_prefcore_ranking:1 > 71 > /sys/devices/system/cpu/cpufreq/policy13/amd_pstate_prefcore_ranking:1 > 66 > /sys/devices/system/cpu/cpufreq/policy14/amd_pstate_prefcore_ranking:1 > 76 > /sys/devices/system/cpu/cpufreq/policy15/amd_pstate_prefcore_ranking:1 > 81 > /sys/devices/system/cpu/cpufreq/policy16/amd_pstate_prefcore_ranking:2 > 26 > /sys/devices/system/cpu/cpufreq/policy17/amd_pstate_prefcore_ranking:2 > 31 > /sys/devices/system/cpu/cpufreq/policy18/amd_pstate_prefcore_ranking:2 > 11 > /sys/devices/system/cpu/cpufreq/policy19/amd_pstate_prefcore_ranking:2 > 36 > /sys/devices/system/cpu/cpufreq/policy20/amd_pstate_prefcore_ranking:2 > 16 > /sys/devices/system/cpu/cpufreq/policy21/amd_pstate_prefcore_ranking:2 > 36 > /sys/devices/system/cpu/cpufreq/policy22/amd_pstate_prefcore_ranking:2 > 06 > /sys/devices/system/cpu/cpufreq/policy23/amd_pstate_prefcore_ranking:2 > 21 > /sys/devices/system/cpu/cpufreq/policy24/amd_pstate_prefcore_ranking:1 > 91 > /sys/devices/system/cpu/cpufreq/policy25/amd_pstate_prefcore_ranking:2 > 01 > /sys/devices/system/cpu/cpufreq/policy26/amd_pstate_prefcore_ranking:1 > 86 > /sys/devices/system/cpu/cpufreq/policy27/amd_pstate_prefcore_ranking:1 > 96 > /sys/devices/system/cpu/cpufreq/policy28/amd_pstate_prefcore_ranking:1 > 71 > /sys/devices/system/cpu/cpufreq/policy29/amd_pstate_prefcore_ranking:1 > 66 > /sys/devices/system/cpu/cpufreq/policy30/amd_pstate_prefcore_ranking:1 > 76 > /sys/devices/system/cpu/cpufreq/policy31/amd_pstate_prefcore_ranking:1 > 81 > ``` > > When I run `dd if=/dev/zero of=/dev/null`, the load lands onto cores 3, 5, 19 > or 21, IOW, those that have the highest `amd_pstate_prefcore_ranking` > value given `schedutil` is in use. > > If all of the above is as expected, please add: > > Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name> > > > > Would you also be able to Cc me on the next iteration of this patchset? > > [Meng, Li (Jassmine)] OK. > > Thanks. > [Meng, Li (Jassmine)] Thanks a lot. Based on Wyes's suggestion, I also made similar modifications in the next patches. All the log information above is in line with expectations. > > > > > > Thank you! > > > > > > [1] https://lore.kernel.org/lkml/5973628.lOV4Wx5bFT@natalenko.name/ > > > > > > > > > > > Changes form V6->V7: > > > > - x86: > > > > - - Modify kconfig about X86_AMD_PSTATE. > > > > - cpufreq: amd-pstate: > > > > - - modify incorrect comments about scheduler_work(). > > > > - - convert highest_perf data type. > > > > - - modify preferred core init when cpu init and online. > > > > - acpi: cppc: > > > > - - modify link of CPPC highest performance. > > > > - cpufreq: > > > > - - modify link of CPPC highest performance changed. > > > > > > > > Changes form V5->V6: > > > > - cpufreq: amd-pstate: > > > > - - modify the wrong tag order. > > > > - - modify warning about hw_prefcore sysfs attribute. > > > > - - delete duplicate comments. > > > > - - modify the variable name cppc_highest_perf to prefcore_ranking. > > > > - - modify judgment conditions for setting highest_perf. > > > > - - modify sysfs attribute for CPPC highest perf to pr_debug message. > > > > - Documentation: amd-pstate: > > > > - - modify warning: title underline too short. > > > > > > > > Changes form V4->V5: > > > > - cpufreq: amd-pstate: > > > > - - modify sysfs attribute for CPPC highest perf. > > > > - - modify warning about comments > > > > - - rebase linux-next > > > > - cpufreq: > > > > - - Moidfy warning about function declarations. > > > > - Documentation: amd-pstate: > > > > - - align with ``amd-pstat`` > > > > > > > > Changes form V3->V4: > > > > - Documentation: amd-pstate: > > > > - - Modify inappropriate descriptions. > > > > > > > > Changes form V2->V3: > > > > - x86: > > > > - - Modify kconfig and description. > > > > - cpufreq: amd-pstate: > > > > - - Add Co-developed-by tag in commit message. > > > > - cpufreq: > > > > - - Modify commit message. > > > > - Documentation: amd-pstate: > > > > - - Modify inappropriate descriptions. > > > > > > > > Changes form V1->V2: > > > > - acpi: cppc: > > > > - - Add reference link. > > > > - cpufreq: > > > > - - Moidfy link error. > > > > - cpufreq: amd-pstate: > > > > - - Init the priorities of all online CPUs > > > > - - Use a single variable to represent the status of preferred core. > > > > - Documentation: > > > > - - Default enabled preferred core. > > > > - Documentation: amd-pstate: > > > > - - Modify inappropriate descriptions. > > > > - - Default enabled preferred core. > > > > - - Use a single variable to represent the status of preferred core. > > > > > > > > Meng Li (7): > > > > x86: Drop CPU_SUP_INTEL from SCHED_MC_PRIO for the expansion. > > > > acpi: cppc: Add get the highest performance cppc control > > > > cpufreq: amd-pstate: Enable amd-pstate preferred core supporting. > > > > cpufreq: Add a notification message that the highest perf has changed > > > > cpufreq: amd-pstate: Update amd-pstate preferred core ranking > > > > dynamically > > > > Documentation: amd-pstate: introduce amd-pstate preferred core > > > > Documentation: introduce amd-pstate preferrd core mode kernel > > > command > > > > line options > > > > > > > > .../admin-guide/kernel-parameters.txt | 5 + > > > > Documentation/admin-guide/pm/amd-pstate.rst | 59 +++++- > > > > arch/x86/Kconfig | 5 +- > > > > drivers/acpi/cppc_acpi.c | 13 ++ > > > > drivers/acpi/processor_driver.c | 6 + > > > > drivers/cpufreq/amd-pstate.c | 186 ++++++++++++++++-- > > > > drivers/cpufreq/cpufreq.c | 13 ++ > > > > include/acpi/cppc_acpi.h | 5 + > > > > include/linux/amd-pstate.h | 10 + > > > > include/linux/cpufreq.h | 5 + > > > > 10 files changed, 285 insertions(+), 22 deletions(-) > > > > > > > > > > > > > > > > > -- > > > Oleksandr Natalenko (post-factum) > > > > > -- > Oleksandr Natalenko (post-factum)
On Mon, Oct 09, 2023 at 10:49:25AM +0800, Meng Li wrote: > Hi all: > > The core frequency is subjected to the process variation in semiconductors. > Not all cores are able to reach the maximum frequency respecting the > infrastructure limits. Consequently, AMD has redefined the concept of > maximum frequency of a part. This means that a fraction of cores can reach > maximum frequency. To find the best process scheduling policy for a given > scenario, OS needs to know the core ordering informed by the platform through > highest performance capability register of the CPPC interface. > > Earlier implementations of amd-pstate preferred core only support a static > core ranking and targeted performance. Now it has the ability to dynamically > change the preferred core based on the workload and platform conditions and > accounting for thermals and aging. > > Amd-pstate driver utilizes the functions and data structures provided by > the ITMT architecture to enable the scheduler to favor scheduling on cores > which can be get a higher frequency with lower voltage. > We call it amd-pstate preferred core. > > Here sched_set_itmt_core_prio() is called to set priorities and > sched_set_itmt_support() is called to enable ITMT feature. > Amd-pstate driver uses the highest performance value to indicate > the priority of CPU. The higher value has a higher priority. > > Amd-pstate driver will provide an initial core ordering at boot time. > It relies on the CPPC interface to communicate the core ranking to the > operating system and scheduler to make sure that OS is choosing the cores > with highest performance firstly for scheduling the process. When amd-pstate > driver receives a message with the highest performance change, it will > update the core ranking. > > Changes form V7->V8: > - all: > - - pick up Review-By flag added by Mario and Ray. > - cpufreq: amd-pstate: > - - use hw_prefcore embeds into cpudata structure. > - - delete preferred core init from cpu online/off. Thanks! Series are Reviewed-by: Huang Rui <ray.huang@amd.com> > > Changes form V6->V7: > - x86: > - - Modify kconfig about X86_AMD_PSTATE. > - cpufreq: amd-pstate: > - - modify incorrect comments about scheduler_work(). > - - convert highest_perf data type. > - - modify preferred core init when cpu init and online. > - acpi: cppc: > - - modify link of CPPC highest performance. > - cpufreq: > - - modify link of CPPC highest performance changed. > > Changes form V5->V6: > - cpufreq: amd-pstate: > - - modify the wrong tag order. > - - modify warning about hw_prefcore sysfs attribute. > - - delete duplicate comments. > - - modify the variable name cppc_highest_perf to prefcore_ranking. > - - modify judgment conditions for setting highest_perf. > - - modify sysfs attribute for CPPC highest perf to pr_debug message. > - Documentation: amd-pstate: > - - modify warning: title underline too short. > > Changes form V4->V5: > - cpufreq: amd-pstate: > - - modify sysfs attribute for CPPC highest perf. > - - modify warning about comments > - - rebase linux-next > - cpufreq: > - - Moidfy warning about function declarations. > - Documentation: amd-pstate: > - - align with ``amd-pstat`` > > Changes form V3->V4: > - Documentation: amd-pstate: > - - Modify inappropriate descriptions. > > Changes form V2->V3: > - x86: > - - Modify kconfig and description. > - cpufreq: amd-pstate: > - - Add Co-developed-by tag in commit message. > - cpufreq: > - - Modify commit message. > - Documentation: amd-pstate: > - - Modify inappropriate descriptions. > > Changes form V1->V2: > - acpi: cppc: > - - Add reference link. > - cpufreq: > - - Moidfy link error. > - cpufreq: amd-pstate: > - - Init the priorities of all online CPUs > - - Use a single variable to represent the status of preferred core. > - Documentation: > - - Default enabled preferred core. > - Documentation: amd-pstate: > - - Modify inappropriate descriptions. > - - Default enabled preferred core. > - - Use a single variable to represent the status of preferred core. > > Meng Li (7): > x86: Drop CPU_SUP_INTEL from SCHED_MC_PRIO for the expansion. > acpi: cppc: Add get the highest performance cppc control > cpufreq: amd-pstate: Enable amd-pstate preferred core supporting. > cpufreq: Add a notification message that the highest perf has changed > cpufreq: amd-pstate: Update amd-pstate preferred core ranking > dynamically > Documentation: amd-pstate: introduce amd-pstate preferred core > Documentation: introduce amd-pstate preferrd core mode kernel command > line options > > .../admin-guide/kernel-parameters.txt | 5 + > Documentation/admin-guide/pm/amd-pstate.rst | 59 +++++- > arch/x86/Kconfig | 5 +- > drivers/acpi/cppc_acpi.c | 13 ++ > drivers/acpi/processor_driver.c | 6 + > drivers/cpufreq/amd-pstate.c | 186 ++++++++++++++++-- > drivers/cpufreq/cpufreq.c | 13 ++ > include/acpi/cppc_acpi.h | 5 + > include/linux/amd-pstate.h | 10 + > include/linux/cpufreq.h | 5 + > 10 files changed, 285 insertions(+), 22 deletions(-) > > -- > 2.34.1 >