mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: mpatocka@redhat.com
Cc: sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: stack overflow on Sparc64
Date: Tue, 12 Aug 2008 01:22:01 -0700 (PDT)	[thread overview]
Message-ID: <20080812.012201.164876122.davem@davemloft.net> (raw)
In-Reply-To: <20080811.233013.49328708.davem@davemloft.net>

From: David Miller <davem@davemloft.net>
Date: Mon, 11 Aug 2008 23:30:13 -0700 (PDT)

> The problem is that CONFIG_STACK_DEBUG doesn't understand
> the IRQ stacks at all.
> 
> I'll see if I can tweak it to handle this.

This patch, on top of my original IRQSTACKS patch for
sparc64, seems to get things working for me.

diff --git a/arch/sparc64/lib/mcount.S b/arch/sparc64/lib/mcount.S
index 9e4534b..24e6a3c 100644
--- a/arch/sparc64/lib/mcount.S
+++ b/arch/sparc64/lib/mcount.S
@@ -45,11 +45,47 @@ _mcount:
 	sub		%g3, STACK_BIAS, %g3
 	cmp		%sp, %g3
 	bg,pt		%xcc, 1f
-	 sethi		%hi(panicstring), %g3
+	 nop
+#ifdef CONFIG_IRQSTACKS
+	lduh		[%g6 + TI_CPU], %g1
+	sethi		%hi(hardirq_stack), %g3
+	or		%g3, %lo(hardirq_stack), %g3
+	sllx		%g1, 3, %g1
+	ldx		[%g3 + %g1], %g7
+	sub		%g7, STACK_BIAS, %g7
+	cmp		%sp, %g7
+	bleu,pt		%xcc, 2f
+	 sethi		%hi(THREAD_SIZE), %g3
+	add		%g7, %g3, %g7
+	cmp		%sp, %g7
+	blu,pn		%xcc, 1f
+2:	 sethi		%hi(softirq_stack), %g3
+	or		%g3, %lo(softirq_stack), %g3
+	ldx		[%g3 + %g1], %g7
+	cmp		%sp, %g7
+	bleu,pt		%xcc, 2f
+	 sethi		%hi(THREAD_SIZE), %g3
+	add		%g7, %g3, %g7
+	cmp		%sp, %g7
+	blu,pn		%xcc, 1f
+	 nop
+#endif
+	/* If we are already on panic stack, don't hop onto it
+	 * again, we are already trying to output the stack overflow
+	 * message.
+	 */
 	sethi		%hi(ovstack), %g7		! cant move to panic stack fast enough
 	 or		%g7, %lo(ovstack), %g7
-	add		%g7, OVSTACKSIZE, %g7
+	add		%g7, OVSTACKSIZE, %g3
+	sub		%g3, STACK_BIAS - 192, %g3
 	sub		%g7, STACK_BIAS, %g7
+	cmp		%sp, %g7
+	blu,pn		%xcc, 2f
+	 cmp		%sp, %g3
+	bleu,pn		%xcc, 1f
+	 nop
+2:	mov		%g3, %sp
+	sethi		%hi(panicstring), %g3
 	mov		%g7, %sp
 	call		prom_printf
 	 or		%g3, %lo(panicstring), %o0

  reply	other threads:[~2008-08-12  8:22 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-18  0:47 Mikulas Patocka
2008-06-18  4:01 ` David Miller
2008-06-19  3:24   ` Mikulas Patocka
2008-06-19  3:59     ` David Miller
2008-06-19  5:17       ` Mikulas Patocka
2008-06-19  6:37         ` David Miller
2008-06-19 13:01           ` Mikulas Patocka
2008-06-20 15:47   ` Mikulas Patocka
2008-06-20 17:26     ` David Miller
2008-06-20 20:34       ` Mikulas Patocka
2008-06-20 20:37         ` David Miller
2008-06-20 21:26           ` Mikulas Patocka
2008-06-20 21:41             ` David Miller
2008-06-21  4:51               ` David Miller
2008-06-21 19:42                 ` Mikulas Patocka
2008-06-22  7:03                   ` David Miller
2008-06-22 13:48                     ` Mikulas Patocka
2008-08-12  6:30                   ` David Miller
2008-08-12  8:22                     ` David Miller [this message]
2008-08-13  0:53                       ` Mikulas Patocka
2008-08-13  0:59                         ` David Miller
2008-08-13  1:11                     ` console handover badness [was: stack overflow on Sparc64] Mikulas Patocka
2008-08-13  1:22                       ` console handover badness David Miller
2008-08-13  1:40                       ` David Miller
2008-08-13  8:50                         ` David Miller
2008-08-13 12:46                         ` Mikulas Patocka
2008-08-14  3:25                           ` David Miller
2008-08-14 23:11                             ` Bootmem allocator broken [was: console handover badness] Mikulas Patocka
2008-08-14 23:25                               ` Bootmem allocator broken David Miller
2008-08-15 11:09                                 ` Alexander Beregalov
2008-08-15 21:13                                   ` David Miller
2008-08-14 23:40                               ` Johannes Weiner
2008-06-20 21:14       ` stack overflow on Sparc64 Mikulas Patocka
2008-06-20 21:20         ` David Miller
2008-06-20 21:25           ` Mikulas Patocka
2008-06-20 21:44             ` David Miller
2008-06-20 21:47               ` David Miller
2008-06-20 22:22                 ` Mikulas Patocka
2008-06-20 22:28                   ` David Miller
2008-06-20 22:36                     ` Mikulas Patocka
2008-06-20 22:47                       ` David Miller
2008-06-21  0:37                         ` Mikulas Patocka
2008-06-20 22:33               ` Mikulas Patocka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080812.012201.164876122.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=sparclinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome