Re: [PATCH] intel_pstate: Update cpu_frequency tracepoint every time

From: Srinivas Pandruvada
Date: Tue Jul 19 2016 - 18:39:48 EST


On Tue, 2016-07-19 at 15:10 +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
>
> 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@xxxxxxxxx>

Acked-by: Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx>-

> --
> Â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@xxxxxxxxxxxxxxx
> More majordomo info atÂÂhttp://vger.kernel.org/majordomo-info.html