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

Anton Blanchard anton at samba.org
Wed Mar 21 13:04:43 EST 2007


[Resent with __initdata fix from Olof]

Now we use notifier hooks we have to be careful not to enable xmon multiple
times.

Signed-off-by: Anton Blanchard <anton at samba.org>
---

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 xmon_on = 1;
+#else
+int xmon_on = 0;
+#endif
+
 #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());
 }
 
@@ -2683,18 +2692,18 @@
 __initcall(setup_xmon_sysrq);
 #endif /* CONFIG_MAGIC_SYSRQ */
 
-int __initdata xmon_early, xmon_off;
+int __initdata xmon_early;
 
 static int __init early_parse_xmon(char *p)
 {
 	if (!p || strncmp(p, "early", 5) == 0) {
 		/* just "xmon" is equivalent to "xmon=early" */
-		xmon_enable();
+		xmon_on = 1;
 		xmon_early = 1;
 	} else if (strncmp(p, "on", 2) == 0)
-		xmon_enable();
+		xmon_on = 1;
 	else if (strncmp(p, "off", 3) == 0)
-		xmon_off = 1;
+		xmon_on = 0;
 	else if (strncmp(p, "nobt", 4) == 0)
 		xmon_no_auto_backtrace = 1;
 	else
@@ -2706,10 +2715,9 @@
 
 void __init xmon_setup(void)
 {
-#ifdef CONFIG_XMON_DEFAULT
-	if (!xmon_off)
+	if (xmon_on)
 		xmon_enable();
-#endif
+
 	if (xmon_early)
 		xmon(NULL);
 }

--

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev at ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev



More information about the Linuxppc-dev mailing list