Skip to contentSkip to conversation

acpi-cpufreq: set current frequency based on target P-State

PATCH In review Ross Lagerwall 3 participants 3 messages May 31, 2013 – Jun 1, 2013 CPU frequency scaling framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 acpi-cpufreq: set current frequency based on target P-State

4b31e774 fixed bug #4634 and caused the driver to always set the target P-State at least once since the initial P-State may not be the desired one. 5a1c0228 caused a regression in this behavior.

This fixes the regression by setting policy->cur based on the CPU's target frequency rather than the CPU's current reported frequency (which may be different). This means the P-State will be set initially if the CPU's target frequency is different from the governor's target frequency.

This fixes an issue where setting the default governor to performance wouldn't correctly enable turbo mode on all cores.

---
 drivers/cpufreq/acpi-cpufreq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/cpufreq/acpi-cpufreq.c +2 -2
index 11b8b4b..edc089e 100644
@@ -347,11 +347,11 @@ static u32 get_cur_val(const struct cpumask *mask)
 	switch (per_cpu(acfreq_data, cpumask_first(mask))->cpu_feature) {
 	case SYSTEM_INTEL_MSR_CAPABLE:
 		cmd.type = SYSTEM_INTEL_MSR_CAPABLE;
-		cmd.addr.msr.reg = MSR_IA32_PERF_STATUS;
+		cmd.addr.msr.reg = MSR_IA32_PERF_CTL;
 		break;
 	case SYSTEM_AMD_MSR_CAPABLE:
 		cmd.type = SYSTEM_AMD_MSR_CAPABLE;
-		cmd.addr.msr.reg = MSR_AMD_PERF_STATUS;
+		cmd.addr.msr.reg = MSR_AMD_PERF_CTL;
 		break;
 	case SYSTEM_IO_CAPABLE:
 		cmd.type = SYSTEM_IO_CAPABLE;
Signature · 1 line
1.8.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Ross Lagerwall

4b31e774 fixed bug #4634 and caused the driver to always set the target P-State at least once since the initial P-State may not be the desired one. 5a1c0228 caused a regression in this behavior.

This fixes the regression by setting policy->cur based on the CPU's target frequency rather than the CPU's current reported frequency (which may be different). This means the P-State will be set initially if the CPU's target frequency is different from the governor's target frequency.

Quoted 4 lines

This fixes an issue where setting the default governor to performance wouldn't correctly enable turbo mode on all cores.

Ack -- MSR_IA32_PERF_STATUS is ill-conceived. It is un-reliable by its very definition. Any code that depends on it should be questioned...

thanks,
Len Brown, Intel Open Source Technology Center

Quoted 25 lines
---
 drivers/cpufreq/acpi-cpufreq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/cpufreq/acpi-cpufreq.c +2 -3
index 11b8b4b..edc089e 100644
@@ -347,11 +347,11 @@ static u32 get_cur_val(const struct cpumask *mask)
        switch (per_cpu(acfreq_data, cpumask_first(mask))->cpu_feature) {
        case SYSTEM_INTEL_MSR_CAPABLE:
                cmd.type = SYSTEM_INTEL_MSR_CAPABLE;
-               cmd.addr.msr.reg = MSR_IA32_PERF_STATUS;
+               cmd.addr.msr.reg = MSR_IA32_PERF_CTL;
                break;
        case SYSTEM_AMD_MSR_CAPABLE:
                cmd.type = SYSTEM_AMD_MSR_CAPABLE;
-               cmd.addr.msr.reg = MSR_AMD_PERF_STATUS;
+               cmd.addr.msr.reg = MSR_AMD_PERF_CTL;
                break;
        case SYSTEM_IO_CAPABLE:
                cmd.type = SYSTEM_IO_CAPABLE;
--

1.8.3

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe cpufreq" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Len Brown, Intel Open Source Technology Center

maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Ross Lagerwall
Quoted 10 lines · Ross Lagerwall

4b31e774 fixed bug #4634 and caused the driver to always set the target P-State at least once since the initial P-State may not be the desired one. 5a1c0228 caused a regression in this behavior.

This fixes the regression by setting policy->cur based on the CPU's target frequency rather than the CPU's current reported frequency (which may be different). This means the P-State will be set initially if the CPU's target frequency is different from the governor's target frequency.

Quoted 7 lines

This fixes an issue where setting the default governor to performance wouldn't correctly enable turbo mode on all cores.

---
 drivers/cpufreq/acpi-cpufreq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Thanks for your patch.