diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2017-05-24 04:15:21 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2017-05-26 04:10:39 -0400 |
commit | 419af25fa4d0974fd758a668c08c369c19392a47 (patch) | |
tree | e2f780bf8a9821337e4026972f7869d77eeaf647 | |
parent | a92551e41d5a7b563ae440496bc5ca19d205231d (diff) |
KVM/PPC/Book3S HV: Use cpuhp_setup_state_nocalls_cpuslocked()
kvmppc_alloc_host_rm_ops() holds get_online_cpus() while invoking
cpuhp_setup_state_nocalls().
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_cpuslocked() to avoid the nested
call. Convert *_online_cpus() to the new interfaces while at it.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: kvm@vger.kernel.org
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: kvm-ppc@vger.kernel.org
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: Alexander Graf <agraf@suse.com>
Link: http://lkml.kernel.org/r/20170524081547.809616236@linutronix.de
-rw-r--r-- | arch/powerpc/kvm/book3s_hv.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 42b7a4fd57d9..48a6bd160011 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c | |||
@@ -3317,7 +3317,7 @@ void kvmppc_alloc_host_rm_ops(void) | |||
3317 | return; | 3317 | return; |
3318 | } | 3318 | } |
3319 | 3319 | ||
3320 | get_online_cpus(); | 3320 | cpus_read_lock(); |
3321 | 3321 | ||
3322 | for (cpu = 0; cpu < nr_cpu_ids; cpu += threads_per_core) { | 3322 | for (cpu = 0; cpu < nr_cpu_ids; cpu += threads_per_core) { |
3323 | if (!cpu_online(cpu)) | 3323 | if (!cpu_online(cpu)) |
@@ -3339,17 +3339,17 @@ void kvmppc_alloc_host_rm_ops(void) | |||
3339 | l_ops = (unsigned long) ops; | 3339 | l_ops = (unsigned long) ops; |
3340 | 3340 | ||
3341 | if (cmpxchg64((unsigned long *)&kvmppc_host_rm_ops_hv, 0, l_ops)) { | 3341 | if (cmpxchg64((unsigned long *)&kvmppc_host_rm_ops_hv, 0, l_ops)) { |
3342 | put_online_cpus(); | 3342 | cpus_read_unlock(); |
3343 | kfree(ops->rm_core); | 3343 | kfree(ops->rm_core); |
3344 | kfree(ops); | 3344 | kfree(ops); |
3345 | return; | 3345 | return; |
3346 | } | 3346 | } |
3347 | 3347 | ||
3348 | cpuhp_setup_state_nocalls(CPUHP_KVM_PPC_BOOK3S_PREPARE, | 3348 | cpuhp_setup_state_nocalls_cpuslocked(CPUHP_KVM_PPC_BOOK3S_PREPARE, |
3349 | "ppc/kvm_book3s:prepare", | 3349 | "ppc/kvm_book3s:prepare", |
3350 | kvmppc_set_host_core, | 3350 | kvmppc_set_host_core, |
3351 | kvmppc_clear_host_core); | 3351 | kvmppc_clear_host_core); |
3352 | put_online_cpus(); | 3352 | cpus_read_unlock(); |
3353 | } | 3353 | } |
3354 | 3354 | ||
3355 | void kvmppc_free_host_rm_ops(void) | 3355 | void kvmppc_free_host_rm_ops(void) |