diff mbox

cpufreq: only stop ondemand governor if already started

Message ID CACMJ4GaviB67Mv32QeeaTkem+pQ8aNHz-OVmojcAT902Hmk6Og@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Christopher Clark Aug. 9, 2017, 1:57 a.m. UTC
Avoid panic in cpufreq_gov_stop.

Only execute the CPUFREQ_GOV_STOP logic if the governor has
actually been started.

Patch originated in OpenXT.

Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com>
---
 xen/drivers/cpufreq/cpufreq_ondemand.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Jan Beulich Aug. 9, 2017, 9:25 a.m. UTC | #1
>>> On 09.08.17 at 03:57, <christopher.w.clark@gmail.com> wrote:
> Avoid panic in cpufreq_gov_stop.

There's no such function afaics; ...

> Only execute the CPUFREQ_GOV_STOP logic if the governor has
> actually been started.

... all dbs_timer_exit() does is a kill_timer(), so at the very least
the description needs correction.

> Patch originated in OpenXT.

With the original author impossible to identify?

Jan
diff mbox

Patch

diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c
b/xen/drivers/cpufreq/cpufreq_ondemand.c
index 7fdba03..fe6c63d 100644
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c
@@ -273,6 +273,10 @@  int cpufreq_governor_dbs(struct cpufreq_policy
*policy, unsigned int event)
         break;

     case CPUFREQ_GOV_STOP:
+        if ( !this_dbs_info->enable )
+            /* Already not enabled */
+            break;
+
         dbs_timer_exit(this_dbs_info);
         dbs_enable--;