Skip to content

Commit e4d0d7f

Browse files
committed
Merge back cpufreq material for 6.9-rc1.
2 parents f0a0fc1 + c4d61a5 commit e4d0d7f

File tree

12 files changed

+365
-37
lines changed

12 files changed

+365
-37
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

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;

0 commit comments

Comments
 (0)