All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen/cpufreq: Reset policy after enabling/disabling turbo status
@ 2021-11-10  9:19 Jane Malalane
  2021-11-10 11:48 ` Ian Jackson
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Jane Malalane @ 2021-11-10  9:19 UTC (permalink / raw)
  To: Xen-devel; +Cc: Jane Malalane, Jan Beulich, Ian Jackson

Before, user would change turbo status but this had no effect: boolean
was set but policy wasn't reevaluated.  Policy must be reevaluated so
that CPU frequency is chosen according to the turbo status and the
current governor.

Therefore, add __cpufreq_governor() in cpufreq_update_turbo().

Reported-by: <edvin.torok@citrix.com>
Signed-off-by: <jane.malalane@citrix.com>
---
CC: Jan Beulich <jbeulich@suse.com>
CC: Ian Jackson <iwj@xenproject.org>
---

Release rationale:
Not taking this patch means that turbo status is misleading.

Taking this patch is low-risk as it only uses a function that already
exists and is already used for setting the chosen scaling governor.
Essentially, this change is equivalent to running 'xenpm
en/disable-turbo-mode' and, subsequently, running 'xenpm
set-scaling-governor <current governor>'.
---
 xen/drivers/cpufreq/utility.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/cpufreq/utility.c b/xen/drivers/cpufreq/utility.c
index b93895d4dd..5f200ff3ee 100644
--- a/xen/drivers/cpufreq/utility.c
+++ b/xen/drivers/cpufreq/utility.c
@@ -417,10 +417,14 @@ int cpufreq_update_turbo(int cpuid, int new_state)
     {
         ret = cpufreq_driver.update(cpuid, policy);
         if (ret)
+        {
             policy->turbo = curr_state;
+            return ret;
+        }
     }
 
-    return ret;
+    /* Reevaluate current CPU policy. */
+    return __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS);
 }
 
 
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-11-15 22:05 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-10  9:19 [PATCH] xen/cpufreq: Reset policy after enabling/disabling turbo status Jane Malalane
2021-11-10 11:48 ` Ian Jackson
2021-11-12 11:31   ` Jane Malalane
2021-11-10 12:39 ` Roger Pau Monné
2021-11-11 11:06   ` Jan Beulich
2021-11-11 11:00 ` Jan Beulich
2021-11-12 18:51 ` Andrew Cooper
2021-11-12 19:51   ` Jason Andryuk
2021-11-15 10:53   ` Jan Beulich
2021-11-15 14:33     ` Andrew Cooper
2021-11-15 16:21       ` Jan Beulich
2021-11-15 22:05         ` Andrew Cooper

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.