[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <11788436.O9o76ZdvQC@kreacher>
Date: Mon, 21 Jun 2021 19:26:12 +0200
From: "Rafael J. Wysocki" <rjw@...ysocki.net>
To: Linux PM <linux-pm@...r.kernel.org>,
Viresh Kumar <viresh.kumar@...aro.org>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] cpufreq: Make cpufreq_online() call driver->offline() on errors
From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
In the CPU removal path the ->offline() callback provided by the
driver is always invoked before ->exit(), but in the cpufreq_online()
error path it is not, so ->exit() is somehow expected to know the
context in which it has been called and act accordingly.
That is less than straightforward, so make cpufreq_online() invoke
the driver's ->offline() callback before ->exit() too.
This only potentially affects intel_pstate at this point.
Fixes: 91a12e91dc39 ("cpufreq: Allow light-weight tear down and bring up of CPUs")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
---
drivers/cpufreq/cpufreq.c | 3 +++
1 file changed, 3 insertions(+)
Index: linux-pm/drivers/cpufreq/cpufreq.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/cpufreq.c
+++ linux-pm/drivers/cpufreq/cpufreq.c
@@ -1516,6 +1516,9 @@ out_destroy_policy:
up_write(&policy->rwsem);
out_exit_policy:
+ if (cpufreq_driver->offline)
+ cpufreq_driver->offline(policy);
+
if (cpufreq_driver->exit)
cpufreq_driver->exit(policy);
Powered by blists - more mailing lists