* [patch V3 10/32] KVM/PPC/Book3S HV: Use cpuhp_setup_state_nocalls_cpuslocked()
[not found] <20170524081511.203800767@linutronix.de>
@ 2017-05-24 8:15 ` Thomas Gleixner
2017-05-24 8:15 ` [patch V3 16/32] powerpc/powernv: Use stop_machine_cpuslocked() Thomas Gleixner
1 sibling, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2017-05-24 8:15 UTC (permalink / raw)
To: LKML
Cc: Peter Zijlstra, Ingo Molnar, Steven Rostedt, Sebastian Siewior,
Paul McKenney, kvm, Benjamin Herrenschmidt, kvm-ppc,
Michael Ellerman, linuxppc-dev, Alexander Graf
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
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>
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>
---
arch/powerpc/kvm/book3s_hv.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
--- 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)
return;
}
- get_online_cpus();
+ cpus_read_lock();
for (cpu = 0; cpu < nr_cpu_ids; cpu += threads_per_core) {
if (!cpu_online(cpu))
@@ -3339,17 +3339,17 @@ void kvmppc_alloc_host_rm_ops(void)
l_ops = (unsigned long) ops;
if (cmpxchg64((unsigned long *)&kvmppc_host_rm_ops_hv, 0, l_ops)) {
- put_online_cpus();
+ cpus_read_unlock();
kfree(ops->rm_core);
kfree(ops);
return;
}
- cpuhp_setup_state_nocalls(CPUHP_KVM_PPC_BOOK3S_PREPARE,
- "ppc/kvm_book3s:prepare",
- kvmppc_set_host_core,
- kvmppc_clear_host_core);
- put_online_cpus();
+ cpuhp_setup_state_nocalls_cpuslocked(CPUHP_KVM_PPC_BOOK3S_PREPARE,
+ "ppc/kvm_book3s:prepare",
+ kvmppc_set_host_core,
+ kvmppc_clear_host_core);
+ cpus_read_unlock();
}
void kvmppc_free_host_rm_ops(void)
^ permalink raw reply [flat|nested] 2+ messages in thread
* [patch V3 16/32] powerpc/powernv: Use stop_machine_cpuslocked()
[not found] <20170524081511.203800767@linutronix.de>
2017-05-24 8:15 ` [patch V3 10/32] KVM/PPC/Book3S HV: Use cpuhp_setup_state_nocalls_cpuslocked() Thomas Gleixner
@ 2017-05-24 8:15 ` Thomas Gleixner
1 sibling, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2017-05-24 8:15 UTC (permalink / raw)
To: LKML
Cc: Peter Zijlstra, Ingo Molnar, Steven Rostedt, Sebastian Siewior,
Paul McKenney, Benjamin Herrenschmidt, Michael Ellerman,
linuxppc-dev
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
set_subcores_per_core() holds get_online_cpus() while invoking stop_machine().
stop_machine() invokes get_online_cpus() as well. This is correct, but
prevents the conversion of the hotplug locking to a percpu rwsem.
Use stop_machine_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>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@lists.ozlabs.org
---
arch/powerpc/platforms/powernv/subcore.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
--- a/arch/powerpc/platforms/powernv/subcore.c
+++ b/arch/powerpc/platforms/powernv/subcore.c
@@ -348,7 +348,7 @@ static int set_subcores_per_core(int new
state->master = 0;
}
- get_online_cpus();
+ cpus_read_lock();
/* This cpu will update the globals before exiting stop machine */
this_cpu_ptr(&split_state)->master = 1;
@@ -356,9 +356,10 @@ static int set_subcores_per_core(int new
/* Ensure state is consistent before we call the other cpus */
mb();
- stop_machine(cpu_update_split_mode, &new_mode, cpu_online_mask);
+ stop_machine_cpuslocked(cpu_update_split_mode, &new_mode,
+ cpu_online_mask);
- put_online_cpus();
+ cpus_read_unlock();
return 0;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-24 8:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20170524081511.203800767@linutronix.de>
2017-05-24 8:15 ` [patch V3 10/32] KVM/PPC/Book3S HV: Use cpuhp_setup_state_nocalls_cpuslocked() Thomas Gleixner
2017-05-24 8:15 ` [patch V3 16/32] powerpc/powernv: Use stop_machine_cpuslocked() Thomas Gleixner
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).