From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: "Jörg Otte" <jrg.otte@gmail.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux PM list <linux-pm@vger.kernel.org>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Subject: Re: [intel-pstate driver regression] processor frequency very high even if in idle
Date: Thu, 31 Mar 2016 13:42:14 +0200 [thread overview]
Message-ID: <8393335.Q1cjiaGecN@vostro.rjw.lan> (raw)
In-Reply-To: <CADDKRnCQAcuA=fv+4g-3aVU3U_zwssMAcoek0mu_ip24mO-pDg@mail.gmail.com>
On Thursday, March 31, 2016 11:05:56 AM Jörg Otte wrote:
[cut]
> >
>
> Yes, works for me.
>
> CPUID(7): No-SGX
> CPU Avg_MHz Busy% Bzy_MHz TSC_MHz
> - 11 0.66 1682 2494
> 0 11 0.60 1856 2494
> 1 6 0.34 1898 2494
> 2 13 0.82 1628 2494
> 3 13 0.87 1528 2494
> CPU Avg_MHz Busy% Bzy_MHz TSC_MHz
> - 6 0.58 963 2494
> 0 8 0.83 957 2494
> 1 1 0.08 984 2494
> 2 10 1.04 975 2494
> 3 3 0.35 934 2494
>
Great, thanks!
To me, the only area where things are really different before and after the
revert is the initialization, so that likely is when the problem triggers.
And sure enough, there is an initialization problem in intel_pstate.
Please test the patch below instead of the revert and let me know if it
makes any difference.
It (or equivalent) will need to be applied anyway, so we'll work on top of it
going forward, but also it may just be sufficient to address the problem you're
seeing.
---
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Subject: [PATCH] intel_pstate: Do not set utilization update hook too early
The utilization update hook in the intel_pstate driver is set too
early, as it only should be set after the policy has been fully
initialized by the core. That may cause intel_pstate_update_util()
to use incorrect data and put the CPUs into incorrect P-states as
a result.
To prevent that from happening, make intel_pstate_set_policy() set
the utilization update hook instead of intel_pstate_init_cpu() so
intel_pstate_update_util() only runs when all things have been
initialized as appropriate.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/cpufreq/intel_pstate.c | 27 +++++++++++++++++++--------
1 file changed, 19 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
@@ -1103,7 +1103,6 @@ static int intel_pstate_init_cpu(unsigne
intel_pstate_sample(cpu, 0);
cpu->update_util.func = intel_pstate_update_util;
- cpufreq_set_update_util_data(cpunum, &cpu->update_util);
pr_debug("intel_pstate: controlling: cpu %d\n", cpunum);
@@ -1122,18 +1121,29 @@ static unsigned int intel_pstate_get(uns
return get_avg_frequency(cpu);
}
+static void intel_pstate_set_update_util_hook(unsigned int cpu)
+{
+ cpufreq_set_update_util_data(cpu, &all_cpu_data[cpu]->update_util);
+}
+
+static void intel_pstate_clear_update_util_hook(unsigned int cpu)
+{
+ cpufreq_set_update_util_data(cpu, NULL);
+ synchronize_sched();
+}
+
static int intel_pstate_set_policy(struct cpufreq_policy *policy)
{
if (!policy->cpuinfo.max_freq)
return -ENODEV;
+ intel_pstate_clear_update_util_hook(policy->cpu);
+
if (policy->policy == CPUFREQ_POLICY_PERFORMANCE &&
policy->max >= policy->cpuinfo.max_freq) {
pr_debug("intel_pstate: set performance\n");
limits = &performance_limits;
- if (hwp_active)
- intel_pstate_hwp_set(policy->cpus);
- return 0;
+ goto out;
}
pr_debug("intel_pstate: set powersave\n");
@@ -1163,6 +1173,9 @@ static int intel_pstate_set_policy(struc
limits->max_perf = div_fp(int_tofp(limits->max_perf_pct),
int_tofp(100));
+ out:
+ intel_pstate_set_update_util_hook(policy->cpu);
+
if (hwp_active)
intel_pstate_hwp_set(policy->cpus);
@@ -1187,8 +1200,7 @@ static void intel_pstate_stop_cpu(struct
pr_debug("intel_pstate: CPU %d exiting\n", cpu_num);
- cpufreq_set_update_util_data(cpu_num, NULL);
- synchronize_sched();
+ intel_pstate_set_update_util_hook(cpu_num);
if (hwp_active)
return;
@@ -1455,8 +1467,7 @@ out:
get_online_cpus();
for_each_online_cpu(cpu) {
if (all_cpu_data[cpu]) {
- cpufreq_set_update_util_data(cpu, NULL);
- synchronize_sched();
+ intel_pstate_clear_update_util_hook(cpu);
kfree(all_cpu_data[cpu]);
}
}
next prev parent reply other threads:[~2016-03-31 11:39 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CADDKRnD81Hmf+JnG6NEpQWKiKE6_mqet5yRpLJ5K_0U1GtfahQ@mail.gmail.com>
2016-03-29 17:32 ` Jörg Otte
2016-03-29 21:34 ` Rafael J. Wysocki
2016-03-30 10:17 ` Jörg Otte
2016-03-30 11:05 ` Rafael J. Wysocki
2016-03-30 15:29 ` Jörg Otte
2016-03-30 18:39 ` Rafael J. Wysocki
2016-03-31 9:05 ` Jörg Otte
2016-03-31 11:42 ` Rafael J. Wysocki [this message]
2016-03-31 15:25 ` Jörg Otte
2016-03-31 15:43 ` Rafael J. Wysocki
2016-03-31 16:10 ` Srinivas Pandruvada
2016-03-31 17:27 ` Jörg Otte
2016-03-31 17:55 ` Srinivas Pandruvada
2016-04-01 0:08 ` Rafael J. Wysocki
2016-04-01 9:42 ` Jörg Otte
2016-04-01 15:05 ` Srinivas Pandruvada
2016-04-01 20:24 ` Rafael J. Wysocki
2016-04-01 9:20 ` Jörg Otte
2016-04-01 12:40 ` Rafael J. Wysocki
2016-04-01 14:06 ` Jörg Otte
2016-04-01 17:44 ` Srinivas Pandruvada
2016-04-01 18:31 ` Doug Smythies
2016-04-01 18:41 ` Srinivas Pandruvada
2016-04-01 19:54 ` Rafael J. Wysocki
2016-04-01 23:36 ` Doug Smythies
2016-04-02 0:28 ` Rafael J. Wysocki
2016-04-01 20:28 ` Rafael J. Wysocki
2016-04-02 22:50 ` Rafael J. Wysocki
2016-04-01 15:20 ` Doug Smythies
2016-04-01 16:46 ` Jörg Otte
2016-04-01 17:34 ` Jörg Otte
2016-03-30 15:33 ` Pandruvada, Srinivas
2016-03-30 15:51 ` Jörg Otte
2016-03-30 18:50 ` Doug Smythies
2016-03-30 18:58 ` Srinivas Pandruvada
2016-03-30 20:12 ` Rafael J. Wysocki
2016-03-30 20:26 ` Srinivas Pandruvada
2016-03-31 9:23 ` Jörg Otte
2016-03-31 14:39 ` Doug Smythies
2016-03-31 15:06 ` Srinivas Pandruvada
2016-03-31 15:32 ` Jörg Otte
2016-03-31 15:10 ` Doug Smythies
2016-04-01 7:20 ` Doug Smythies
2016-03-30 21:41 Sedat Dilek
2016-03-30 21:58 ` Rafael J. Wysocki
2016-03-30 22:23 ` Sedat Dilek
2016-03-30 22:29 ` Rafael J. Wysocki
2016-03-30 22:18 ` Srinivas Pandruvada
2016-03-30 22:25 ` Rafael J. Wysocki
2016-03-30 22:46 ` Srinivas Pandruvada
2016-03-30 23:17 ` Pandruvada, Srinivas
2016-03-30 23:25 ` Sedat Dilek
2016-03-30 23:28 ` Rafael J. Wysocki
2016-03-30 23:32 ` Sedat Dilek
2016-03-30 23:41 ` Rafael J. Wysocki
2016-03-31 6:38 ` Sedat Dilek
2016-03-31 7:45 ` Sedat Dilek
[not found] ` <CAA=4085Mmv7gRpJid8UGQ4ti6c1HhaENnogd8aPrg6E-w68QWg@mail.gmail.com>
2016-03-31 7:28 ` Navin P.S
2016-03-30 22:50 ` Doug Smythies
2016-03-30 23:12 ` Srinivas Pandruvada
2016-03-31 8:10 ` Sedat Dilek
2016-03-31 14:30 ` Doug Smythies
2016-04-02 6:12 ` Sedat Dilek
[not found] ` <CA+icZUVHyq7dOh457rYv+2nmNxPevY0ZcqxhQVhYG4Z1D-NaDA@mail.gmail.com>
2016-04-02 15:28 ` Srinivas Pandruvada
2016-04-02 17:19 ` Jörg Otte
2016-04-02 18:20 ` Sedat Dilek
2016-04-03 18:59 ` Doug Smythies
2016-04-04 5:13 ` Sedat Dilek
2016-04-04 6:14 ` Doug Smythies
2016-04-04 14:12 ` Sedat Dilek
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=8393335.Q1cjiaGecN@vostro.rjw.lan \
--to=rjw@rjwysocki.net \
--cc=jrg.otte@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=srinivas.pandruvada@linux.intel.com \
/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
all inboxes | Powered by JetHome®