* [PATCH] acpi-cpufreq: set current frequency based on target P-State
@ 2013-05-31 19:45 Ross Lagerwall
2013-05-31 21:33 ` Len Brown
2013-06-01 9:48 ` Viresh Kumar
0 siblings, 2 replies; 4+ messages in thread
From: Ross Lagerwall @ 2013-05-31 19:45 UTC (permalink / raw)
To: cpufreq; +Cc: Andre Przywara, Matthew Garrett, 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.
This fixes an issue where setting the default governor to performance
wouldn't correctly enable turbo mode on all cores.
Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
---
drivers/cpufreq/acpi-cpufreq.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index 11b8b4b..edc089e 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -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
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] acpi-cpufreq: set current frequency based on target P-State
2013-05-31 19:45 [PATCH] acpi-cpufreq: set current frequency based on target P-State Ross Lagerwall
@ 2013-05-31 21:33 ` Len Brown
2013-06-01 9:48 ` Viresh Kumar
1 sibling, 0 replies; 4+ messages in thread
From: Len Brown @ 2013-05-31 21:33 UTC (permalink / raw)
To: Ross Lagerwall; +Cc: cpufreq, Andre Przywara, Matthew Garrett
On Fri, May 31, 2013 at 3:45 PM, Ross Lagerwall <rosslagerwall@gmail.com> wrote:
>
> 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.
>
> Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
Reviewed-by: Len Brown <len.brown@intel.com>
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
> ---
> drivers/cpufreq/acpi-cpufreq.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
> index 11b8b4b..edc089e 100644
> --- a/drivers/cpufreq/acpi-cpufreq.c
> +++ b/drivers/cpufreq/acpi-cpufreq.c
> @@ -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
>
> --
> To unsubscribe from this list: send the line "unsubscribe cpufreq" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Len Brown, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] acpi-cpufreq: set current frequency based on target P-State
2013-05-31 19:45 [PATCH] acpi-cpufreq: set current frequency based on target P-State Ross Lagerwall
2013-05-31 21:33 ` Len Brown
@ 2013-06-01 9:48 ` Viresh Kumar
1 sibling, 0 replies; 4+ messages in thread
From: Viresh Kumar @ 2013-06-01 9:48 UTC (permalink / raw)
To: Ross Lagerwall; +Cc: cpufreq, Andre Przywara, Matthew Garrett
On Sat, Jun 1, 2013 at 1:15 AM, Ross Lagerwall <rosslagerwall@gmail.com> wrote:
> 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.
>
> Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
> ---
> drivers/cpufreq/acpi-cpufreq.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Thanks for your patch.
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [stable request <=3.5] acpi-cpufreq: set current frequency based on target P-State
@ 2013-12-20 8:19 Ross Lagerwall
2014-03-25 22:04 ` [stable request <=3.7] " Vinson Lee
0 siblings, 1 reply; 4+ messages in thread
From: Ross Lagerwall @ 2013-12-20 8:19 UTC (permalink / raw)
To: Vinson Lee
Cc: stable, Rafael J. Wysocki, Viresh Kumar, cpufreq, linux-pm,
Shatil Rafitullah, Len Brown, Rafael J. Wysocki
On Thu, Dec 19, 2013 at 06:14:12PM -0800, Vinson Lee wrote:
> Hi.
>
> Is commit 8673b83bf2f013379453b4779047bf3c6ae387e4 "acpi-cpufreq: set
> current frequency based on target P-State" applicable to kernels
> before 3.8?
>
> We found that this patch allows the kernel to control P-states on
> 3.4.74 on some platforms. However, other platforms were able to change
> P-states even without this patch.
>
Well, it fixes a regression introduced in 3.8 which affected setting
turbo frequencies (I'm not sure if the 3.8 patch was backported).
However, there may be other situations where the target frequency is
different from the reported frequency which 8673b83bf2f0 could well fix.
Cheers
--
Ross Lagerwall
^ permalink raw reply [flat|nested] 4+ messages in thread
* [stable request <=3.7] acpi-cpufreq: set current frequency based on target P-State
2013-12-20 8:19 [stable request <=3.5] " Ross Lagerwall
@ 2014-03-25 22:04 ` Vinson Lee
2014-03-25 22:04 ` [PATCH] " Vinson Lee
0 siblings, 1 reply; 4+ messages in thread
From: Vinson Lee @ 2014-03-25 22:04 UTC (permalink / raw)
To: stable
Cc: Rafael J. Wysocki, Viresh Kumar, cpufreq, linux-pm, Len Brown,
Ross Lagerwall, Rafael J. Wysocki, Vinson Lee
Hi.
Please backport upstream commit 8673b83bf2f013379453b4779047bf3c6ae387e4
"acpi-cpufreq: set current frequency based on target P-State" to stable
kernels 3.7 and earlier. This patch enables the kernel to control
P-states on several platforms. Without this patch, the kernel was unable
to control P-states on the same platforms.
The upstream patch cleanly applies to 3.7.
A backported patch is needed with the removal of SYSTEM_AMD_MSR_CAPABLE
for kernels 3.6 and earlier.
Cheers,
Vinson
Ross Lagerwall (1):
acpi-cpufreq: set current frequency based on target P-State
drivers/cpufreq/acpi-cpufreq.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--
1.8.3.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] acpi-cpufreq: set current frequency based on target P-State
2014-03-25 22:04 ` [stable request <=3.7] " Vinson Lee
@ 2014-03-25 22:04 ` Vinson Lee
0 siblings, 0 replies; 4+ messages in thread
From: Vinson Lee @ 2014-03-25 22:04 UTC (permalink / raw)
To: stable
Cc: Rafael J. Wysocki, Viresh Kumar, cpufreq, linux-pm, Len Brown,
Ross Lagerwall, Rafael J. Wysocki, Shatil Rafiullah, Vinson Lee
From: Ross Lagerwall <rosslagerwall@gmail.com>
commit 8673b83bf2f013379453b4779047bf3c6ae387e4 upstream.
Commit 4b31e774 (Always set P-state on initialization) 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.
Commit 5a1c0228 (cpufreq: Avoid calling cpufreq driver's target()
routine if target_freq == policy->cur) 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 that 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.
Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
Reviewed-by: Len Brown <len.brown@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: 3.8+ <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ srafiullah: Backported to <= 3.6:
- SYSTEM_AMD_MSR_CAPABLE does not exist. ]
Tested-by: Shatil Rafiullah <srafiullah@twopensource.com>
Signed-off-by: Shatil Rafiullah <srafiullah@twopensource.com>
Signed-off-by: Vinson Lee <vlee@twitter.com>
---
drivers/cpufreq/acpi-cpufreq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index 56c6c6b..227a316 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -215,7 +215,7 @@ 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_IO_CAPABLE:
cmd.type = SYSTEM_IO_CAPABLE;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-03-25 22:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-31 19:45 [PATCH] acpi-cpufreq: set current frequency based on target P-State Ross Lagerwall
2013-05-31 21:33 ` Len Brown
2013-06-01 9:48 ` Viresh Kumar
-- strict thread matches above, loose matches on Subject: below --
2013-12-20 8:19 [stable request <=3.5] " Ross Lagerwall
2014-03-25 22:04 ` [stable request <=3.7] " Vinson Lee
2014-03-25 22:04 ` [PATCH] " Vinson Lee
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox