All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] intel_pstate: Update cpu_frequency tracepoint every time
@ 2016-07-19 13:10 Rafael J. Wysocki
  2016-07-19 22:39 ` Srinivas Pandruvada
  0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2016-07-19 13:10 UTC (permalink / raw)
  To: Linux PM list; +Cc: Linux Kernel Mailing List, Srinivas Pandruvada

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Currently, intel_pstate only updates the cpu_frequency tracepoint
if the new P-state to set is different from the current one, but
that causes powertop to report 100% idle on an 100% loaded system
sometimes.

Prevent that from happening by updating the cpu_frequency tracepoint
every time intel_pstate_update_pstate() is called.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/cpufreq/intel_pstate.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

Index: linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/intel_pstate.c
+++ linux-pm/drivers/cpufreq/intel_pstate.c
@@ -1134,17 +1134,12 @@ static void intel_pstate_get_min_max(str
 	*min = clamp_t(int, min_perf, cpu->pstate.min_pstate, max_perf);
 }
 
-static inline void intel_pstate_record_pstate(struct cpudata *cpu, int pstate)
-{
-	trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu);
-	cpu->pstate.current_pstate = pstate;
-}
-
 static void intel_pstate_set_min_pstate(struct cpudata *cpu)
 {
 	int pstate = cpu->pstate.min_pstate;
 
-	intel_pstate_record_pstate(cpu, pstate);
+	trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu);
+	cpu->pstate.current_pstate = pstate;
 	/*
 	 * Generally, there is no guarantee that this code will always run on
 	 * the CPU being updated, so force the register update to run on the
@@ -1304,10 +1299,11 @@ static inline void intel_pstate_update_p
 
 	intel_pstate_get_min_max(cpu, &min_perf, &max_perf);
 	pstate = clamp_t(int, pstate, min_perf, max_perf);
+	trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu);
 	if (pstate == cpu->pstate.current_pstate)
 		return;
 
-	intel_pstate_record_pstate(cpu, pstate);
+	cpu->pstate.current_pstate = pstate;
 	wrmsrl(MSR_IA32_PERF_CTL, pstate_funcs.get_val(cpu, pstate));
 }
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] intel_pstate: Update cpu_frequency tracepoint every time
  2016-07-19 13:10 [PATCH] intel_pstate: Update cpu_frequency tracepoint every time Rafael J. Wysocki
@ 2016-07-19 22:39 ` Srinivas Pandruvada
  2016-07-20  3:14   ` Doug Smythies
  0 siblings, 1 reply; 4+ messages in thread
From: Srinivas Pandruvada @ 2016-07-19 22:39 UTC (permalink / raw)
  To: Rafael J. Wysocki, Linux PM list; +Cc: Linux Kernel Mailing List

On Tue, 2016-07-19 at 15:10 +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Currently, intel_pstate only updates the cpu_frequency tracepoint
> if the new P-state to set is different from the current one, but
> that causes powertop to report 100% idle on an 100% loaded system
> sometimes.
> 
> Prevent that from happening by updating the cpu_frequency tracepoint
> every time intel_pstate_update_pstate() is called.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>-

> --
>  drivers/cpufreq/intel_pstate.c |   12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> Index: linux-pm/drivers/cpufreq/intel_pstate.c
> ===================================================================
> --- linux-pm.orig/drivers/cpufreq/intel_pstate.c
> +++ linux-pm/drivers/cpufreq/intel_pstate.c
> @@ -1134,17 +1134,12 @@ static void intel_pstate_get_min_max(str
>  	*min = clamp_t(int, min_perf, cpu->pstate.min_pstate,
> max_perf);
>  }
>  
> -static inline void intel_pstate_record_pstate(struct cpudata *cpu,
> int pstate)
> -{
> -	trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu);
> -	cpu->pstate.current_pstate = pstate;
> -}
> -
>  static void intel_pstate_set_min_pstate(struct cpudata *cpu)
>  {
>  	int pstate = cpu->pstate.min_pstate;
>  
> -	intel_pstate_record_pstate(cpu, pstate);
> +	trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu);
> +	cpu->pstate.current_pstate = pstate;
>  	/*
>  	 * Generally, there is no guarantee that this code will
> always run on
>  	 * the CPU being updated, so force the register update to
> run on the
> @@ -1304,10 +1299,11 @@ static inline void intel_pstate_update_p
>  
>  	intel_pstate_get_min_max(cpu, &min_perf, &max_perf);
>  	pstate = clamp_t(int, pstate, min_perf, max_perf);
> +	trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu);
>  	if (pstate == cpu->pstate.current_pstate)
>  		return;
>  
> -	intel_pstate_record_pstate(cpu, pstate);
> +	cpu->pstate.current_pstate = pstate;
>  	wrmsrl(MSR_IA32_PERF_CTL, pstate_funcs.get_val(cpu,
> pstate));
>  }
>  
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm"
> in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] intel_pstate: Update cpu_frequency tracepoint every time
  2016-07-19 22:39 ` Srinivas Pandruvada
@ 2016-07-20  3:14   ` Doug Smythies
  2016-07-23 12:41     ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Doug Smythies @ 2016-07-20  3:14 UTC (permalink / raw)
  To: 'Srinivas Pandruvada', 'Rafael J. Wysocki'
  Cc: 'Linux Kernel Mailing List', 'Linux PM list'

On 2016.07.19 15:10 Srinivas Pandruvada wrote:
> On Tue, 2016-07-19 at 15:10 +0200, Rafael J. Wysocki wrote:
>> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>> 
>> Currently, intel_pstate only updates the cpu_frequency tracepoint
>> if the new P-state to set is different from the current one, but
>> that causes powertop to report 100% idle on an 100% loaded system
>> sometimes.
>> 
>> Prevent that from happening by updating the cpu_frequency tracepoint
>> every time intel_pstate_update_pstate() is called.
>> 
>> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>-

Shouldn't this patch refer to:

commit fdfdb2b1301670a69195ba1e5666df4a7f02eb46
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Fri Mar 18 23:20:02 2016 +0100

    intel_pstate: Do not call wrmsrl_on_cpu() with disabled interrupts

which is the patch that introduced the regression?

... Doug

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] intel_pstate: Update cpu_frequency tracepoint every time
  2016-07-20  3:14   ` Doug Smythies
@ 2016-07-23 12:41     ` Rafael J. Wysocki
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2016-07-23 12:41 UTC (permalink / raw)
  To: Doug Smythies
  Cc: 'Srinivas Pandruvada',
	'Linux Kernel Mailing List', 'Linux PM list'

On Tuesday, July 19, 2016 08:14:53 PM Doug Smythies wrote:
> On 2016.07.19 15:10 Srinivas Pandruvada wrote:
> > On Tue, 2016-07-19 at 15:10 +0200, Rafael J. Wysocki wrote:
> >> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >> 
> >> Currently, intel_pstate only updates the cpu_frequency tracepoint
> >> if the new P-state to set is different from the current one, but
> >> that causes powertop to report 100% idle on an 100% loaded system
> >> sometimes.
> >> 
> >> Prevent that from happening by updating the cpu_frequency tracepoint
> >> every time intel_pstate_update_pstate() is called.
> >> 
> >> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >
> > Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>-
> 
> Shouldn't this patch refer to:
> 
> commit fdfdb2b1301670a69195ba1e5666df4a7f02eb46
> Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Date:   Fri Mar 18 23:20:02 2016 +0100
> 
>     intel_pstate: Do not call wrmsrl_on_cpu() with disabled interrupts
> 
> which is the patch that introduced the regression?

The logic changed by the $subject patch was there before the above commit,
so I don't think the issue at hand really is a regression introduced by it

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-07-23 12:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-19 13:10 [PATCH] intel_pstate: Update cpu_frequency tracepoint every time Rafael J. Wysocki
2016-07-19 22:39 ` Srinivas Pandruvada
2016-07-20  3:14   ` Doug Smythies
2016-07-23 12:41     ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.