acpi-cpufreq: introduce base_frequency
Subsystems (2)
cover acpi-cpufreq: introduce base_frequency
This patchset introduces base_frequency attribute to cpufreq sysfs only for acpi-cpufreq.
No change but sending code and document patch together.
Srinivas Pandruvada (2):
cpufreq: acpi_cpufreq: base frequency attribute support
Documentation: cpufreq: Additional interface for acpi-cpufreq
Documentation/cpu-freq/acpi-cpufreq-addition.txt | 20 +++++++++++++ drivers/cpufreq/acpi-cpufreq.c | 36 ++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 Documentation/cpu-freq/acpi-cpufreq-addition.txt
Signature · 1 line
2.5.0
PATCH 1/2 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.
Quoted 1 line
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:
Quoted 1 line
cat
base_frequency
2200000
This will allow user to choose a certain frequency which is not opportunistic.
--- drivers/cpufreq/acpi-cpufreq.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
drivers/cpufreq/acpi-cpufreq.c +36 -0
@@ -646,6 +646,21 @@ static int acpi_cpufreq_blacklist(struct cpuinfo_x86 *c) }#endif +static ssize_t show_base_frequency (struct cpufreq_policy *policy,char *buf) +{ +u64 tar; +int err; + + err =rdmsrl_safe_on_cpu (policy->cpu,MSR_TURBO_ACTIVATION_RATIO , &tar); +if (!err) +/* Refer to IA64, IA32 SDM table 35-20, unit = 100 MHz */ +return sprintf (buf,"%llu\n" , tar *100000 ); + +return err; +} + +cpufreq_freq_attr_ro (base_frequency); +static int acpi_cpufreq_cpu_init (struct cpufreq_policy *policy) {unsigned int i;
@@ -889,6 +904,7 @@ static struct freq_attr *acpi_cpufreq_attr[] = { &cpb, #endif NULL, + NULL, }; static struct cpufreq_driver acpi_cpufreq_driver = {
@@ -971,6 +987,26 @@ static int __init acpi_cpufreq_init(void) } }#endif + +if (boot_cpu_has (X86_FEATURE_IDA )) { +u64 plat_info, tar; +int err; + + err =rdmsrl_safe_on_cpu (0 ,MSR_PLATFORM_INFO , &plat_info); +/* Check number of config TDP levels > 0 */ +if (!err && ((plat_info >>33 ) &0x03 ) >0 ) { + err =rdmsrl_safe_on_cpu (0 ,MSR_TURBO_ACTIVATION_RATIO , + &tar); +if (!err) { +struct freq_attr **attr; + +for (attr = acpi_cpufreq_attr; *attr; attr++) + ; + *attr = &base_frequency; + } + } + } +acpi_cpufreq_boost_init (); ret =cpufreq_register_driver (&acpi_cpufreq_driver);
Signature · 1 line
2.5.0
PATCH 2/2 Documentation: cpufreq: Additional interface for acpi-cpufreq
In reply to Srinivas PandruvadaAdded new file for acpi-cpufreq driver, with explanation for base_frequency.
--- Documentation/cpu-freq/acpi-cpufreq-addition.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Documentation/cpu-freq/acpi-cpufreq-addition.txt
Documentation/cpu-freq/acpi-cpufreq-addition.txt new file +20 -0
@@ -0,0 +1,20 @@ +Additional sysfs attribute for acpi-cpufreq + +In addition to the standard sysfs interface as defined in the +user-guide.txt under section "Preferred Interface: sysfs", +acpi-cpufreq can have following additional sysfs attribute: + +base_frequency: Max non-turbo frequency +For example: +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 +If the base_frequency attribute is present, then any frequency above is +purely opportunistic or turbo frequency. For example +>cat base_frequency +2200000 +Then in the above displayed list of scaling_available_frequencies, any +frequency 2300000 or 2301000 is opportunistic or turbo frequency. +
Signature · 1 line
2.5.0
Viresh Kumar
maintainerRe: [PATCH 2/2] Documentation: cpufreq: Additional interface for acpi-cpufreq
Documentation/cpu-freq/acpi-cpufreq-addition.txt
Quoted 10 lines · Srinivas Pandruvada
Added new file for acpi-cpufreq driver, with explanation for
base_frequency.Signed-off-by Srinivas Pandruvada <[email protected]>--- Documentation/cpu-freq/acpi-cpufreq-addition.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Documentation/cpu-freq/acpi-cpufreq-addition.txtDocumentation/cpu-freq/acpi-cpufreq-addition.txt +0
-0
s/-addition//
Documentation/cpu-freq/acpi-cpufreq-addition.txt line 1
Quoted 6 lines
new file mode 100644
index 0000000..40efb22Documentation/cpu-freq/acpi-cpufreq-addition.txt new file +1
-0@@ -0,0 +1,20 @@ +Additional sysfs attribute for acpi-cpufreq
You should be adding a description of freqdomain_cpus in this file, which was never documented (yes, in a separate patch).
Documentation/cpu-freq/acpi-cpufreq-addition.txt line 5
Quoted 3 lines
Documentation/cpu-freq/acpi-cpufreq-addition.txt new file +3
-0+In addition to the standard sysfs interface as defined in the +user-guide.txt under section "Preferred Interface: sysfs", +acpi-cpufreq can have following additional sysfs attribute:
Maybe rewrite as:
acpi-cpufreq have following sysfs attributes in addition to standard cpufreq attributes:
Documentation/cpu-freq/acpi-cpufreq-addition.txt line 8
Quoted 3 lines
Documentation/cpu-freq/acpi-cpufreq-addition.txt new file +3
-0+ +base_frequency: Max non-turbo frequency +For example:
Please keep the formatting similar to user-guide.txt
Quoted 3 lines
Documentation/cpu-freq/acpi-cpufreq-addition.txt new file +1
-0+scaling_available_frequencies displays list of available frequencieswhich can be used to set max/min or current scaling frequency.
Just drop above line.
Quoted 3 lines
+>cat
scaling_available_frequencies
+2301000 2300000 2200000 2000000 1900000 1800000 1700000 1500000 1400000 +1300000 1100000 1000000 900000 800000 600000 500000
A blank line here.. This is documentation and should be really readable.
Quoted 1 line
+If the
base_frequencyattribute is present,
*is present* isn't sufficient, right? It should be readable as well?
Quoted 1 line
then any frequency above is
s/above/above base_frequency/
Quoted 1 line
+purely opportunistic or turbo frequency. For example
s/purely opportunistic or / a/
Quoted 2 lines
+>cat
base_frequency
+2200000
Blank line here as well:
Documentation/cpu-freq/acpi-cpufreq-addition.txt line 19
Quoted 2 lines
Documentation/cpu-freq/acpi-cpufreq-addition.txt new file +2
-0+Then in the above displayed list of scaling_available_frequencies, any +frequency 2300000 or 2301000 is opportunistic or turbo frequency.
Maybe just:
i.e. 2300000 and 2301000 are turbo frequencies now..
Quoted 3 lines
+
Signature · 1 line
2.5.0
Signature · 1 line
viresh
Viresh Kumar
maintainerQuoted 4 lines · Srinivas Pandruvada
This patchset introduces
base_frequencyattribute to cpufreq sysfs only for acpi-cpufreq.No change but sending code and document patch together.
Perhaps Rafael asked you to fold it into the first patch, which meant that we should have had a single patch for both of these things.
But its still okay, as these are part of the same set at least.
But, you again failed to convey version information, etc.
Quoted 11 lines
Srinivas Pandruvada (2):
cpufreq:acpi_cpufreq: base frequency attribute support
Documentation: cpufreq: Additional interface for acpi-cpufreqDocumentation/cpu-freq/acpi-cpufreq-addition.txt | 20 +++++++++++++ drivers/cpufreq/acpi-cpufreq.c | 36 ++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 Documentation/cpu-freq/acpi-cpufreq-addition.txtSignature · 1 line
2.5.0
Signature · 1 line
viresh