Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c5320c8 authored by Jacob Shin's avatar Jacob Shin Committed by Rafael J. Wysocki
Browse files

cpufreq: AMD "frequency sensitivity feedback" powersave bias for ondemand governor



Future AMD processors, starting with Family 16h, can provide software
with feedback on how the workload may respond to frequency change --
memory-bound workloads will not benefit from higher frequency, where
as compute-bound workloads will. This patch enables this "frequency
sensitivity feedback" to aid the ondemand governor to make better
frequency change decisions by hooking into the powersave bias.

Signed-off-by: default avatarJacob Shin <jacob.shin@amd.com>
Acked-by: default avatarThomas Renninger <trenn@suse.de>
Acked-by: default avatarBorislav Petkov <bp@suse.de>
Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent fb30809e
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -167,6 +167,27 @@ of load evaluation and helping the CPU stay at its top speed when truly
busy, rather than shifting back and forth in speed. This tunable has no
effect on behavior at lower speeds/lower CPU loads.

powersave_bias: this parameter takes a value between 0 to 1000. It
defines the percentage (times 10) value of the target frequency that
will be shaved off of the target. For example, when set to 100 -- 10%,
when ondemand governor would have targeted 1000 MHz, it will target
1000 MHz - (10% of 1000 MHz) = 900 MHz instead. This is set to 0
(disabled) by default.
When AMD frequency sensitivity powersave bias driver --
drivers/cpufreq/amd_freq_sensitivity.c is loaded, this parameter
defines the workload frequency sensitivity threshold in which a lower
frequency is chosen instead of ondemand governor's original target.
The frequency sensitivity is a hardware reported (on AMD Family 16h
Processors and above) value between 0 to 100% that tells software how
the performance of the workload running on a CPU will change when
frequency changes. A workload with sensitivity of 0% (memory/IO-bound)
will not perform any better on higher core frequency, whereas a
workload with sensitivity of 100% (CPU-bound) will perform better
higher the frequency. When the driver is loaded, this is set to 400
by default -- for CPUs running workloads with sensitivity value below
40%, a lower frequency is chosen. Unloading the driver or writing 0
will disable this feature.


2.5 Conservative
----------------
+1 −0
Original line number Diff line number Diff line
@@ -182,6 +182,7 @@
#define X86_FEATURE_PTS		(7*32+ 6) /* Intel Package Thermal Status */
#define X86_FEATURE_DTHERM	(7*32+ 7) /* Digital Thermal Sensor */
#define X86_FEATURE_HW_PSTATE	(7*32+ 8) /* AMD HW-PState */
#define X86_FEATURE_PROC_FEEDBACK (7*32+ 9) /* AMD ProcFeedbackInterface */

/* Virtualization flags: Linux defined, word 8 */
#define X86_FEATURE_TPR_SHADOW  (8*32+ 0) /* Intel TPR Shadow */
+2 −1
Original line number Diff line number Diff line
@@ -39,8 +39,9 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c)
		{ X86_FEATURE_APERFMPERF,	CR_ECX, 0, 0x00000006, 0 },
		{ X86_FEATURE_EPB,		CR_ECX, 3, 0x00000006, 0 },
		{ X86_FEATURE_XSAVEOPT,		CR_EAX,	0, 0x0000000d, 1 },
		{ X86_FEATURE_CPB,		CR_EDX, 9, 0x80000007, 0 },
		{ X86_FEATURE_HW_PSTATE,	CR_EDX, 7, 0x80000007, 0 },
		{ X86_FEATURE_CPB,		CR_EDX, 9, 0x80000007, 0 },
		{ X86_FEATURE_PROC_FEEDBACK,	CR_EDX,11, 0x80000007, 0 },
		{ X86_FEATURE_NPT,		CR_EDX, 0, 0x8000000a, 0 },
		{ X86_FEATURE_LBRV,		CR_EDX, 1, 0x8000000a, 0 },
		{ X86_FEATURE_SVML,		CR_EDX, 2, 0x8000000a, 0 },
+17 −0
Original line number Diff line number Diff line
@@ -129,6 +129,23 @@ config X86_POWERNOW_K8

	  For details, take a look at <file:Documentation/cpu-freq/>.

config X86_AMD_FREQ_SENSITIVITY
	tristate "AMD frequency sensitivity feedback powersave bias"
	depends on CPU_FREQ_GOV_ONDEMAND && X86_ACPI_CPUFREQ && CPU_SUP_AMD
	help
	  This adds AMD-specific powersave bias function to the ondemand
	  governor, which allows it to make more power-conscious frequency
	  change decisions based on feedback from hardware (availble on AMD
	  Family 16h and above).

	  Hardware feedback tells software how "sensitive" to frequency changes
	  the CPUs' workloads are. CPU-bound workloads will be more sensitive
	  -- they will perform better as frequency increases. Memory/IO-bound
	  workloads will be less sensitive -- they will not necessarily perform
	  better as frequency increases.

	  If in doubt, say N.

config X86_GX_SUSPMOD
	tristate "Cyrix MediaGX/NatSemi Geode Suspend Modulation"
	depends on X86_32 && PCI
+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ obj-$(CONFIG_X86_SPEEDSTEP_CENTRINO) += speedstep-centrino.o
obj-$(CONFIG_X86_P4_CLOCKMOD)		+= p4-clockmod.o
obj-$(CONFIG_X86_CPUFREQ_NFORCE2)	+= cpufreq-nforce2.o
obj-$(CONFIG_X86_INTEL_PSTATE)		+= intel_pstate.o
obj-$(CONFIG_X86_AMD_FREQ_SENSITIVITY)	+= amd_freq_sensitivity.o

##################################################################################
# ARM SoC drivers
Loading