From mboxrd@z Thu Jan 1 00:00:00 1970 From: will.deacon@arm.com (Will Deacon) Date: Fri, 26 Aug 2016 12:41:41 +0100 Subject: [RFC PATCH 1/2] arm64: hw_breakpoint: convert CPU hotplug notifier to new infrastructure In-Reply-To: <20160826112806.rr3apxva73frag5x@linutronix.de> References: <1472207758-24394-1-git-send-email-will.deacon@arm.com> <20160826112806.rr3apxva73frag5x@linutronix.de> Message-ID: <20160826114141.GI13554@arm.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Fri, Aug 26, 2016 at 01:28:06PM +0200, Sebastian Andrzej Siewior wrote: > On 2016-08-26 11:35:57 [+0100], Will Deacon wrote: > > diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c > > index 26a6bf77d272..948b73148d56 100644 > > --- a/arch/arm64/kernel/hw_breakpoint.c > > +++ b/arch/arm64/kernel/hw_breakpoint.c > > @@ -857,7 +857,7 @@ void hw_breakpoint_thread_switch(struct task_struct *next) > ? > > -static int hw_breakpoint_reset_notify(struct notifier_block *self, > > - unsigned long action, > > - void *hcpu) > > -{ > > - if ((action & ~CPU_TASKS_FROZEN) == CPU_ONLINE) { > > - local_irq_disable(); > > - hw_breakpoint_reset(NULL); > > so the old one was invoked at CPU_ONLINE time. > > > - local_irq_enable(); > > - } > > - return NOTIFY_OK; > > + return 0; > > } > ? > > @@ -919,36 +905,34 @@ static inline void cpu_suspend_set_dbg_restorer(void (*hw_bp_restore)(void *)) > ? > > + /* > > + * Reset the breakpoint resources. We assume that a halting > > + * debugger will leave the world in a nice state for us. > > + */ > > + ret = cpuhp_setup_state(CPUHP_AP_PERF_ARM_HW_BREAKPOINT_STARTING, > > + "CPUHP_AP_PERF_ARM_HW_BREAKPOINT_STARTING", > > + hw_breakpoint_reset, NULL); > > But this will move it to CPU_STARTING. May I ask why? It probably should be there anyway, since the current code is explicitly disabling interrupts to mitigate being called with them enabled and debug is something we want as early as possible. Will