Subject: Re: [PATCH 07/10] powerpc: add NMI IPI infrastructure

From: Nicholas Piggin <[email-masked]>
Date: Sat, 4 Feb 2017 12:49:59 +1000

On Fri, 3 Feb 2017 21:45:24 +1000
Nicholas Piggin <[email-masked]> wrote:

> On Tue, 20 Dec 2016 04:30:08 +1000
> Nicholas Piggin <[email-masked]> wrote:
> 
> > +static void do_smp_send_nmi_ipi(int cpu)
> > +{
> > +	if (cpu >= 0) {
> > +		do_message_pass(cpu, PPC_MSG_NMI_IPI);
> > +	} else {
> > +		unsigned int c;
> > +
> > +		for_each_online_cpu(c) {
> > +			if (c == raw_smp_processor_id())
> > +				continue;
> > +			do_message_pass(cpu, PPC_MSG_NMI_IPI);  
> 
> Okay this has a bug in the fallback path. Needs the following
> incremental patch. sysrq+x works okay with this (tested in mambo),
> and also recovers with "x" okay.

Also requires removal of get_online_cpus/put_online_cpus.

---
 arch/powerpc/kernel/smp.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 81256522985d..e1a429251a7d 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -448,8 +448,6 @@ static int smp_send_nmi_ipi(int cpu, void (*fn)(struct pt_regs *), u64 delay_us)
 	if (unlikely(!smp_ops))
 		return 0;
 
-	get_online_cpus();
-
 	/* Take the nmi_ipi_busy count/lock with interrupts hard disabled */
 	nmi_ipi_lock_start(&flags);
 	while (nmi_ipi_busy_count) {
@@ -491,8 +489,6 @@ static int smp_send_nmi_ipi(int cpu, void (*fn)(struct pt_regs *), u64 delay_us)
 	nmi_ipi_busy_count--;
 	nmi_ipi_unlock_end(&flags);
 
-	put_online_cpus();
-
 	return ret;
 }
 #endif /* CONFIG_NMI_IPI */
-- 
2.11.0