Skip to contentSkip to conversation

cpufreq: acpi_cpufreq: base frequency attribute support

PATCH In review Srinivas Pandruvada 2 participants 2 messages Mar 3, 2016 – Mar 4, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 cpufreq: acpi_cpufreq: base frequency attribute support

Currently scaling_available_frequencies displays list of available frequencies which can be used to set max/min or current scaling frequency.

$ cat scaling_available_frequencies
2301000 2300000 2200000 2000000 1900000 1800000 1700000 1500000 1400000
1300000 1100000 1000000 900000 800000 600000 500000

Here traditionally it is assumed that only 2301000 is a turbo frequency, which is purely opportunistic, anything else user can request and may get it.

But because of configurable thermal design power implementation in several Intel CPUs, the opportunistic frequency start can be any frequency in this range. For example it can be 2300000 or any lower value.
This change adds an optional new attribute called "base_frequency", which displays the max non-turbo frequency (base frequency). For example:

$ cat base_frequency
2200000

This will allow user to choose a certain frequency which is not opportunistic.

To be fair, other than the concept, the code is essentially copied from responses from Rafael in mailing list.

---

v5
- Rebased on the top of
"cpufreq: acpi: Allow new dynamics attributes to be added to acpi_cpufreq_attr"
- Remove loop for finding next empty slot in acpi_cpufreq_attr
- Code change suggested by Rafael

v4
- Changes for s/>/$ /
- new lines commmit description after paragraph
- coding style for for "if (ret)" in show_base_frequency

v3
-Merged Documentation and code patch to one patch.
-Created a common function to read tar which is used init and during read -Documentation and code changed suggested by Viresh
-On unsupported CPUs, user when tries to read base_frequency "Operation not supported" error will be returned.

v2
sysfs_create_file on policy->kobj is no longer possible on recent kernel versions. So we can't create selectively create base_frequency attribute on supported policies.
This version creates a base_frequency attribute, if the boot cpu supports as part of cpufreq_driver->attributes. If for some CPUs the TAR can't be read, return error.

v1:
Base version

 Documentation/cpu-freq/acpi-cpufreq.txt | 31 ++++++++++++++++++++++++
 drivers/cpufreq/acpi-cpufreq.c          | 43 +++++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+)
 create mode 100644 Documentation/cpu-freq/acpi-cpufreq.txt
Documentation/cpu-freq/acpi-cpufreq.txt new file +31 -0
new file mode 100644
index 0000000..6b3be2c
@@ -0,0 +1,31 @@
+Additional sysfs attributes for acpi-cpufreq
+
+acpi-cpufreq sysfs has following sysfs attributes in addition to standard
+cpufreq attributes:
+
+base_frequency :		Max non-turbo frequency
+				For example:
+				scaling_available_frequencies displays list
+				of available frequencies.
+
+				$ cat scaling_available_frequencies
+				2301000 2300000 2200000 2000000 1900000
+				1800000 1700000 1500000 1400000 1300000
+				1100000 1000000 900000 800000 600000
+				500000
+
+				If the base_frequency attribute is present
+				and readable, then any frequency above
+				base_frequency is turbo frequency. For example
+
+				$ cat base_frequency
+				2200000
+
+				Then in the above displayed list of
+				scaling_available_frequencies, 2300000 and
+				2301000 are turbo frequencies. That is, if any
+				of these frequencies is requested, the
+				processor will be allowed to run at a frequency
+				of its choice above the base_frequency that
+				need not be equal to any of them and may be
+				above the maximum listed one.
drivers/cpufreq/acpi-cpufreq.c +43 -0

61 lines not on this page · raw message

Signature · 1 line
2.5.0
maintainer Acked-by on v5 1/1
#1 lore raw
Quoted 26 lines · Srinivas Pandruvada

Currently scaling_available_frequencies displays list of available frequencies which can be used to set max/min or current scaling frequency.

$ cat scaling_available_frequencies
2301000 2300000 2200000 2000000 1900000 1800000 1700000 1500000 1400000
1300000 1100000 1000000 900000 800000 600000 500000

Here traditionally it is assumed that only 2301000 is a turbo frequency, which is purely opportunistic, anything else user can request and may get it.

But because of configurable thermal design power implementation in several Intel CPUs, the opportunistic frequency start can be any frequency in this range. For example it can be 2300000 or any lower value.
This change adds an optional new attribute called "base_frequency", which displays the max non-turbo frequency (base frequency). For example:

$ cat base_frequency
2200000

This will allow user to choose a certain frequency which is not opportunistic.

To be fair, other than the concept, the code is essentially copied from responses from Rafael in mailing list.

Quoted 8 lines

---

v5
- Rebased on the top of
"cpufreq: acpi: Allow new dynamics attributes to be added to acpi_cpufreq_attr"
- Remove loop for finding next empty slot in acpi_cpufreq_attr
- Code change suggested by Rafael

Signature · 1 line
viresh