All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Doug Smythies" <dsmythies@telus.net>
To: "'Rafael J. Wysocki'" <rafael@kernel.org>,
	"'Srinivas Pandruvada'" <srinivas.pandruvada@linux.intel.com>,
	"'Len Brown'" <lenb@kernel.org>
Cc: "'Thomas Gleixner'" <tglx@linutronix.de>,
	"'Linux PM'" <linux-pm@vger.kernel.org>,
	"'LKML'" <linux-kernel@vger.kernel.org>,
	<yang.jie@linux.intel.com>, "Doug Smythies" <dsmythies@telus.net>
Subject: [PATCH v2] cpufreq: intel_pstate: set stale CPU frequency to minimum
Date: Sun, 20 Aug 2023 13:46:49 -0700	[thread overview]
Message-ID: <001d01d9d3a7$71736f50$545a4df0$@telus.net> (raw)

The intel_pstate CPU frequency scaling driver does not
use policy->cur and it is 0.
When the CPU frequency is outdated arch_freq_get_on_cpu()
will default to the nominal clock frequency when its call to
cpufreq_quick_getpolicy_cur returns the never updated 0.
Thus, the listed frequency might be outside of currently
set limits. Some users are complaining about the high
reported frequency, albeit stale, when their system is
idle and/or it is above the reduced maximum they have set.

This patch will maintain policy_cur for the intel_pstate
driver at the current minimum CPU frequency.

Reported-by: Yang Jie <yang.jie@linux.intel.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217597
Signed-off-by: Doug Smythies <dsmythies@telus.net>
---

v1 -> v2:
   * v1 was a completely different approach, programming around
     the issue rather than fixing it at the source.
     reference:
     https://patchwork.kernel.org/project/linux-pm/patch/006901d9be8c$f4439930$dccacb90$@telus.net/
   * v2 does not fix an issue with the intel_cpufreq CPU scaling
     driver (A.K.A. the intel_pstate driver in passive mode) and
     the schedutil CPU frequency scaling governor when HWP is enabled
     where limit changes are not reflected in the stale listed frequencies.
     A fix for that will be some future patch.

---
 drivers/cpufreq/intel_pstate.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 8ca2bce4341a..08284dee583a 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -2609,6 +2609,11 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
                        intel_pstate_clear_update_util_hook(policy->cpu);
                intel_pstate_hwp_set(policy->cpu);
        }
+       /* policy current is never updated with the intel_pstate driver
+        * but it is used as a stale frequency value. So, keep it within
+        * limits.
+        */
+       policy->cur = policy->min;

        mutex_unlock(&intel_pstate_limits_lock);

--
2.25.1



             reply	other threads:[~2023-08-20 21:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-20 20:46 Doug Smythies [this message]
2023-08-22 11:46 ` [PATCH v2] cpufreq: intel_pstate: set stale CPU frequency to minimum Rafael J. Wysocki
2023-08-28 23:35   ` Keyon Jie
2023-08-29  8:57     ` Greg KH
2023-09-05 18:17       ` Keyon Jie
2023-09-05 18:30         ` Rafael J. Wysocki
2023-09-05 22:23           ` Keyon Jie

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='001d01d9d3a7$71736f50$545a4df0$@telus.net' \
    --to=dsmythies@telus.net \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=tglx@linutronix.de \
    --cc=yang.jie@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 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.