aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/lockdep_proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/lockdep_proc.c')
-rw-r--r--kernel/lockdep_proc.c91
1 files changed, 91 insertions, 0 deletions
diff --git a/kernel/lockdep_proc.c b/kernel/lockdep_proc.c
index 688c5f1940bd..14d052c8a835 100644
--- a/kernel/lockdep_proc.c
+++ b/kernel/lockdep_proc.c
@@ -178,6 +178,93 @@ static const struct file_operations proc_lockdep_operations = {
178 .release = seq_release, 178 .release = seq_release,
179}; 179};
180 180
181static void *lc_next(struct seq_file *m, void *v, loff_t *pos)
182{
183 struct lock_chain *chain;
184
185 (*pos)++;
186
187 if (v == SEQ_START_TOKEN)
188 chain = m->private;
189 else {
190 chain = v;
191
192 if (*pos < nr_lock_chains)
193 chain = lock_chains + *pos;
194 else
195 chain = NULL;
196 }
197
198 return chain;
199}
200
201static void *lc_start(struct seq_file *m, loff_t *pos)
202{
203 if (*pos == 0)
204 return SEQ_START_TOKEN;
205
206 if (*pos < nr_lock_chains)
207 return lock_chains + *pos;
208
209 return NULL;
210}
211
212static void lc_stop(struct seq_file *m, void *v)
213{
214}
215
216static int lc_show(struct seq_file *m, void *v)
217{
218 struct lock_chain *chain = v;
219 struct lock_class *class;
220 int i;
221
222 if (v == SEQ_START_TOKEN) {
223 seq_printf(m, "all lock chains:\n");
224 return 0;
225 }
226
227 seq_printf(m, "irq_context: %d\n", chain->irq_context);
228
229 for (i = 0; i < chain->depth; i++) {
230 class = lock_chain_get_class(chain, i);
231 seq_printf(m, "[%p] ", class->key);
232 print_name(m, class);
233 seq_puts(m, "\n");
234 }
235 seq_puts(m, "\n");
236
237 return 0;
238}
239
240static const struct seq_operations lockdep_chains_ops = {
241 .start = lc_start,
242 .next = lc_next,
243 .stop = lc_stop,
244 .show = lc_show,
245};
246
247static int lockdep_chains_open(struct inode *inode, struct file *file)
248{
249 int res = seq_open(file, &lockdep_chains_ops);
250 if (!res) {
251 struct seq_file *m = file->private_data;
252
253 if (nr_lock_chains)
254 m->private = lock_chains;
255 else
256 m->private = NULL;
257 }
258 return res;
259}
260
261static const struct file_operations proc_lockdep_chains_operations = {
262 .open = lockdep_chains_open,
263 .read = seq_read,
264 .llseek = seq_lseek,
265 .release = seq_release,
266};
267
181static void lockdep_stats_debug_show(struct seq_file *m) 268static void lockdep_stats_debug_show(struct seq_file *m)
182{ 269{
183#ifdef CONFIG_DEBUG_LOCKDEP 270#ifdef CONFIG_DEBUG_LOCKDEP
@@ -294,6 +381,8 @@ static int lockdep_stats_show(struct seq_file *m, void *v)
294#ifdef CONFIG_PROVE_LOCKING 381#ifdef CONFIG_PROVE_LOCKING
295 seq_printf(m, " dependency chains: %11lu [max: %lu]\n", 382 seq_printf(m, " dependency chains: %11lu [max: %lu]\n",
296 nr_lock_chains, MAX_LOCKDEP_CHAINS); 383 nr_lock_chains, MAX_LOCKDEP_CHAINS);
384 seq_printf(m, " dependency chain hlocks: %11d [max: %lu]\n",
385 atomic_read(&nr_chain_hlocks), MAX_LOCKDEP_CHAIN_HLOCKS);
297#endif 386#endif
298 387
299#ifdef CONFIG_TRACE_IRQFLAGS 388#ifdef CONFIG_TRACE_IRQFLAGS
@@ -661,6 +750,8 @@ static const struct file_operations proc_lock_stat_operations = {
661static int __init lockdep_proc_init(void) 750static int __init lockdep_proc_init(void)
662{ 751{
663 proc_create("lockdep", S_IRUSR, NULL, &proc_lockdep_operations); 752 proc_create("lockdep", S_IRUSR, NULL, &proc_lockdep_operations);
753 proc_create("lockdep_chains", S_IRUSR, NULL,
754 &proc_lockdep_chains_operations);
664 proc_create("lockdep_stats", S_IRUSR, NULL, 755 proc_create("lockdep_stats", S_IRUSR, NULL,
665 &proc_lockdep_stats_operations); 756 &proc_lockdep_stats_operations);
666 757