Skip to content

Commit 63c9565

Browse files
rostedttorvalds
authored andcommitted
x86: Fix dumpstack_64 irq stack handling
Commit 2223f6f "x86: Clean up dumpstack_64.c code" changed the irq_stack processing a little from what it was before. The irq_stack_end variable needed to be cleared after its first use. By setting irq_stack to the per cpu irq_stack and passing that to analyze_stack(), and then clearing it after it is processed, we can get back the original behavior. Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 1aabc59 commit 63c9565

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

‎arch/x86/kernel/dumpstack_64.c‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ enum stack_type {
116116

117117
static enum stack_type
118118
analyze_stack(int cpu, struct task_struct *task, unsigned long *stack,
119-
unsigned long **stack_end, unsigned *used, char **id)
119+
unsigned long **stack_end, unsigned long *irq_stack,
120+
unsigned *used, char **id)
120121
{
121-
unsigned long *irq_stack;
122122
unsigned long addr;
123123

124124
addr = ((unsigned long)stack & (~(THREAD_SIZE - 1)));
@@ -130,11 +130,11 @@ analyze_stack(int cpu, struct task_struct *task, unsigned long *stack,
130130
if (*stack_end)
131131
return STACK_IS_EXCEPTION;
132132

133-
*stack_end = (unsigned long *)per_cpu(irq_stack_ptr, cpu);
134-
if (!*stack_end)
135-
return STACK_IS_UNKNOWN;
133+
if (!irq_stack)
134+
return STACK_IS_NORMAL;
136135

137-
irq_stack = *stack_end - irq_stack_size;
136+
*stack_end = irq_stack;
137+
irq_stack = irq_stack - irq_stack_size;
138138

139139
if (in_irq_stack(stack, irq_stack, *stack_end))
140140
return STACK_IS_IRQ;
@@ -155,7 +155,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
155155
{
156156
const unsigned cpu = get_cpu();
157157
struct thread_info *tinfo;
158-
unsigned long *irq_stack;
158+
unsigned long *irq_stack = (unsigned long *)per_cpu(irq_stack_ptr, cpu);
159159
unsigned long dummy;
160160
unsigned used = 0;
161161
int graph = 0;
@@ -186,7 +186,8 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
186186
enum stack_type stype;
187187
char *id;
188188

189-
stype = analyze_stack(cpu, task, stack, &stack_end, &used, &id);
189+
stype = analyze_stack(cpu, task, stack, &stack_end,
190+
irq_stack, &used, &id);
190191

191192
/* Default finish unless specified to continue */
192193
done = 1;
@@ -226,7 +227,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
226227
* pointer (index -1 to end) in the IRQ stack:
227228
*/
228229
stack = (unsigned long *) (stack_end[-1]);
229-
irq_stack = stack_end - irq_stack_size;
230+
irq_stack = NULL;
230231
ops->stack(data, "EOI");
231232
done = 0;
232233
break;

0 commit comments

Comments
 (0)