aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/lockdep_proc.c
diff options
context:
space:
mode:
authorJason Baron <jbaron@redhat.com>2007-02-10 04:44:59 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 13:51:26 -0500
commit068135e63518314d4efd711142f674ad0841599e (patch)
treedbf8193b0e8f3b6c0e735b48c1f8201a6df207ac /kernel/lockdep_proc.c
parent381a229209aa6f7f72375797b7bcfcfe2ae6fcbb (diff)
[PATCH] lockdep: add graph depth information to /proc/lockdep
Generate locking graph information into /proc/lockdep, for lock hierarchy documentation and visualization purposes. sample output: c089fd5c OPS: 138 FD: 14 BD: 1 --..: &tty->termios_mutex -> [c07a3430] tty_ldisc_lock -> [c07a37f0] &port_lock_key -> [c07afdc0] &rq->rq_lock_key#2 The lock classes listed are all the first-hop lock dependencies that lockdep has seen so far. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/lockdep_proc.c')
-rw-r--r--kernel/lockdep_proc.c41
1 files changed, 29 insertions, 12 deletions
diff --git a/kernel/lockdep_proc.c b/kernel/lockdep_proc.c
index b554b40a4aa6..57a547a2da3f 100644
--- a/kernel/lockdep_proc.c
+++ b/kernel/lockdep_proc.c
@@ -77,12 +77,29 @@ static unsigned long count_backward_deps(struct lock_class *class)
77 return ret; 77 return ret;
78} 78}
79 79
80static void print_name(struct seq_file *m, struct lock_class *class)
81{
82 char str[128];
83 const char *name = class->name;
84
85 if (!name) {
86 name = __get_key_name(class->key, str);
87 seq_printf(m, "%s", name);
88 } else{
89 seq_printf(m, "%s", name);
90 if (class->name_version > 1)
91 seq_printf(m, "#%d", class->name_version);
92 if (class->subclass)
93 seq_printf(m, "/%d", class->subclass);
94 }
95}
96
80static int l_show(struct seq_file *m, void *v) 97static int l_show(struct seq_file *m, void *v)
81{ 98{
82 unsigned long nr_forward_deps, nr_backward_deps; 99 unsigned long nr_forward_deps, nr_backward_deps;
83 struct lock_class *class = m->private; 100 struct lock_class *class = m->private;
84 char str[128], c1, c2, c3, c4; 101 struct lock_list *entry;
85 const char *name; 102 char c1, c2, c3, c4;
86 103
87 seq_printf(m, "%p", class->key); 104 seq_printf(m, "%p", class->key);
88#ifdef CONFIG_DEBUG_LOCKDEP 105#ifdef CONFIG_DEBUG_LOCKDEP
@@ -97,16 +114,16 @@ static int l_show(struct seq_file *m, void *v)
97 get_usage_chars(class, &c1, &c2, &c3, &c4); 114 get_usage_chars(class, &c1, &c2, &c3, &c4);
98 seq_printf(m, " %c%c%c%c", c1, c2, c3, c4); 115 seq_printf(m, " %c%c%c%c", c1, c2, c3, c4);
99 116
100 name = class->name; 117 seq_printf(m, ": ");
101 if (!name) { 118 print_name(m, class);
102 name = __get_key_name(class->key, str); 119 seq_puts(m, "\n");
103 seq_printf(m, ": %s", name); 120
104 } else{ 121 list_for_each_entry(entry, &class->locks_after, entry) {
105 seq_printf(m, ": %s", name); 122 if (entry->distance == 1) {
106 if (class->name_version > 1) 123 seq_printf(m, " -> [%p] ", entry->class);
107 seq_printf(m, "#%d", class->name_version); 124 print_name(m, entry->class);
108 if (class->subclass) 125 seq_puts(m, "\n");
109 seq_printf(m, "/%d", class->subclass); 126 }
110 } 127 }
111 seq_puts(m, "\n"); 128 seq_puts(m, "\n");
112 129