ioremap problems

Anton Blanchard anton at samba.org
Wed Feb 4 21:51:13 EST 2004


> The patch you posted didn't apply cleanly for me on latest 2.6 from
> Ameslab; it inserted the Kconfig option in the middle of the vio stuff
> for some reason.  So I hand-patched the Kconfig; here's the patch I
> generated if anyone wants it.
>
> It would be nice to get this into Ameslab or mainline, it's very useful.

Let me try it on Andrew once again but I'll merge it into ameslab
regardless.

Heres another simple patch based on the x86 version. It warns whenever
we use more than 8kB of stack (out of 16kB). I set the threshold rather
high since it doesnt catch the full extent of stack usage (it only
catches the start of the last irq).

Anton

===== arch/ppc64/Kconfig 1.31 vs edited =====


 gr16b-anton/arch/ppc64/Kconfig      |    4 ++++
 gr16b-anton/arch/ppc64/kernel/irq.c |   15 +++++++++++++++
 2 files changed, 19 insertions(+)

diff -puN arch/ppc64/Kconfig~debug_stackoverflow arch/ppc64/Kconfig
--- gr16b/arch/ppc64/Kconfig~debug_stackoverflow	2004-01-22 01:18:46.234108336 +1100
+++ gr16b-anton/arch/ppc64/Kconfig	2004-01-22 01:18:46.242108222 +1100
@@ -312,6 +312,10 @@ config DEBUG_KERNEL
 	  Say Y here if you are developing drivers or trying to debug and
 	  identify kernel problems.

+config DEBUG_STACKOVERFLOW
+	bool "Check for stack overflows"
+	depends on DEBUG_KERNEL
+
 config DEBUG_SLAB
 	bool "Debug memory allocations"
 	depends on DEBUG_KERNEL
diff -puN arch/ppc64/kernel/irq.c~debug_stackoverflow arch/ppc64/kernel/irq.c
--- gr16b/arch/ppc64/kernel/irq.c~debug_stackoverflow	2004-01-22 01:18:46.237108293 +1100
+++ gr16b-anton/arch/ppc64/kernel/irq.c	2004-01-22 01:25:34.498313587 +1100
@@ -568,6 +568,21 @@ int do_IRQ(struct pt_regs *regs)

 	irq_enter();

+#ifdef CONFIG_DEBUG_STACKOVERFLOW
+	/* Debugging check for stack overflow: is there less than 8KB free? */
+	{
+		long sp;
+
+		sp = (unsigned long)_get_SP() & (THREAD_SIZE-1);
+
+		if (unlikely(sp < (sizeof(struct thread_info) + 8192))) {
+			printk("do_IRQ: stack overflow: %ld\n",
+				sp - sizeof(struct thread_info));
+			dump_stack();
+		}
+	}
+#endif
+
 	lpaca = get_paca();
 #ifdef CONFIG_SMP
 	if (lpaca->xLpPaca.xIntDword.xFields.xIpiCnt) {

_

** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list