[3.11.y.z extended stable] Patch "intel_pstate: Take core C0 time into account for core busy" has been added to staging queue

Luís Henriques luis.henriques at canonical.com
Fri Feb 21 12:27:18 UTC 2014


On Fri, Feb 14, 2014 at 10:11:09AM +0000, Luis Henriques wrote:
> This is a note to let you know that I have just added a patch titled
> 
>     intel_pstate: Take core C0 time into account for core busy
> 
> to the linux-3.11.y-queue branch of the 3.11.y.z extended stable tree 
> which can be found at:
> 
>  http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.11.y-queue
> 
> If you, or anyone else, feels it should not be added to this tree, please 
> reply to this email.
> 

I've decided to drop this patch for now as it seems to introduce a
regression:

 https://lkml.org/lkml/2014/2/19/626

Cheers,
--
Luís

> For more information about the 3.11.y.z tree, see
> https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable
> 
> Thanks.
> -Luis
> 
> ------
> 
> From 52f7f05e009b77337a2d48e4227968ababa1a4ab Mon Sep 17 00:00:00 2001
> From: Dirk Brandewie <dirk.j.brandewie at intel.com>
> Date: Mon, 3 Feb 2014 08:55:31 -0800
> Subject: intel_pstate: Take core C0 time into account for core busy
>  calculation
> 
> commit fcb6a15c2e7e76d493e6f91ea889ab40e1c643a4 upstream.
> 
> Take non-idle time into account when calculating core busy time.
> This ensures that intel_pstate will notice a decrease in load.
> 
> References: https://bugzilla.kernel.org/show_bug.cgi?id=66581
> Signed-off-by: Dirk Brandewie <dirk.j.brandewie at intel.com>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki at intel.com>
> Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
> ---
>  drivers/cpufreq/intel_pstate.c | 22 ++++++++++++++++++----
>  1 file changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index e52e542..1220359 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -51,6 +51,7 @@ struct sample {
>  	int32_t core_pct_busy;
>  	u64 aperf;
>  	u64 mperf;
> +	unsigned long long tsc;
>  	int freq;
>  };
> 
> @@ -86,6 +87,7 @@ struct cpudata {
> 
>  	u64	prev_aperf;
>  	u64	prev_mperf;
> +	unsigned long long prev_tsc;
>  	int	sample_ptr;
>  	struct sample samples[SAMPLE_COUNT];
>  };
> @@ -436,29 +438,41 @@ static inline void intel_pstate_calc_busy(struct cpudata *cpu,
>  					struct sample *sample)
>  {
>  	u64 core_pct;
> -	core_pct = div64_u64(int_tofp(sample->aperf * 100),
> -			     sample->mperf);
> -	sample->freq = fp_toint(cpu->pstate.max_pstate * core_pct * 1000);
> +	u64 c0_pct;
> 
> -	sample->core_pct_busy = core_pct;
> +	core_pct = div64_u64(sample->aperf * 100, sample->mperf);
> +
> +	c0_pct = div64_u64(sample->mperf * 100, sample->tsc);
> +	sample->freq = fp_toint(
> +		mul_fp(int_tofp(cpu->pstate.max_pstate),
> +			int_tofp(core_pct * 1000)));
> +
> +	sample->core_pct_busy = mul_fp(int_tofp(core_pct),
> +				div_fp(int_tofp(c0_pct + 1), int_tofp(100)));
>  }
> 
>  static inline void intel_pstate_sample(struct cpudata *cpu)
>  {
>  	u64 aperf, mperf;
> +	unsigned long long tsc;
> 
>  	rdmsrl(MSR_IA32_APERF, aperf);
>  	rdmsrl(MSR_IA32_MPERF, mperf);
> +	tsc = native_read_tsc();
> +
>  	cpu->sample_ptr = (cpu->sample_ptr + 1) % SAMPLE_COUNT;
>  	cpu->samples[cpu->sample_ptr].aperf = aperf;
>  	cpu->samples[cpu->sample_ptr].mperf = mperf;
> +	cpu->samples[cpu->sample_ptr].tsc = tsc;
>  	cpu->samples[cpu->sample_ptr].aperf -= cpu->prev_aperf;
>  	cpu->samples[cpu->sample_ptr].mperf -= cpu->prev_mperf;
> +	cpu->samples[cpu->sample_ptr].tsc -= cpu->prev_tsc;
> 
>  	intel_pstate_calc_busy(cpu, &cpu->samples[cpu->sample_ptr]);
> 
>  	cpu->prev_aperf = aperf;
>  	cpu->prev_mperf = mperf;
> +	cpu->prev_tsc = tsc;
>  }
> 
>  static inline void intel_pstate_set_sample_time(struct cpudata *cpu)
> --
> 1.8.3.2
> 




More information about the kernel-team mailing list