提交 da68933e 编写于 作者: A Andrew Morton 提交者: Andi Kleen

[PATCH] x86-64: dump_trace() atomicity fix

Fix

BUG: using smp_processor_id() in preemptible [00000001] code:

in backtracer on preemptible debug kernels.

Cc: Andi Kleen <ak@suse.de>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NAndi Kleen <ak@suse.de>
上级 bb0d977e
...@@ -254,7 +254,7 @@ void dump_trace(struct task_struct *tsk, struct pt_regs *regs, ...@@ -254,7 +254,7 @@ void dump_trace(struct task_struct *tsk, struct pt_regs *regs,
unsigned long *stack, unsigned long *stack,
struct stacktrace_ops *ops, void *data) struct stacktrace_ops *ops, void *data)
{ {
const unsigned cpu = smp_processor_id(); const unsigned cpu = get_cpu();
unsigned long *irqstack_end = (unsigned long*)cpu_pda(cpu)->irqstackptr; unsigned long *irqstack_end = (unsigned long*)cpu_pda(cpu)->irqstackptr;
unsigned used = 0; unsigned used = 0;
struct thread_info *tinfo; struct thread_info *tinfo;
...@@ -286,11 +286,11 @@ void dump_trace(struct task_struct *tsk, struct pt_regs *regs, ...@@ -286,11 +286,11 @@ void dump_trace(struct task_struct *tsk, struct pt_regs *regs,
MSG("Leftover inexact backtrace:"); MSG("Leftover inexact backtrace:");
stack = (unsigned long *)UNW_SP(&info); stack = (unsigned long *)UNW_SP(&info);
if (!stack) if (!stack)
return; goto out;
} else } else
MSG("Full inexact backtrace again:"); MSG("Full inexact backtrace again:");
} else if (call_trace >= 1) } else if (call_trace >= 1)
return; goto out;
else else
MSG("Full inexact backtrace again:"); MSG("Full inexact backtrace again:");
} else } else
...@@ -385,6 +385,8 @@ void dump_trace(struct task_struct *tsk, struct pt_regs *regs, ...@@ -385,6 +385,8 @@ void dump_trace(struct task_struct *tsk, struct pt_regs *regs,
tinfo = current_thread_info(); tinfo = current_thread_info();
HANDLE_STACK (valid_stack_ptr(tinfo, stack)); HANDLE_STACK (valid_stack_ptr(tinfo, stack));
#undef HANDLE_STACK #undef HANDLE_STACK
out:
put_cpu();
} }
EXPORT_SYMBOL(dump_trace); EXPORT_SYMBOL(dump_trace);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册