mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Johannes Weiner <jw@emlix.com>
To: Chris Zankel <chris@zankel.net>
Cc: linux-kernel@vger.kernel.org
Subject: [patch 4/7] xtensa: use correct stack pointer for stack traces
Date: Mon, 02 Mar 2009 17:43:01 +0100	[thread overview]
Message-ID: <E1LeBSa-0003Z1-Vb@mailer.emlix.com> (raw)
In-Reply-To: <20090302164257.477296438@emlix.com>

[-- Attachment #1: xtensa-use-correct-stack-for-backtrace.patch --]
[-- Type: text/plain, Size: 1274 bytes --]

Right now, the xtensa stacktrace code reads the _current_ kernel stack
pointer if nothing is supplied.  With debugging facilities like sysrq
this means that the backtrace of the sysrq-handler is printed instead
of a trace of the given task's stack.

When no stack pointer is specified in show_trace() and show_stack(),
use the stack pointer that comes with the handed in task descriptor to
make stack traces more useful.

Signed-off-by: Johannes Weiner <jw@emlix.com>
---
 arch/xtensa/kernel/traps.c |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

--- a/arch/xtensa/kernel/traps.c
+++ b/arch/xtensa/kernel/traps.c
@@ -372,11 +372,10 @@ void show_trace(struct task_struct *task
 	unsigned long a0, a1, pc;
 	unsigned long sp_start, sp_end;
 
-	a1 = (unsigned long)sp;
-
-	if (a1 == 0)
-		__asm__ __volatile__ ("mov %0, a1\n" : "=a"(a1));
-
+	if (sp)
+		a1 = (unsigned long)sp;
+	else
+		a1 = task->thread.sp;
 
 	sp_start = a1 & ~(THREAD_SIZE-1);
 	sp_end = sp_start + THREAD_SIZE;
@@ -418,9 +417,8 @@ void show_stack(struct task_struct *task
 	int i = 0;
 	unsigned long *stack;
 
-	if (sp == 0)
-		__asm__ __volatile__ ("mov %0, a1\n" : "=a"(sp));
-
+	if (!sp)
+		sp = (unsigned long *)task->thread.sp;
  	stack = sp;
 
 	printk("\nStack: ");

-- 


  parent reply	other threads:[~2009-03-02 16:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090302164257.477296438@emlix.com>
2009-03-02 16:42 ` [patch 1/7] xtensa: kernel/traps.c: include hardirq.h Johannes Weiner
2009-03-11 13:36   ` Johannes Weiner
2009-03-02 16:42 ` [patch 2/7] xtensa: remove redefinition of XCHAL_MMU_ASID_BITS Johannes Weiner
2009-03-02 16:43 ` [patch 3/7] xtensa: beat Kconfig into shape Johannes Weiner
2009-03-02 16:43 ` Johannes Weiner [this message]
2009-03-02 16:43 ` [patch 5/7] xtensa: fix init_bootmem_node() argument order Johannes Weiner
2009-03-02 16:43 ` [patch 6/7] xtensa: dont make bootmem bitmap larger than required Johannes Weiner
2009-03-02 16:43 ` [patch 7/7] xtensa: cope with ram beginning at higher addresses Johannes Weiner

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=E1LeBSa-0003Z1-Vb@mailer.emlix.com \
    --to=jw@emlix.com \
    --cc=chris@zankel.net \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®