[PATCH v3 05/13] arm64: debug: remove break/step handler registration infrastructure

Anshuman Khandual anshuman.khandual at arm.com
Fri Jun 13 01:14:38 PDT 2025



On 09/06/25 11:04 PM, Ada Couprie Diaz wrote:
> Remove all infrastructure for the dynamic registration previously used by
> software breakpoints and stepping handlers.
> 
> Signed-off-by: Ada Couprie Diaz <ada.coupriediaz at arm.com>
> ---
>  arch/arm64/include/asm/debug-monitors.h | 24 ----------
>  arch/arm64/kernel/debug-monitors.c      | 63 -------------------------
>  2 files changed, 87 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/debug-monitors.h b/arch/arm64/include/asm/debug-monitors.h
> index e1caf6a8380c..caee1d923f9c 100644
> --- a/arch/arm64/include/asm/debug-monitors.h
> +++ b/arch/arm64/include/asm/debug-monitors.h
> @@ -62,30 +62,6 @@ struct task_struct;
>  #define DBG_HOOK_HANDLED	0
>  #define DBG_HOOK_ERROR		1
>  
> -struct step_hook {
> -	struct list_head node;
> -	int (*fn)(struct pt_regs *regs, unsigned long esr);
> -};
> -
> -void register_user_step_hook(struct step_hook *hook);
> -void unregister_user_step_hook(struct step_hook *hook);
> -
> -void register_kernel_step_hook(struct step_hook *hook);
> -void unregister_kernel_step_hook(struct step_hook *hook);
> -
> -struct break_hook {
> -	struct list_head node;
> -	int (*fn)(struct pt_regs *regs, unsigned long esr);
> -	u16 imm;
> -	u16 mask; /* These bits are ignored when comparing with imm */
> -};
> -
> -void register_user_break_hook(struct break_hook *hook);
> -void unregister_user_break_hook(struct break_hook *hook);
> -
> -void register_kernel_break_hook(struct break_hook *hook);
> -void unregister_kernel_break_hook(struct break_hook *hook);
> -
>  u8 debug_monitors_arch(void);
>  
>  enum dbg_active_el {
> diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
> index b156bef7f61e..02ba2c5e40ec 100644
> --- a/arch/arm64/kernel/debug-monitors.c
> +++ b/arch/arm64/kernel/debug-monitors.c
> @@ -159,46 +159,6 @@ NOKPROBE_SYMBOL(clear_user_regs_spsr_ss);
>  #define set_regs_spsr_ss(r)	set_user_regs_spsr_ss(&(r)->user_regs)
>  #define clear_regs_spsr_ss(r)	clear_user_regs_spsr_ss(&(r)->user_regs)
>  
> -static DEFINE_SPINLOCK(debug_hook_lock);
> -static LIST_HEAD(user_step_hook);
> -static LIST_HEAD(kernel_step_hook);
> -
> -static void register_debug_hook(struct list_head *node, struct list_head *list)
> -{
> -	spin_lock(&debug_hook_lock);
> -	list_add_rcu(node, list);
> -	spin_unlock(&debug_hook_lock);
> -
> -}
> -
> -static void unregister_debug_hook(struct list_head *node)
> -{
> -	spin_lock(&debug_hook_lock);
> -	list_del_rcu(node);
> -	spin_unlock(&debug_hook_lock);
> -	synchronize_rcu();
> -}
> -
> -void register_user_step_hook(struct step_hook *hook)
> -{
> -	register_debug_hook(&hook->node, &user_step_hook);
> -}
> -
> -void unregister_user_step_hook(struct step_hook *hook)
> -{
> -	unregister_debug_hook(&hook->node);
> -}
> -
> -void register_kernel_step_hook(struct step_hook *hook)
> -{
> -	register_debug_hook(&hook->node, &kernel_step_hook);
> -}
> -
> -void unregister_kernel_step_hook(struct step_hook *hook)
> -{
> -	unregister_debug_hook(&hook->node);
> -}
> -
>  /*
>   * Call single step handlers
>   * There is no Syndrome info to check for determining the handler.
> @@ -264,29 +224,6 @@ static int single_step_handler(unsigned long unused, unsigned long esr,
>  }
>  NOKPROBE_SYMBOL(single_step_handler);
>  
> -static LIST_HEAD(user_break_hook);
> -static LIST_HEAD(kernel_break_hook);
> -
> -void register_user_break_hook(struct break_hook *hook)
> -{
> -	register_debug_hook(&hook->node, &user_break_hook);
> -}
> -
> -void unregister_user_break_hook(struct break_hook *hook)
> -{
> -	unregister_debug_hook(&hook->node);
> -}
> -
> -void register_kernel_break_hook(struct break_hook *hook)
> -{
> -	register_debug_hook(&hook->node, &kernel_break_hook);
> -}
> -
> -void unregister_kernel_break_hook(struct break_hook *hook)
> -{
> -	unregister_debug_hook(&hook->node);
> -}
> -
>  static int call_break_hook(struct pt_regs *regs, unsigned long esr)
>  {
>  	if (user_mode(regs)) {

LGTM, no residues remaining of these dropped infrastructure.

Reviewed-by: Anshuman Khandual <anshuman.khandual at arm.com>



More information about the linux-arm-kernel mailing list