浏览代码

[PATCH] Avoid recursion in lockdep when stack tracer takes locks

The new dwarf2 unwinder needs to take locks to do backtraces
inside modules. This patch makes sure lockdep which calls
stacktrace is not reentered.

Thanks to Ingo for suggesting this simpler approach.

Cc: mingo@elte.hu
Signed-off-by: Andi Kleen <ak@suse.de>
Andi Kleen 18 年之前
父节点
当前提交
3fa7c794fe
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      kernel/lockdep.c

+ 4 - 0
kernel/lockdep.c

@@ -227,7 +227,11 @@ static int save_trace(struct stack_trace *trace)
 	trace->skip = 3;
 	trace->skip = 3;
 	trace->all_contexts = 0;
 	trace->all_contexts = 0;
 
 
+	/* Make sure to not recurse in case the the unwinder needs to tak
+e	   locks. */
+	lockdep_off();
 	save_stack_trace(trace, NULL);
 	save_stack_trace(trace, NULL);
+	lockdep_on();
 
 
 	trace->max_entries = trace->nr_entries;
 	trace->max_entries = trace->nr_entries;