linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stratos Karafotis <stratosk@semaphore.gr>
To: rjw@rjwysocki.net, dirk.brandewie@gmail.com,
	Dirk Brandewie <dirk.j.brandewie@intel.com>
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH 4/5] intel_pstate: Remove C0 tracking
Date: Mon, 12 May 2014 05:27:25 +0300	[thread overview]
Message-ID: <5370318D.2010309@semaphore.gr> (raw)
In-Reply-To: <CADmjqpOnzRrB8gJsmHWG=4bvhERLovnKyP0Pcki_uVJ3qpfD0g@mail.gmail.com>

Hi,

On 12/05/2014 05:14 πμ, Stratos Karafotis wrote:
> From: Dirk Brandewie <dirk.j.brandewie@intel.com>
> 
> Commit fcb6a15c intel_pstate: Take core C0 time into account for core busy
> introduced a regression referenced below.  The issue with "lockup"
> after suspend that this commit was addressing is now dealt with in the
> suspend path.
> 
> References:
>    https://bugzilla.kernel.org/show_bug.cgi?id=66581
>    https://bugzilla.kernel.org/show_bug.cgi?id=75121
> 
> Reported-by: Doug Smythies <dsmythies@telus.net>
> Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
> ---
>  drivers/cpufreq/intel_pstate.c | 13 +------------
>  1 file changed, 1 insertion(+), 12 deletions(-)
> 
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index bb20881..4c26faf 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -59,7 +59,6 @@ struct sample {
>         int32_t core_pct_busy;
>         u64 aperf;
>         u64 mperf;
> -       unsigned long long tsc;
>         int freq;
>  };
> 
> @@ -100,7 +99,6 @@ struct cpudata {
> 
>         u64     prev_aperf;
>         u64     prev_mperf;
> -       unsigned long long prev_tsc;
>         struct sample sample;
>  };
> 
> @@ -561,46 +559,37 @@ static inline void intel_pstate_calc_busy(struct
> cpudata *cpu,
>                                         struct sample *sample)
>  {
>         int32_t core_pct;
> -       int32_t c0_pct;
> 
>         core_pct = div_fp(int_tofp((sample->aperf)),
>                         int_tofp((sample->mperf)));
>         core_pct = mul_fp(core_pct, int_tofp(100));
>         FP_ROUNDUP(core_pct);
> 
> -       c0_pct = div_fp(int_tofp(sample->mperf), int_tofp(sample->tsc));
> -
>         sample->freq = fp_toint(
>                 mul_fp(int_tofp(cpu->pstate.max_pstate * 1000), core_pct));
> 
> -       sample->core_pct_busy = mul_fp(core_pct, c0_pct);
> +       sample->core_pct_busy = core_pct;
>  }
> 
>  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();
> 
>         aperf = aperf >> FRAC_BITS;
>         mperf = mperf >> FRAC_BITS;
> -       tsc = tsc >> FRAC_BITS;
> 
>         cpu->sample.aperf = aperf;
>         cpu->sample.mperf = mperf;
> -       cpu->sample.tsc = tsc;
>         cpu->sample.aperf -= cpu->prev_aperf;
>         cpu->sample.mperf -= cpu->prev_mperf;
> -       cpu->sample.tsc -= cpu->prev_tsc;
> 
>         intel_pstate_calc_busy(cpu, &cpu->sample);
> 
>         cpu->prev_aperf = aperf;
>         cpu->prev_mperf = mperf;
> -       cpu->prev_tsc = tsc;
>  }
> 
>  static inline void intel_pstate_set_sample_time(struct cpudata *cpu)
> --
> 1.9.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

With this patch, my CPU (Core i7-3770 @ 3.90GHz) seems to never use lowest
frequencies. Even on an idle system I get always ~2GHz. Normally,
on an idle system it used to be 1.6GHz.
On very small loads (mp3 decoding) the CPU goes up to 2.7G GHz (it used to
be 1.6GHz)

Reverting, this patch on my local build, the problem is resolved.


Thanks,
Stratos Karafotis


  parent reply	other threads:[~2014-05-12  2:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-08 19:57 [PATCH 0/5] updates for intel_pstate dirk.brandewie
2014-05-08 19:57 ` [PATCH 2/5] intel_pstate: remove setting P state to MAX on init dirk.brandewie
2014-05-08 19:57 ` [PATCH 3/5] intel_pstate: Fix fixed point rounding macro dirk.brandewie
2014-05-12 12:17   ` Rafael J. Wysocki
2014-05-08 19:57 ` [PATCH 4/5] intel_pstate: Remove C0 tracking dirk.brandewie
2014-05-09  1:44   ` Yuyang Du
2014-05-12  0:26   ` Rafael J. Wysocki
     [not found]   ` <CADmjqpOnzRrB8gJsmHWG=4bvhERLovnKyP0Pcki_uVJ3qpfD0g@mail.gmail.com>
2014-05-12  2:27     ` Stratos Karafotis [this message]
2014-05-12 12:16       ` Rafael J. Wysocki
2014-05-12 14:39         ` Dirk Brandewie
2014-05-12 23:45           ` Rafael J. Wysocki
2014-05-08 19:57 ` [PATCH 5/5] intel_pstate: Add CPU IDs for Broadwell processors dirk.brandewie
2014-05-08 20:30 ` [PATCH 0/5] updates for intel_pstate Rafael J. Wysocki
2014-05-08 21:08   ` Dirk Brandewie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5370318D.2010309@semaphore.gr \
    --to=stratosk@semaphore.gr \
    --cc=dirk.brandewie@gmail.com \
    --cc=dirk.j.brandewie@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).