From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757661AbcCCOLZ (ORCPT ); Thu, 3 Mar 2016 09:11:25 -0500 Received: from e36.co.us.ibm.com ([32.97.110.154]:55654 "EHLO e36.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755936AbcCCOLX (ORCPT ); Thu, 3 Mar 2016 09:11:23 -0500 X-IBM-Helo: d03dlp03.boulder.ibm.com X-IBM-MailFrom: paulmck@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org;linux-tip-commits@vger.kernel.org Date: Thu, 3 Mar 2016 06:11:18 -0800 From: "Paul E. McKenney" To: tip-bot for Thomas Gleixner Cc: linux-tip-commits@vger.kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org, peterz@infradead.org, tglx@linutronix.de, mingo@kernel.org Subject: Re: [tip:smp/hotplug] cpu/hotplug: Plug death reporting race Message-ID: <20160303141118.GF3577@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <20160302201127.GA23440@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16030314-0021-0000-0000-0000179A1EC5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 03, 2016 at 02:03:35AM -0800, tip-bot for Thomas Gleixner wrote: > Commit-ID: 71f87b2fc64c2e9b6d53cb817f28711b959d3dfe > Gitweb: http://git.kernel.org/tip/71f87b2fc64c2e9b6d53cb817f28711b959d3dfe > Author: Thomas Gleixner > AuthorDate: Thu, 3 Mar 2016 10:52:10 +0100 > Committer: Thomas Gleixner > CommitDate: Thu, 3 Mar 2016 10:52:10 +0100 > > cpu/hotplug: Plug death reporting race > > Paul noticed that the conversion of the death reporting introduced a race > where the outgoing cpu might be delayed after waking the controll processor, > so it might not be able to call rcu_report_dead() before being physically > removed, leading to RCU stalls. > > We cant call complete after rcu_report_dead(), so instead of going back to > busy polling, simply issue a function call to do the completion. > > Fixes: 27d50c7eeb0f "rcu: Make CPU_DYING_IDLE an explicit call" > Reported-by: Paul E. McKenney > Link: http://lkml.kernel.org/r/20160302201127.GA23440@linux.vnet.ibm.com > Signed-off-by: Thomas Gleixner > Acked-by: Peter Zijlstra There are some possible issues with printk()s from WARN_ON() calls using RCU from within smp_call_function_single(), but in normal execution this should be OK. Besides, the WARN_ON() contains a cpu_online(this_cpu), so it simply won't fire in this case. So nice fix!!! Reviewed-by: Paul E. McKenney > --- > kernel/cpu.c | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > > diff --git a/kernel/cpu.c b/kernel/cpu.c > index ff8059b..93e9d89 100644 > --- a/kernel/cpu.c > +++ b/kernel/cpu.c > @@ -755,14 +755,26 @@ static int notify_dead(unsigned int cpu) > return 0; > } > > +static void cpuhp_complete_idle_dead(void *arg) > +{ > + struct cpuhp_cpu_state *st = arg; > + > + complete(&st->done); > +} > + > void cpuhp_report_idle_dead(void) > { > struct cpuhp_cpu_state *st = this_cpu_ptr(&cpuhp_state); > > BUG_ON(st->state != CPUHP_AP_OFFLINE); > - st->state = CPUHP_AP_IDLE_DEAD; > - complete(&st->done); > rcu_report_dead(smp_processor_id()); > + st->state = CPUHP_AP_IDLE_DEAD; > + /* > + * We cannot call complete after rcu_report_dead() so we delegate it > + * to an online cpu. > + */ > + smp_call_function_single(cpumask_first(cpu_online_mask), > + cpuhp_complete_idle_dead, st, 0); > } > > #else >