Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752884AbcKRNsw (ORCPT ); Fri, 18 Nov 2016 08:48:52 -0500 Received: from foss.arm.com ([217.140.101.70]:48478 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752420AbcKRNst (ORCPT ); Fri, 18 Nov 2016 08:48:49 -0500 Date: Fri, 18 Nov 2016 13:48:48 +0000 From: Will Deacon To: Thomas Gleixner Cc: Sebastian Andrzej Siewior , linux-kernel@vger.kernel.org, rt@linuxtronix.de, Mark Rutland , Russell King , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 15/20] ARM/hw_breakpoint: Convert to hotplug state machine Message-ID: <20161118134847.GO13470@arm.com> References: <20161117183541.8588-1-bigeasy@linutronix.de> <20161117183541.8588-16-bigeasy@linutronix.de> <20161118120453.GI13470@arm.com> <20161118132912.GM13470@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1378 Lines: 31 On Fri, Nov 18, 2016 at 02:42:15PM +0100, Thomas Gleixner wrote: > On Fri, 18 Nov 2016, Will Deacon wrote: > > On Fri, Nov 18, 2016 at 02:11:58PM +0100, Thomas Gleixner wrote: > > > But it's guaranteed that cpuhp_setup_state() will not return before the > > > callback has been invoked on each online cpu. > > > > Ok, that's good. > > > > > If cpus are not yet online when that code is invoked, then it's the same > > > behaviour as before. It will be invoked when the cpu comes online. > > > > Just to check, but what stops a CPU from coming online between the call > > to cpuhp_setup_state and the call to cpuhp_remove_state_nocalls in the > > case of failure (debug_err_mask isn't empty)? > > Indeed! I missed that part. So we still need a get/put_online_cpus() > protection around all of this. Yes, that should do it. > Just for curiosity sake. Wouldn't it be simpler and less error prone to > make the ARM_DBG_READ/WRITE macros use the exception table and handle that > in the undefined instruction handler to avoid this hook dance? That would be an option, but it's only the reset sequence that could generate this fault so it's simpler to isolate it there. We'd also have to take into account SMP if we toggle the handler in the READ/WRITE accessors, since the fault handler framework is system-wide as opposed to per-cpu. The whole thing is grotty as hell. Will