diff options
author | Chen Yu <yu.c.chen@intel.com> | 2017-04-09 01:45:16 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-04-21 03:31:22 -0400 |
commit | 5dda157006bc29986f4f168f485ecbb6f5cf5b3d (patch) | |
tree | 0d973d5ef645b73114fa3edd2c8923e97c3c8583 | |
parent | 5f48cacaa72c110b048b73ab928abf70f6ee163e (diff) |
cpufreq: Bring CPUs up even if cpufreq_online() failed
commit c4a3fa261b16858416f1fd7db03a33d7ef5fc0b3 upstream.
There is a report that after commit 27622b061eb4 ("cpufreq: Convert
to hotplug state machine"), the normal CPU offline/online cycle
fails on some platforms.
According to the ftrace result, this problem was triggered on
platforms using acpi-cpufreq as the default cpufreq driver,
and due to the lack of some ACPI freq method (eg. _PCT),
cpufreq_online() failed and returned a negative value, so the CPU
hotplug state machine rolled back the CPU online process. Actually,
from the user's perspective, the failure of cpufreq_online() should
not prevent that CPU from being brought up, although cpufreq might
not work on that CPU.
BTW, during system startup cpufreq_online() is not invoked via CPU
online but by the cpufreq device creation process, so the APs can be
brought up even though cpufreq_online() fails in that stage.
This patch ignores the return value of cpufreq_online/offline() and
lets the cpufreq framework deal with the failure. cpufreq_online()
itself will do a proper rollback in that case and if _PCT is missing,
the ACPI cpufreq driver will print a warning if the corresponding
debug options have been enabled.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=194581
Fixes: 27622b061eb4 ("cpufreq: Convert to hotplug state machine")
Reported-and-tested-by: Tomasz Maciej Nowak <tmn505@gmail.com>
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index cac4a92259da..6153b66139d5 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -2404,6 +2404,20 @@ EXPORT_SYMBOL_GPL(cpufreq_boost_enabled); | |||
2404 | *********************************************************************/ | 2404 | *********************************************************************/ |
2405 | static enum cpuhp_state hp_online; | 2405 | static enum cpuhp_state hp_online; |
2406 | 2406 | ||
2407 | static int cpuhp_cpufreq_online(unsigned int cpu) | ||
2408 | { | ||
2409 | cpufreq_online(cpu); | ||
2410 | |||
2411 | return 0; | ||
2412 | } | ||
2413 | |||
2414 | static int cpuhp_cpufreq_offline(unsigned int cpu) | ||
2415 | { | ||
2416 | cpufreq_offline(cpu); | ||
2417 | |||
2418 | return 0; | ||
2419 | } | ||
2420 | |||
2407 | /** | 2421 | /** |
2408 | * cpufreq_register_driver - register a CPU Frequency driver | 2422 | * cpufreq_register_driver - register a CPU Frequency driver |
2409 | * @driver_data: A struct cpufreq_driver containing the values# | 2423 | * @driver_data: A struct cpufreq_driver containing the values# |
@@ -2466,8 +2480,8 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) | |||
2466 | } | 2480 | } |
2467 | 2481 | ||
2468 | ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "cpufreq:online", | 2482 | ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "cpufreq:online", |
2469 | cpufreq_online, | 2483 | cpuhp_cpufreq_online, |
2470 | cpufreq_offline); | 2484 | cpuhp_cpufreq_offline); |
2471 | if (ret < 0) | 2485 | if (ret < 0) |
2472 | goto err_if_unreg; | 2486 | goto err_if_unreg; |
2473 | hp_online = ret; | 2487 | hp_online = ret; |