Subject: Re: [patch 10/10] Make sure we only enable xmon once

From: [email-masked] (Olof Johansson)
Date: Tue, 20 Mar 2007 21:11:49 -0500

On Tue, Mar 20, 2007 at 08:38:20PM -0500, [email-masked] wrote:
> Now we use notifier hooks we have to be careful not to enable xmon multiple
> times.
> 
> Signed-off-by: Anton Blanchard <[email-masked]>
> ---
> 
> Index: linux-2.6/arch/powerpc/xmon/xmon.c
> ===================================================================
> --- linux-2.6.orig/arch/powerpc/xmon/xmon.c	2007-03-11 14:52:45.000000000 -0500
> +++ linux-2.6/arch/powerpc/xmon/xmon.c	2007-03-11 14:56:37.000000000 -0500
> @@ -2658,11 +2658,20 @@
>  	unregister_page_fault_notifier(&xmon_page_fault_nb);
>  }
>  
> +#ifdef CONFIG_XMON_DEFAULT
> +int __initdata xmon_on = 1;
> +#else
> +int __initdata xmon_on = 0;
> +#endif

This shouldn't be __initdata, should it? It's used at runtime below.

> +
>  #ifdef CONFIG_MAGIC_SYSRQ
>  static void sysrq_handle_xmon(int key, struct tty_struct *tty) 
>  {
>  	/* ensure xmon is enabled */
> -	xmon_enable();
> +	if (!xmon_on) {
> +		xmon_on = 1;
> +		xmon_enable();
> +	}
>  	xmon(get_irq_regs());
>  }
[...]

-Olof