[RFC 10/11] powerpc: kvm: on_primary_thread() force the secondary threads into NAP mode

kernelfans at gmail.com kernelfans at gmail.com
Fri Oct 17 06:29:59 AEDT 2014


The primary hwthread ceases the scheduler of secondary hwthread by
bringing them into NAP. Then, the secondary is ready for guest.

Signed-off-by: Liu Ping Fan <pingfank at linux.vnet.ibm.com>
---
 arch/powerpc/kvm/book3s_hv.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 4348abd..7896c31 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -1593,15 +1593,22 @@ static int on_primary_thread(void)
 {
 	int cpu = smp_processor_id();
 	int thr;
+	struct cpumask msk;
 
 	/* Are we on a primary subcore? */
 	if (cpu_thread_in_subcore(cpu))
 		return 0;
 
 	thr = 0;
+#ifdef KVMPPC_ENABLE_SECONDARY
+	while (++thr < threads_per_subcore)
+		cpumask_set_cpu(thr, &msk);
+	stop_cpus_async(&msk, kvmppc_secondary_stopper, NULL);
+#else
 	while (++thr < threads_per_subcore)
 		if (cpu_online(cpu + thr))
 			return 0;
+#endif
 
 	/* Grab all hw threads so they can't go into the kernel */
 	for (thr = 1; thr < threads_per_subcore; ++thr) {
-- 
1.8.3.1



More information about the Linuxppc-dev mailing list