All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpufreq: Make cpufreq_online() call driver->offline() on errors
@ 2021-06-21 17:26 Rafael J. Wysocki
  2021-06-22  6:20 ` Viresh Kumar
  2021-06-22 19:11 ` [PATCH v2] " Rafael J. Wysocki
  0 siblings, 2 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2021-06-21 17:26 UTC (permalink / raw)
  To: Linux PM, Viresh Kumar; +Cc: LKML

From: Rafael J. Wysocki <rafael.j.wysocki@intel.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@intel.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);
 




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

end of thread, other threads:[~2021-06-23  3:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-21 17:26 [PATCH] cpufreq: Make cpufreq_online() call driver->offline() on errors Rafael J. Wysocki
2021-06-22  6:20 ` Viresh Kumar
2021-06-22 12:18   ` Rafael J. Wysocki
2021-06-22 19:11 ` [PATCH v2] " Rafael J. Wysocki
2021-06-23  3:10   ` Viresh Kumar

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.