Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp6149550rdb; Mon, 18 Sep 2023 05:49:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG54XzddaNbyhvqg9bCHhXY6ot+cbNfCKJrZkPOmqMby0Ifl89FrwF5HAp/xEB6UcjcKdbf X-Received: by 2002:a17:903:2305:b0:1c5:6d04:75ee with SMTP id d5-20020a170903230500b001c56d0475eemr2811449plh.21.1695041364810; Mon, 18 Sep 2023 05:49:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1695041364; cv=pass; d=google.com; s=arc-20160816; b=VLtI/qsCQtvJ982F3IZMlqIHu2oJ2X0spp3QOm+JZXegjSNZiUDd4G0eLMC+CM62p8 orRMjTi4VrcW+5BBQHal+5x9KlfU3oj5oPFtWMrp/ESIOyIO3BVEPOyjXrHlnXKPkW6F dsCGnsVv2O8L2lEQ8CGHWkZh6rzLF4OxLKfK6IU6Y2vOJ9kkVswm5lqVlM/al2XMpDXl K6IBtmfzQPaliZx1bXHpk37B41h8jcbP0n9gjNBzCHuEjDb8yAQx0Vf6WWaNqrtSGgvA HjflfrowbMUPNy98ZeIBzc93lB6YM90Cpk+nVY9JqOXl/j6b1SarMs+WD4aZfDGWSPoA EWww== 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=Svr9vMr85sPOS7iq5wIO8wycccVehap+YpEZF5UKLvQ=; fh=Ux3YgDYVPXDd/Bh2648Da5vJU6LEkGipfecwSr9Umfo=; b=EPXIuyYxUd1aowRK4k+uVML3B/bh2iGRwGgVRBbyeQNft8TCaeLQUSlYQ/ZI4OeW4w aMaVCzAbifoZg0xTscir/Jt//L2eJMFz7PnVZ7rS3GHzCm15YELDRw4nD6El63x7pW1q GhHeHCqmfKxvj56oMFfjj65Y1VEUHYiHG7JxEvOD2mtLA2/jinra7FzIu9xSVUvQYrRH CWDvvKJHcxC8R49cpHRuCLHgayMzjcFRXSgnDesg9B9E/gn4xeX9W1BZzzsJABNu5Dgj 1Q+lN70zUguxv0yoZWRHRP90BoQ5oQU+Qt+MW7wCFHDxTYciad8BS/fTk8g+ALgWL9Q9 uZ4A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="kIx/SeY0"; 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 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id ay6-20020a1709028b8600b001b89bab468esi7837993plb.107.2023.09.18.05.49.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 05:49:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="kIx/SeY0"; 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 23.128.96.32 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 8DD0F80B5A3D; Mon, 18 Sep 2023 01:17:07 -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 S240349AbjIRIQV (ORCPT + 99 others); Mon, 18 Sep 2023 04:16:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240850AbjIRIPq (ORCPT ); Mon, 18 Sep 2023 04:15:46 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2088.outbound.protection.outlook.com [40.107.237.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9367610F1; Mon, 18 Sep 2023 01:14:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gVAnxL0RRZAadAtvY84y3ii/OL4Km2l/WY+3gNMVGKSGF53tTgL4Aso98c2Pf1HItKTmLZJRgi7C8EJ+j1yZKakENR9/S/dmgWLA4Bv68zCGgUoAOFZA+tGhubpjR4ZUQlvApydIgDR4DYYvTXHJ5H8ReffZ7WjfCI7sSFm4x/9uLwMdtLrCuPEa3IGMQncyYy7wBoiGlF5Ob9yypmvxJ4W/n99e+WBuu/hi6VMLdBTS01EVyRlpS/p4TDJ+J6sBFUBSLquG1MY/n/CIKQWZtM3Vvkvvz+7WYBDADioL2NhQ42zO++S0wLGw22MPFYJ5DlZQL1lVLXt4ez1Zltb7PA== 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=Svr9vMr85sPOS7iq5wIO8wycccVehap+YpEZF5UKLvQ=; b=DARN8WVK1VZfQt9v9xlQ0jlmkWjz0UiJxhg4+2cfZtEwYfNIgqDie2gCxcDzhZ0KUOw4g5TqbyOVJW4vf5IEbIb349z/cE61aQLjiKP9JrsGKHQimA91QK7/DfIe1CC6ZA3eVtrfjSpUm3o9z5IOTiXu+1FUfDNiFsK9SQR+svohvhBzrtYR7b20HvtRMT3/YTt18QEIMlc02yWy0xgou/TsNK3EHlgettjhb/ZA8mXkVL4NX1k9TsMxcC2w8qBbvzHrjO0xs+FoS6zPBmmB6LVU5YjQptZcImC+LdiWdisX1zhet2w3kGfwRgKldyYY7BiIa96uTbnYFxs8CVfbHQ== 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=Svr9vMr85sPOS7iq5wIO8wycccVehap+YpEZF5UKLvQ=; b=kIx/SeY0WEbj273PfqWa6Y4iNljXXetTpmepW54BOfljmkvo/u3nsG/RugNskp0K7vJXZujoIC9iWCYjJIhmko4lyKFqHeLEbFZKbrRFCD77L2YCPv03kOQ6huPxutvRcVFhS/BOiTU8QtbM6FrdK6glyIn8mN/vW73pVRgJGgI= Received: from DS0PR17CA0016.namprd17.prod.outlook.com (2603:10b6:8:191::7) by PH0PR12MB5436.namprd12.prod.outlook.com (2603:10b6:510:eb::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.27; Mon, 18 Sep 2023 08:14:32 +0000 Received: from SN1PEPF00026367.namprd02.prod.outlook.com (2603:10b6:8:191:cafe::f4) by DS0PR17CA0016.outlook.office365.com (2603:10b6:8:191::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.27 via Frontend Transport; Mon, 18 Sep 2023 08:14:31 +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 SN1PEPF00026367.mail.protection.outlook.com (10.167.241.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.20 via Frontend Transport; Mon, 18 Sep 2023 08:14:31 +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; Mon, 18 Sep 2023 03:14:26 -0500 From: Meng Li To: "Rafael J . Wysocki" , Huang Rui CC: , , , , Shuah Khan , , "Nathan Fontenot" , Deepak Sharma , Alex Deucher , Mario Limonciello , Shimmer Huang , "Perry Yuan" , Xiaojian Du , Viresh Kumar , Borislav Petkov , Meng Li Subject: [PATCH V7 0/7] amd-pstate preferred core Date: Mon, 18 Sep 2023 16:14:00 +0800 Message-ID: <20230918081407.756858-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: SN1PEPF00026367:EE_|PH0PR12MB5436:EE_ X-MS-Office365-Filtering-Correlation-Id: 8cbf6ee3-3578-4826-4bed-08dbb81f495c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4440z9IRKIMRoradHND1Xwu37k0GWj9GtE/20Bq540AR8PVqJdY2zDUH56Tam4v8G87DjCx9fW78ssXYjx/aJiSqlKG/qPlHfdJK57e93Iv8+hBvt1kmApwu1IrS2UvSweMHhB22CHfUYUQXtMWm7UmH9oXuStZlgwerxD9+kz528r1MWV3PnT5Sw1kZkBv4XEqS3LIJG5uKWjGGIDblnkvJ3tezHqmhYRZ/aH7S2SemKsbEAFh/V998VNQAmQ9w0Q3TonynNSc6lxdVahKF6yx8U7eQpSf9kBpu1aVEj+E/ppEHo3m2/EwqiZjOlXoRv5p38py45mEbAGP5wBK00sngCO0VbKwMUQ5Q17D0so7OvSvzFxGQhBYQclrYrIz8Qd190Mwr361IVallRMiO6KpBPJdf7blhqj9VzUrPjp3DO24FSSChyKeEExsvhqtt553rp1ANbh5v9RhWwsoq7vN3SLb3VJV8jm4j9B581R4DgFR9HRvALgRRFQ2M3a1qI6aATL5cgva3b54vRJCoEJdm3XDRIkMNE9AGukeDWMjOymeawS6dqEg7lciPn+GSu3EAULwDPRXnCeH1ZfAMqox1Y5qpwXcDr+6cG8mADA67MKCqhoFslvU6bs+SeyDNB4R4+yUTQCk+7dG1DstKqNSlB8NgEuSXo5v7n4eyaLPgWxI0wEtvaLFeuhrgkzL02Q2r+0VhNeqQ+BK6A+QfAOlgUbhrQbFe2UeY7Uoco14/VGp0mVP3PPvNe5kjyJ6oByhhb6szvoOvooBRoK+TaA== 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)(136003)(376002)(39860400002)(346002)(396003)(82310400011)(186009)(451199024)(1800799009)(36840700001)(46966006)(40470700004)(16526019)(1076003)(2616005)(81166007)(426003)(356005)(26005)(336012)(40460700003)(82740400003)(47076005)(36860700001)(40480700001)(83380400001)(54906003)(70586007)(70206006)(110136005)(2906002)(86362001)(41300700001)(4326008)(8676002)(8936002)(5660300002)(316002)(6636002)(6666004)(7696005)(36756003)(478600001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2023 08:14:31.6714 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8cbf6ee3-3578-4826-4bed-08dbb81f495c 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: SN1PEPF00026367.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5436 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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: 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]); Mon, 18 Sep 2023 01:17:07 -0700 (PDT) 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 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 | 58 +++++- arch/x86/Kconfig | 5 +- drivers/acpi/cppc_acpi.c | 13 ++ drivers/acpi/processor_driver.c | 6 + drivers/cpufreq/amd-pstate.c | 197 ++++++++++++++++-- drivers/cpufreq/cpufreq.c | 13 ++ include/acpi/cppc_acpi.h | 5 + include/linux/amd-pstate.h | 6 + include/linux/cpufreq.h | 5 + 10 files changed, 291 insertions(+), 22 deletions(-) -- 2.34.1