[RFC PATCH 1/2] arm64: hw_breakpoint: convert CPU hotplug notifier to new infrastructure

Will Deacon will.deacon at arm.com
Fri Aug 26 04:41:41 PDT 2016


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



More information about the linux-arm-kernel mailing list