From patchwork Fri Oct 13 03:31:11 2023
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: "Meng, Li (Jassmine)"
X-Patchwork-Id: 13420102
Return-Path:
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
aws-us-west-2-korg-lkml-1.web.codeaurora.org
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
by smtp.lore.kernel.org (Postfix) with ESMTP id 2F9C1CDB47E
for ; Fri, 13 Oct 2023 03:32:00 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S229550AbjJMDb6 (ORCPT );
Thu, 12 Oct 2023 23:31:58 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43936 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S229436AbjJMDb4 (ORCPT
); Thu, 12 Oct 2023 23:31:56 -0400
Received: from NAM02-SN1-obe.outbound.protection.outlook.com
(mail-sn1nam02on2065.outbound.protection.outlook.com [40.107.96.65])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FB79BB;
Thu, 12 Oct 2023 20:31:50 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
b=SOQF3ChJiQwcrR1VNIDTV/L5NQ5JFyOMplXkRSqQfl/1Kxj3vVS8TDzUbdahB1qC75povCD0NrtTHZSG2U8mDRt8kyvsqscVuUCrwiSSUurUbxM35ojOd2FBTTAx5QV1fH9ed7mxpSxFW71sIwmMww+XkI7EYFg8Tcei0S80EEZmgkAgwmfejDNg41rmV6MnE93cs/SG8ploItOpC6o50sSvmYXNhheSsktGbKya1vyUM16KyIP/CJwFlv1JXC+E8Oz0gV+POGVOVfUDSFeNMPLqusqXkJvYFXO0uiGvOnV8dBW2nXDPgkXGNy8FK6+16GTO4qBd8wqelGSVtz7BxA==
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=uiWgNhl01VvplaAyf2iuYByBio3MNffw7BQYB+fLP9o=;
b=K6Y2CTHPjSKdE95IJTA8FpqYsn1GRGZj1cbEP+ExEjwe7ixZl2jIw74eEFhFyqDH06ga/PDrx775OybmfaNtW0OjRV0y4JF0eS8gViQJcJuhNrxQsyFnfgc6ONn3fN/WjcWcQC9Ry3+nkieGVFIAXA8B1JyBQ++0ENuSayCVvoHJVcnjb9n9M0LyWhCzUcUX2lS4CiLkv2CA8KjFw/nW6jui5XJ1Za2o27WI7Ga4qRYD6Q29be+7kAh5HtaPySvWAxvtrV/D0GLIXBr/M7O2QsajVPEyiwhUNElBGSGrvPbvyeGmf5mkcL4TgUO8oLnfSg3cLF+CrCclEkkbM765CQ==
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=uiWgNhl01VvplaAyf2iuYByBio3MNffw7BQYB+fLP9o=;
b=NXgTWxlWYL30aRyGHbXYt2KZuZoirAWRfX1jM4/tCigOHePMC75iYHpxXXCIHiIvZLmphNPCg8nzj+Hjws34F84vGc2kADLFlXEwKZKaNocbo1euoCRFhqRtyt9Zu51LQESfLdVXJm0OuwE/WRnRYzYdPuZ31M43exySEwSofpk=
Received: from MW4PR04CA0340.namprd04.prod.outlook.com (2603:10b6:303:8a::15)
by DS7PR12MB5717.namprd12.prod.outlook.com (2603:10b6:8:70::19) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.44; Fri, 13 Oct
2023 03:31:47 +0000
Received: from CO1PEPF000042A9.namprd03.prod.outlook.com
(2603:10b6:303:8a:cafe::df) by MW4PR04CA0340.outlook.office365.com
(2603:10b6:303:8a::15) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.28 via Frontend
Transport; Fri, 13 Oct 2023 03:31:47 +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
CO1PEPF000042A9.mail.protection.outlook.com (10.167.243.38) with Microsoft
SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
15.20.6838.22 via Frontend Transport; Fri, 13 Oct 2023 03:31:47 +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; Thu, 12 Oct
2023 22:31:41 -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 ,
"Oleksandr Natalenko" ,
Meng Li
Subject: [RESEND PATCH V9 0/7] amd-pstate preferred core
Date: Fri, 13 Oct 2023 11:31:11 +0800
Message-ID: <20231013033118.3759311-1-li.meng@amd.com>
X-Mailer: git-send-email 2.34.1
MIME-Version: 1.0
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: CO1PEPF000042A9:EE_|DS7PR12MB5717:EE_
X-MS-Office365-Filtering-Correlation-Id: 4b1caf4d-bc82-4828-b151-08dbcb9cee2f
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info:
KUCM5bfHpEr/TDCSTuhKi/rMn7H+8R1yyrzylMVBvDgeTzADjsVTNGBaFapw5le8g5dCwNPvXIBCLHKgYlCsMvSN7mIF6FDVVUSjUJnoYc5pjWnlc+/TSG9sqfCT0rpqMA7RYF3HesW7buB4icCDI2tEQKXoMM2FuJwnK4IaA0fASDR1OmdnlANUMVnB30QdDmmu+xo+cb9xtRMjaAFR4TwkNCVudeBewNZHhZfbHcpDUP7rn8mgMnCUyvxoJhKagzPDwzxWabU8CTPedo+WRYSFe6jAfAn09+12Vv0omvKEDr7ouBfRWilfnrXU3rK7lKTI7CzuAm3WTMW+/DzLJ2UVnSNTydseca7kWwIn/HnkfIN+Y3N9Zu1S5l+frrgc5dcaMH+bCSCsH6X2L0k/ixGu37HtL1F5wnZ5Vje8zQVtcIEyYXqa/dAxCZS0JVuvjWUIMwItynM6KYeAjEuSQ/TqN9mZQq4S/jVtTf+VIY/mIlVtM7BaNxbcZz7vpLRmGg77ERuj17OsOLi2UPFkz3fqGFS8DvsjFaz5SrhBR3CQAT+PvIHxf0/ZopoH8rs8waZ+xu2NytAuGZIAqlxCdJa4VaP8Bz3krQ7vPRwM9CbMwcbOtvL/4PTKylh9YWNywJ/9anIkD0kvVywYETRLy3etK32CUc7EQcV4MlN8Q6Q3IPZd/hYXbjnkAJVKCCbpTbqfMKznkCux76cBEz+GnrcjKaJfoIuKy5Max4ntJUP45wn0XDDifnGoQ/K0wcCY8s1MRat2pJjChP5VYSjJ9A==
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)(346002)(376002)(396003)(39860400002)(230922051799003)(186009)(1800799009)(64100799003)(82310400011)(451199024)(46966006)(40470700004)(36840700001)(47076005)(7696005)(26005)(36756003)(6666004)(36860700001)(478600001)(1076003)(16526019)(426003)(2616005)(336012)(110136005)(83380400001)(316002)(6636002)(70206006)(54906003)(70586007)(356005)(41300700001)(81166007)(8676002)(4326008)(8936002)(40460700003)(82740400003)(5660300002)(40480700001)(2906002)(7416002)(86362001)(36900700001);DIR:OUT;SFP:1101;
X-OriginatorOrg: amd.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2023 03:31:47.2778
(UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id:
4b1caf4d-bc82-4828-b151-08dbcb9cee2f
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:
CO1PEPF000042A9.namprd03.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5717
Precedence: bulk
List-ID:
X-Mailing-List: linux-pm@vger.kernel.org
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 V8->V9:
- all:
- - pick up Tested-By flag added by Oleksandr.
- cpufreq: amd-pstate:
- - pick up Review-By flag added by Wyes.
- - ignore modification of bug.
- - add a attribute of prefcore_ranking.
- - modify data type conversion from u32 to int.
- Documentation: amd-pstate:
- - pick up Review-By flag added by Wyes.
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 | 204 ++++++++++++++++--
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, 305 insertions(+), 20 deletions(-)