[patch 51/60] sparc64: Handle stack trace attempts beforeirqstacks are setup.

From: Greg KH
Date: Mon Aug 18 2008 - 15:10:21 EST


2.6.26-stable review patch. If anyone has any objections, please let us know.

------------------
From: David S. Miller <davem@xxxxxxxxxxxxx>

[ Upstream commit 6f63e781eaf6a741fc65f773017154b20ed4ce3b ]

Things like lockdep can try to do stack backtraces before
the irqstack blocks have been setup. So don't try to match
their ranges so early on.

Also, remove unused variable in save_stack_trace().

Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
arch/sparc64/kernel/kstack.h | 38 ++++++++++++++++++++------------------
arch/sparc64/kernel/stacktrace.c | 3 +--
2 files changed, 21 insertions(+), 20 deletions(-)

--- a/arch/sparc64/kernel/kstack.h
+++ b/arch/sparc64/kernel/kstack.h
@@ -15,15 +15,16 @@ static inline bool kstack_valid(struct t
sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf)))
return true;

- base = (unsigned long) hardirq_stack[tp->cpu];
- if (sp >= base &&
- sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf)))
- return true;
- base = (unsigned long) softirq_stack[tp->cpu];
- if (sp >= base &&
- sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf)))
- return true;
-
+ if (hardirq_stack[tp->cpu]) {
+ base = (unsigned long) hardirq_stack[tp->cpu];
+ if (sp >= base &&
+ sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf)))
+ return true;
+ base = (unsigned long) softirq_stack[tp->cpu];
+ if (sp >= base &&
+ sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf)))
+ return true;
+ }
return false;
}

@@ -37,15 +38,16 @@ static inline bool kstack_is_trap_frame(
addr <= (base + THREAD_SIZE - sizeof(*regs)))
goto check_magic;

- base = (unsigned long) hardirq_stack[tp->cpu];
- if (addr >= base &&
- addr <= (base + THREAD_SIZE - sizeof(*regs)))
- goto check_magic;
- base = (unsigned long) softirq_stack[tp->cpu];
- if (addr >= base &&
- addr <= (base + THREAD_SIZE - sizeof(*regs)))
- goto check_magic;
-
+ if (hardirq_stack[tp->cpu]) {
+ base = (unsigned long) hardirq_stack[tp->cpu];
+ if (addr >= base &&
+ addr <= (base + THREAD_SIZE - sizeof(*regs)))
+ goto check_magic;
+ base = (unsigned long) softirq_stack[tp->cpu];
+ if (addr >= base &&
+ addr <= (base + THREAD_SIZE - sizeof(*regs)))
+ goto check_magic;
+ }
return false;

check_magic:
--- a/arch/sparc64/kernel/stacktrace.c
+++ b/arch/sparc64/kernel/stacktrace.c
@@ -8,8 +8,8 @@

void save_stack_trace(struct stack_trace *trace)
{
- unsigned long ksp, fp, thread_base;
struct thread_info *tp = task_thread_info(current);
+ unsigned long ksp, fp;

stack_trace_flush();

@@ -19,7 +19,6 @@ void save_stack_trace(struct stack_trace
);

fp = ksp + STACK_BIAS;
- thread_base = (unsigned long) tp;
do {
struct sparc_stackf *sf;
struct pt_regs *regs;

--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/