* [patch 06/20] cpufreq: Use cpuhp_setup_state_nocalls_locked()
[not found] <20170415170107.643253702@linutronix.de>
@ 2017-04-15 17:01 ` Thomas Gleixner
2017-04-15 22:54 ` Rafael J. Wysocki
2017-04-17 4:14 ` Viresh Kumar
0 siblings, 2 replies; 3+ messages in thread
From: Thomas Gleixner @ 2017-04-15 17:01 UTC (permalink / raw)
To: LKML
Cc: Peter Zijlstra, Ingo Molnar, Steven Rostedt, Sebastian Siewior,
Rafael J. Wysocki, Viresh Kumar, linux-pm
[-- Attachment #1: cpufreq-Use-cpuhp_setup_state_nocalls_locked.patch --]
[-- Type: text/plain, Size: 1599 bytes --]
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
cpufreq holds get_online_cpus() while invoking cpuhp_setup_state_nocalls()
to make subsys_interface_register() and the registration of hotplug calls
atomic versus cpu hotplug.
cpuhp_setup_state_nocalls() invokes get_online_cpus() as well. This is
correct, but prevents the conversion of the hotplug locking to a percpu
rwsem.
Use cpuhp_setup_state_nocalls_locked() to avoid the nested call.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-pm@vger.kernel.org
---
drivers/cpufreq/cpufreq.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2473,9 +2473,10 @@ int cpufreq_register_driver(struct cpufr
goto err_if_unreg;
}
- ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "cpufreq:online",
- cpuhp_cpufreq_online,
- cpuhp_cpufreq_offline);
+ ret = cpuhp_setup_state_nocalls_locked(CPUHP_AP_ONLINE_DYN,
+ "cpufreq:online",
+ cpuhp_cpufreq_online,
+ cpuhp_cpufreq_offline);
if (ret < 0)
goto err_if_unreg;
hp_online = ret;
@@ -2519,7 +2520,7 @@ int cpufreq_unregister_driver(struct cpu
get_online_cpus();
subsys_interface_unregister(&cpufreq_interface);
remove_boost_sysfs_file();
- cpuhp_remove_state_nocalls(hp_online);
+ cpuhp_remove_state_nocalls_locked(hp_online);
write_lock_irqsave(&cpufreq_driver_lock, flags);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch 06/20] cpufreq: Use cpuhp_setup_state_nocalls_locked()
2017-04-15 17:01 ` [patch 06/20] cpufreq: Use cpuhp_setup_state_nocalls_locked() Thomas Gleixner
@ 2017-04-15 22:54 ` Rafael J. Wysocki
2017-04-17 4:14 ` Viresh Kumar
1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2017-04-15 22:54 UTC (permalink / raw)
To: Thomas Gleixner
Cc: LKML, Peter Zijlstra, Ingo Molnar, Steven Rostedt,
Sebastian Siewior, Rafael J. Wysocki, Viresh Kumar, Linux PM
On Sat, Apr 15, 2017 at 7:01 PM, Thomas Gleixner <tglx@linutronix.de> wrote:
> From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
>
> cpufreq holds get_online_cpus() while invoking cpuhp_setup_state_nocalls()
> to make subsys_interface_register() and the registration of hotplug calls
> atomic versus cpu hotplug.
>
> cpuhp_setup_state_nocalls() invokes get_online_cpus() as well. This is
> correct, but prevents the conversion of the hotplug locking to a percpu
> rwsem.
>
> Use cpuhp_setup_state_nocalls_locked() to avoid the nested call.
>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>
> Cc: linux-pm@vger.kernel.org
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> ---
> drivers/cpufreq/cpufreq.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -2473,9 +2473,10 @@ int cpufreq_register_driver(struct cpufr
> goto err_if_unreg;
> }
>
> - ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "cpufreq:online",
> - cpuhp_cpufreq_online,
> - cpuhp_cpufreq_offline);
> + ret = cpuhp_setup_state_nocalls_locked(CPUHP_AP_ONLINE_DYN,
> + "cpufreq:online",
> + cpuhp_cpufreq_online,
> + cpuhp_cpufreq_offline);
> if (ret < 0)
> goto err_if_unreg;
> hp_online = ret;
> @@ -2519,7 +2520,7 @@ int cpufreq_unregister_driver(struct cpu
> get_online_cpus();
> subsys_interface_unregister(&cpufreq_interface);
> remove_boost_sysfs_file();
> - cpuhp_remove_state_nocalls(hp_online);
> + cpuhp_remove_state_nocalls_locked(hp_online);
>
> write_lock_irqsave(&cpufreq_driver_lock, flags);
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch 06/20] cpufreq: Use cpuhp_setup_state_nocalls_locked()
2017-04-15 17:01 ` [patch 06/20] cpufreq: Use cpuhp_setup_state_nocalls_locked() Thomas Gleixner
2017-04-15 22:54 ` Rafael J. Wysocki
@ 2017-04-17 4:14 ` Viresh Kumar
1 sibling, 0 replies; 3+ messages in thread
From: Viresh Kumar @ 2017-04-17 4:14 UTC (permalink / raw)
To: Thomas Gleixner
Cc: LKML, Peter Zijlstra, Ingo Molnar, Steven Rostedt,
Sebastian Siewior, Rafael J. Wysocki, linux-pm
On 15-04-17, 19:01, Thomas Gleixner wrote:
> From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
>
> cpufreq holds get_online_cpus() while invoking cpuhp_setup_state_nocalls()
> to make subsys_interface_register() and the registration of hotplug calls
> atomic versus cpu hotplug.
>
> cpuhp_setup_state_nocalls() invokes get_online_cpus() as well. This is
> correct, but prevents the conversion of the hotplug locking to a percpu
> rwsem.
>
> Use cpuhp_setup_state_nocalls_locked() to avoid the nested call.
>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>
> Cc: linux-pm@vger.kernel.org
>
> ---
> drivers/cpufreq/cpufreq.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -2473,9 +2473,10 @@ int cpufreq_register_driver(struct cpufr
> goto err_if_unreg;
> }
>
> - ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "cpufreq:online",
> - cpuhp_cpufreq_online,
> - cpuhp_cpufreq_offline);
> + ret = cpuhp_setup_state_nocalls_locked(CPUHP_AP_ONLINE_DYN,
> + "cpufreq:online",
> + cpuhp_cpufreq_online,
> + cpuhp_cpufreq_offline);
> if (ret < 0)
> goto err_if_unreg;
> hp_online = ret;
> @@ -2519,7 +2520,7 @@ int cpufreq_unregister_driver(struct cpu
> get_online_cpus();
> subsys_interface_unregister(&cpufreq_interface);
> remove_boost_sysfs_file();
> - cpuhp_remove_state_nocalls(hp_online);
> + cpuhp_remove_state_nocalls_locked(hp_online);
>
> write_lock_irqsave(&cpufreq_driver_lock, flags);
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-17 4:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20170415170107.643253702@linutronix.de>
2017-04-15 17:01 ` [patch 06/20] cpufreq: Use cpuhp_setup_state_nocalls_locked() Thomas Gleixner
2017-04-15 22:54 ` Rafael J. Wysocki
2017-04-17 4:14 ` Viresh Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).