Skip to content

Commit 32b88f5

Browse files
committed
Merge branch 'pm-cpufreq'
Merge cpufreq changes for 6.9-rc1: - Enable preferred core support in the amd-pstate cpufreq driver (Meng Li). - Fix min_perf assignment in amd_pstate_adjust_perf() and make the min/max limit perf values in amd-pstate always stay within the (highest perf, lowest perf) range (Tor Vic, Meng Li). - Change default transition delay in cpufreq to 2ms (Qais Yousef). - Drop long-unused cpudata::prev_cummulative_iowait from the intel_pstate cpufreq driver (Jiri Slaby). - Allow intel_pstate to assign model-specific values to strings used in the EPP sysfs interface and make it do so on Meteor Lake (Srinivas Pandruvada). - Remove references to 10ms minimum sampling rate from comments in the cpufreq code (Pierre Gondois). - Prevent scaling_cur_freq from exceeding scaling_max_freq when the latter is an inefficient frequency (Shivnandan Kumar). - Honour transition_latency over transition_delay_us in cpufreq (Qais Yousef). - Stop unregistering cpufreq cooling on CPU hot-remove (Viresh Kumar). - General enhancements / cleanups to ARM cpufreq drivers (tianyu2, Nícolas F. R. A. Prado, Erick Archer, Arnd Bergmann, Anastasia Belova). - Update cpufreq-dt-platdev to block/approve devices (Richard Acayan). - Make the SCMI cpufreq driver get a transition delay value from firmware (Pierre Gondois). * pm-cpufreq: (28 commits) cpufreq: scmi: Set transition_delay_us firmware: arm_scmi: Populate fast channel rate_limit firmware: arm_scmi: Populate perf commands rate_limit cpufreq: Don't unregister cpufreq cooling on CPU hotplug cpufreq: Honour transition_latency over transition_delay_us cpufreq: Limit resolving a frequency to policy min/max cpufreq: amd-pstate: adjust min/max limit perf cpufreq: Remove references to 10ms min sampling rate cpufreq: intel_pstate: Update default EPPs for Meteor Lake cpufreq: intel_pstate: Allow model specific EPPs cpufreq: qcom-hw: add CONFIG_COMMON_CLK dependency cpufreq: dt-platdev: block SDM670 in cpufreq-dt-platdev cpufreq: intel_pstate: remove cpudata::prev_cummulative_iowait cpufreq: Change default transition delay to 2ms cpufreq: amd-pstate: Fix min_perf assignment in amd_pstate_adjust_perf() Documentation: PM: amd-pstate: Fix section title underline Documentation: introduce amd-pstate preferrd core mode kernel command line options Documentation: amd-pstate: introduce amd-pstate preferred core cpufreq: amd-pstate: Update amd-pstate preferred core ranking dynamically ACPI: cpufreq: Add highest perf change notification ...
2 parents 7874b58 + 6b7195d commit 32b88f5

25 files changed

+502
-80
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,11 @@
374374
selects a performance level in this range and appropriate
375375
to the current workload.
376376

377+
amd_prefcore=
378+
[X86]
379+
disable
380+
Disable amd-pstate preferred core.
381+
377382
amijoy.map= [HW,JOY] Amiga joystick support
378383
Map of devices attached to JOY0DAT and JOY1DAT
379384
Format: <a>,<b>

Documentation/admin-guide/pm/amd-pstate.rst

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,8 @@ platforms. The AMD P-States mechanism is the more performance and energy
300300
efficiency frequency management method on AMD processors.
301301

302302

303-
AMD Pstate Driver Operation Modes
304-
=================================
303+
``amd-pstate`` Driver Operation Modes
304+
======================================
305305

306306
``amd_pstate`` CPPC has 3 operation modes: autonomous (active) mode,
307307
non-autonomous (passive) mode and guided autonomous (guided) mode.
@@ -353,6 +353,48 @@ is activated. In this mode, driver requests minimum and maximum performance
353353
level and the platform autonomously selects a performance level in this range
354354
and appropriate to the current workload.
355355

356+
``amd-pstate`` Preferred Core
357+
=================================
358+
359+
The core frequency is subjected to the process variation in semiconductors.
360+
Not all cores are able to reach the maximum frequency respecting the
361+
infrastructure limits. Consequently, AMD has redefined the concept of
362+
maximum frequency of a part. This means that a fraction of cores can reach
363+
maximum frequency. To find the best process scheduling policy for a given
364+
scenario, OS needs to know the core ordering informed by the platform through
365+
highest performance capability register of the CPPC interface.
366+
367+
``amd-pstate`` preferred core enables the scheduler to prefer scheduling on
368+
cores that can achieve a higher frequency with lower voltage. The preferred
369+
core rankings can dynamically change based on the workload, platform conditions,
370+
thermals and ageing.
371+
372+
The priority metric will be initialized by the ``amd-pstate`` driver. The ``amd-pstate``
373+
driver will also determine whether or not ``amd-pstate`` preferred core is
374+
supported by the platform.
375+
376+
``amd-pstate`` driver will provide an initial core ordering when the system boots.
377+
The platform uses the CPPC interfaces to communicate the core ranking to the
378+
operating system and scheduler to make sure that OS is choosing the cores
379+
with highest performance firstly for scheduling the process. When ``amd-pstate``
380+
driver receives a message with the highest performance change, it will
381+
update the core ranking and set the cpu's priority.
382+
383+
``amd-pstate`` Preferred Core Switch
384+
=====================================
385+
Kernel Parameters
386+
-----------------
387+
388+
``amd-pstate`` peferred core`` has two states: enable and disable.
389+
Enable/disable states can be chosen by different kernel parameters.
390+
Default enable ``amd-pstate`` preferred core.
391+
392+
``amd_prefcore=disable``
393+
394+
For systems that support ``amd-pstate`` preferred core, the core rankings will
395+
always be advertised by the platform. But OS can choose to ignore that via the
396+
kernel parameter ``amd_prefcore=disable``.
397+
356398
User Space Interface in ``sysfs`` - General
357399
===========================================
358400

@@ -385,6 +427,19 @@ control its functionality at the system level. They are located in the
385427
to the operation mode represented by that string - or to be
386428
unregistered in the "disable" case.
387429

430+
``prefcore``
431+
Preferred core state of the driver: "enabled" or "disabled".
432+
433+
"enabled"
434+
Enable the ``amd-pstate`` preferred core.
435+
436+
"disabled"
437+
Disable the ``amd-pstate`` preferred core
438+
439+
440+
This attribute is read-only to check the state of preferred core set
441+
by the kernel parameter.
442+
388443
``cpupower`` tool support for ``amd-pstate``
389444
===============================================
390445

Documentation/power/opp.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ dev_pm_opp_get_opp_count
305305
{
306306
/* Do things */
307307
num_available = dev_pm_opp_get_opp_count(dev);
308-
speeds = kzalloc(sizeof(u32) * num_available, GFP_KERNEL);
308+
speeds = kcalloc(num_available, sizeof(u32), GFP_KERNEL);
309309
/* populate the table in increasing order */
310310
freq = 0;
311311
while (!IS_ERR(opp = dev_pm_opp_find_freq_ceil(dev, &freq))) {

Documentation/translations/zh_CN/power/opp.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ dev_pm_opp_get_opp_count
274274
{
275275
/* 做一些事情 */
276276
num_available = dev_pm_opp_get_opp_count(dev);
277-
speeds = kzalloc(sizeof(u32) * num_available, GFP_KERNEL);
277+
speeds = kcalloc(num_available, sizeof(u32), GFP_KERNEL);
278278
/* 按升序填充表 */
279279
freq = 0;
280280
while (!IS_ERR(opp = dev_pm_opp_find_freq_ceil(dev, &freq))) {

arch/x86/Kconfig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,8 +1054,9 @@ config SCHED_MC
10541054

10551055
config SCHED_MC_PRIO
10561056
bool "CPU core priorities scheduler support"
1057-
depends on SCHED_MC && CPU_SUP_INTEL
1058-
select X86_INTEL_PSTATE
1057+
depends on SCHED_MC
1058+
select X86_INTEL_PSTATE if CPU_SUP_INTEL
1059+
select X86_AMD_PSTATE if CPU_SUP_AMD && ACPI
10591060
select CPU_FREQ
10601061
default y
10611062
help

drivers/acpi/cppc_acpi.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,6 +1157,19 @@ int cppc_get_nominal_perf(int cpunum, u64 *nominal_perf)
11571157
return cppc_get_perf(cpunum, NOMINAL_PERF, nominal_perf);
11581158
}
11591159

1160+
/**
1161+
* cppc_get_highest_perf - Get the highest performance register value.
1162+
* @cpunum: CPU from which to get highest performance.
1163+
* @highest_perf: Return address.
1164+
*
1165+
* Return: 0 for success, -EIO otherwise.
1166+
*/
1167+
int cppc_get_highest_perf(int cpunum, u64 *highest_perf)
1168+
{
1169+
return cppc_get_perf(cpunum, HIGHEST_PERF, highest_perf);
1170+
}
1171+
EXPORT_SYMBOL_GPL(cppc_get_highest_perf);
1172+
11601173
/**
11611174
* cppc_get_epp_perf - Get the epp register value.
11621175
* @cpunum: CPU from which to get epp preference value.

drivers/acpi/processor_driver.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80
2828
#define ACPI_PROCESSOR_NOTIFY_POWER 0x81
2929
#define ACPI_PROCESSOR_NOTIFY_THROTTLING 0x82
30+
#define ACPI_PROCESSOR_NOTIFY_HIGEST_PERF_CHANGED 0x85
3031

3132
MODULE_AUTHOR("Paul Diefenbaugh");
3233
MODULE_DESCRIPTION("ACPI Processor Driver");
@@ -83,6 +84,11 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
8384
acpi_bus_generate_netlink_event(device->pnp.device_class,
8485
dev_name(&device->dev), event, 0);
8586
break;
87+
case ACPI_PROCESSOR_NOTIFY_HIGEST_PERF_CHANGED:
88+
cpufreq_update_limits(pr->id);
89+
acpi_bus_generate_netlink_event(device->pnp.device_class,
90+
dev_name(&device->dev), event, 0);
91+
break;
8692
default:
8793
acpi_handle_debug(handle, "Unsupported event [0x%x]\n", event);
8894
break;

drivers/cpufreq/Kconfig.arm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ config ARM_QCOM_CPUFREQ_NVMEM
173173
config ARM_QCOM_CPUFREQ_HW
174174
tristate "QCOM CPUFreq HW driver"
175175
depends on ARCH_QCOM || COMPILE_TEST
176+
depends on COMMON_CLK
176177
help
177178
Support for the CPUFreq HW driver.
178179
Some QCOM chipsets have a HW engine to offload the steps

0 commit comments

Comments
 (0)