aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/lockdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/lockdep.c')
-rw-r--r--kernel/lockdep.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 9bad17884513..e596525669ed 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -36,6 +36,7 @@
36#include <linux/stacktrace.h> 36#include <linux/stacktrace.h>
37#include <linux/debug_locks.h> 37#include <linux/debug_locks.h>
38#include <linux/irqflags.h> 38#include <linux/irqflags.h>
39#include <linux/utsname.h>
39 40
40#include <asm/sections.h> 41#include <asm/sections.h>
41 42
@@ -121,8 +122,8 @@ static struct list_head chainhash_table[CHAINHASH_SIZE];
121 * unique. 122 * unique.
122 */ 123 */
123#define iterate_chain_key(key1, key2) \ 124#define iterate_chain_key(key1, key2) \
124 (((key1) << MAX_LOCKDEP_KEYS_BITS/2) ^ \ 125 (((key1) << MAX_LOCKDEP_KEYS_BITS) ^ \
125 ((key1) >> (64-MAX_LOCKDEP_KEYS_BITS/2)) ^ \ 126 ((key1) >> (64-MAX_LOCKDEP_KEYS_BITS)) ^ \
126 (key2)) 127 (key2))
127 128
128void lockdep_off(void) 129void lockdep_off(void)
@@ -224,7 +225,14 @@ static int save_trace(struct stack_trace *trace)
224 trace->max_entries = MAX_STACK_TRACE_ENTRIES - nr_stack_trace_entries; 225 trace->max_entries = MAX_STACK_TRACE_ENTRIES - nr_stack_trace_entries;
225 trace->entries = stack_trace + nr_stack_trace_entries; 226 trace->entries = stack_trace + nr_stack_trace_entries;
226 227
227 save_stack_trace(trace, NULL, 0, 3); 228 trace->skip = 3;
229 trace->all_contexts = 0;
230
231 /* Make sure to not recurse in case the the unwinder needs to tak
232e locks. */
233 lockdep_off();
234 save_stack_trace(trace, NULL);
235 lockdep_on();
228 236
229 trace->max_entries = trace->nr_entries; 237 trace->max_entries = trace->nr_entries;
230 238
@@ -508,6 +516,13 @@ print_circular_bug_entry(struct lock_list *target, unsigned int depth)
508 return 0; 516 return 0;
509} 517}
510 518
519static void print_kernel_version(void)
520{
521 printk("%s %.*s\n", system_utsname.release,
522 (int)strcspn(system_utsname.version, " "),
523 system_utsname.version);
524}
525
511/* 526/*
512 * When a circular dependency is detected, print the 527 * When a circular dependency is detected, print the
513 * header first: 528 * header first:
@@ -524,6 +539,7 @@ print_circular_bug_header(struct lock_list *entry, unsigned int depth)
524 539
525 printk("\n=======================================================\n"); 540 printk("\n=======================================================\n");
526 printk( "[ INFO: possible circular locking dependency detected ]\n"); 541 printk( "[ INFO: possible circular locking dependency detected ]\n");
542 print_kernel_version();
527 printk( "-------------------------------------------------------\n"); 543 printk( "-------------------------------------------------------\n");
528 printk("%s/%d is trying to acquire lock:\n", 544 printk("%s/%d is trying to acquire lock:\n",
529 curr->comm, curr->pid); 545 curr->comm, curr->pid);
@@ -705,6 +721,7 @@ print_bad_irq_dependency(struct task_struct *curr,
705 printk("\n======================================================\n"); 721 printk("\n======================================================\n");
706 printk( "[ INFO: %s-safe -> %s-unsafe lock order detected ]\n", 722 printk( "[ INFO: %s-safe -> %s-unsafe lock order detected ]\n",
707 irqclass, irqclass); 723 irqclass, irqclass);
724 print_kernel_version();
708 printk( "------------------------------------------------------\n"); 725 printk( "------------------------------------------------------\n");
709 printk("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] is trying to acquire:\n", 726 printk("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] is trying to acquire:\n",
710 curr->comm, curr->pid, 727 curr->comm, curr->pid,
@@ -786,6 +803,7 @@ print_deadlock_bug(struct task_struct *curr, struct held_lock *prev,
786 803
787 printk("\n=============================================\n"); 804 printk("\n=============================================\n");
788 printk( "[ INFO: possible recursive locking detected ]\n"); 805 printk( "[ INFO: possible recursive locking detected ]\n");
806 print_kernel_version();
789 printk( "---------------------------------------------\n"); 807 printk( "---------------------------------------------\n");
790 printk("%s/%d is trying to acquire lock:\n", 808 printk("%s/%d is trying to acquire lock:\n",
791 curr->comm, curr->pid); 809 curr->comm, curr->pid);
@@ -1368,6 +1386,7 @@ print_irq_inversion_bug(struct task_struct *curr, struct lock_class *other,
1368 1386
1369 printk("\n=========================================================\n"); 1387 printk("\n=========================================================\n");
1370 printk( "[ INFO: possible irq lock inversion dependency detected ]\n"); 1388 printk( "[ INFO: possible irq lock inversion dependency detected ]\n");
1389 print_kernel_version();
1371 printk( "---------------------------------------------------------\n"); 1390 printk( "---------------------------------------------------------\n");
1372 printk("%s/%d just changed the state of lock:\n", 1391 printk("%s/%d just changed the state of lock:\n",
1373 curr->comm, curr->pid); 1392 curr->comm, curr->pid);
@@ -1462,6 +1481,7 @@ print_usage_bug(struct task_struct *curr, struct held_lock *this,
1462 1481
1463 printk("\n=================================\n"); 1482 printk("\n=================================\n");
1464 printk( "[ INFO: inconsistent lock state ]\n"); 1483 printk( "[ INFO: inconsistent lock state ]\n");
1484 print_kernel_version();
1465 printk( "---------------------------------\n"); 1485 printk( "---------------------------------\n");
1466 1486
1467 printk("inconsistent {%s} -> {%s} usage.\n", 1487 printk("inconsistent {%s} -> {%s} usage.\n",