From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752277AbdLLRky (ORCPT ); Tue, 12 Dec 2017 12:40:54 -0500 Received: from guitar.tcltek.co.il ([192.115.133.116]:57750 "EHLO mx.tkos.co.il" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751641AbdLLRkv (ORCPT ); Tue, 12 Dec 2017 12:40:51 -0500 Date: Tue, 12 Dec 2017 19:40:46 +0200 From: Baruch Siach To: "Paul E. McKenney" Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Michal Hocko , "Peter Zijlstra (Intel)" , Russell King - ARM Linux , Fabio Estevam , Peng Fan , Thomas Gleixner , Ingo Molnar Subject: Re: [PATCH] ARM: CPU hotplug: Delegate complete() to surviving CPU Message-ID: <20171212174046.gn4t3qeck3bq7scw@tarshish> References: <20171212172059.GA11875@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171212172059.GA11875@linux.vnet.ibm.com> User-Agent: NeoMutt/20171027 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Paul, On Tue, Dec 12, 2017 at 09:20:59AM -0800, Paul E. McKenney wrote: > The ARM implementation of arch_cpu_idle_dead() invokes complete(), but > does so after RCU has stopped watching the outgoing CPU, which results > in lockdep complaints because complete() invokes functions containing RCU > readers. This patch therefore uses Thomas Gleixner's trick of delegating > the complete() call to a surviving CPU via smp_call_function_single(). > > Reported-by: Peng Fan > Reported-by: Russell King - ARM Linux > Signed-off-by: Paul E. McKenney > Tested-by: Tested-by: Fabio Estevam Fabio reported only once, though he might have tested twice. baruch > Cc: Russell King > Cc: Ingo Molnar > Cc: "Peter Zijlstra (Intel)" > Cc: Michal Hocko > Cc: Thomas Gleixner > Cc: > > diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c > index b4fbf00ee4ad..75f85e20aafa 100644 > --- a/arch/arm/kernel/smp.c > +++ b/arch/arm/kernel/smp.c > @@ -267,6 +267,14 @@ void __cpu_die(unsigned int cpu) > } > > /* > + * Invoke complete() on behalf of the outgoing CPU. > + */ > +static void arch_cpu_idle_dead_complete(void *arg) > +{ > + complete(&cpu_died); > +} > + > +/* > * Called from the idle thread for the CPU which has been shutdown. > * > * Note that we disable IRQs here, but do not re-enable them > @@ -293,9 +301,11 @@ void arch_cpu_idle_dead(void) > /* > * Tell __cpu_die() that this CPU is now safe to dispose of. Once > * this returns, power and/or clocks can be removed at any point > - * from this CPU and its cache by platform_cpu_kill(). > + * from this CPU and its cache by platform_cpu_kill(). We cannot > + * call complete() this late, so we delegate it to an online CPU. > */ > - complete(&cpu_died); > + smp_call_function_single(cpumask_first(cpu_online_mask), > + arch_cpu_idle_dead_complete, NULL, 0); > > /* > * Ensure that the cache lines associated with that completion are -- http://baruch.siach.name/blog/ ~. .~ Tk Open Systems =}------------------------------------------------ooO--U--Ooo------------{= - baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -