From: kernelfans@gmail.com Date: Thu, 16 Oct 2014 07:26:22 +0000 Subject: [RFC 10/11] powerpc: kvm: on_primary_thread() force the secondary threads into NAP mode Message-Id: <1413487800-7162-11-git-send-email-kernelfans@gmail.com> List-Id: References: <1413487800-7162-1-git-send-email-kernelfans@gmail.com> In-Reply-To: <1413487800-7162-1-git-send-email-kernelfans@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org Cc: Paul Mackerras , Alexander Graf 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 --- 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