Lines Matching +full:m +full:- +full:class

1 // SPDX-License-Identifier: GPL-2.0
34 #define iterate_lock_classes(idx, class) \ argument
35 for (idx = 0, class = lock_classes; idx <= max_lock_class_idx; \
36 idx++, class++)
38 static void *l_next(struct seq_file *m, void *v, loff_t *pos) in l_next() argument
40 struct lock_class *class = v; in l_next() local
42 ++class; in l_next()
43 *pos = class - lock_classes; in l_next()
44 return (*pos > max_lock_class_idx) ? NULL : class; in l_next()
47 static void *l_start(struct seq_file *m, loff_t *pos) in l_start() argument
56 static void l_stop(struct seq_file *m, void *v) in l_stop() argument
60 static void print_name(struct seq_file *m, struct lock_class *class) in print_name() argument
63 const char *name = class->name; in print_name()
66 name = __get_key_name(class->key, str); in print_name()
67 seq_printf(m, "%s", name); in print_name()
69 seq_printf(m, "%s", name); in print_name()
70 if (class->name_version > 1) in print_name()
71 seq_printf(m, "#%d", class->name_version); in print_name()
72 if (class->subclass) in print_name()
73 seq_printf(m, "/%d", class->subclass); in print_name()
77 static int l_show(struct seq_file *m, void *v) in l_show() argument
79 struct lock_class *class = v; in l_show() local
82 int idx = class - lock_classes; in l_show()
85 seq_printf(m, "all lock classes:\n"); in l_show()
90 seq_printf(m, "%p", class->key); in l_show()
92 seq_printf(m, " OPS:%8ld", debug_class_ops_read(class)); in l_show()
95 seq_printf(m, " FD:%5ld", lockdep_count_forward_deps(class)); in l_show()
96 seq_printf(m, " BD:%5ld", lockdep_count_backward_deps(class)); in l_show()
98 get_usage_chars(class, usage); in l_show()
99 seq_printf(m, " %s", usage); in l_show()
102 seq_printf(m, ": "); in l_show()
103 print_name(m, class); in l_show()
104 seq_puts(m, "\n"); in l_show()
107 list_for_each_entry(entry, &class->locks_after, entry) { in l_show()
108 if (entry->distance == 1) { in l_show()
109 seq_printf(m, " -> [%p] ", entry->class->key); in l_show()
110 print_name(m, entry->class); in l_show()
111 seq_puts(m, "\n"); in l_show()
114 seq_puts(m, "\n"); in l_show()
128 static void *lc_start(struct seq_file *m, loff_t *pos) in lc_start() argument
136 return lock_chains + (*pos - 1); in lc_start()
139 static void *lc_next(struct seq_file *m, void *v, loff_t *pos) in lc_next() argument
141 *pos = lockdep_next_lockchain(*pos - 1) + 1; in lc_next()
142 return lc_start(m, pos); in lc_next()
145 static void lc_stop(struct seq_file *m, void *v) in lc_stop() argument
149 static int lc_show(struct seq_file *m, void *v) in lc_show() argument
152 struct lock_class *class; in lc_show() local
164 seq_printf(m, "(buggered) "); in lc_show()
165 seq_printf(m, "all lock chains:\n"); in lc_show()
169 seq_printf(m, "irq_context: %s\n", irq_strs[chain->irq_context]); in lc_show()
171 for (i = 0; i < chain->depth; i++) { in lc_show()
172 class = lock_chain_get_class(chain, i); in lc_show()
173 if (!class->key) in lc_show()
176 seq_printf(m, "[%p] ", class->key); in lc_show()
177 print_name(m, class); in lc_show()
178 seq_puts(m, "\n"); in lc_show()
180 seq_puts(m, "\n"); in lc_show()
193 static void lockdep_stats_debug_show(struct seq_file *m) in lockdep_stats_debug_show() argument
205 seq_printf(m, " chain lookup misses: %11llu\n", in lockdep_stats_debug_show()
207 seq_printf(m, " chain lookup hits: %11llu\n", in lockdep_stats_debug_show()
209 seq_printf(m, " cyclic checks: %11llu\n", in lockdep_stats_debug_show()
211 seq_printf(m, " redundant checks: %11llu\n", in lockdep_stats_debug_show()
213 seq_printf(m, " redundant links: %11llu\n", in lockdep_stats_debug_show()
215 seq_printf(m, " find-mask forwards checks: %11llu\n", in lockdep_stats_debug_show()
217 seq_printf(m, " find-mask backwards checks: %11llu\n", in lockdep_stats_debug_show()
220 seq_printf(m, " hardirq on events: %11llu\n", hi1); in lockdep_stats_debug_show()
221 seq_printf(m, " hardirq off events: %11llu\n", hi2); in lockdep_stats_debug_show()
222 seq_printf(m, " redundant hardirq ons: %11llu\n", hr1); in lockdep_stats_debug_show()
223 seq_printf(m, " redundant hardirq offs: %11llu\n", hr2); in lockdep_stats_debug_show()
224 seq_printf(m, " softirq on events: %11llu\n", si1); in lockdep_stats_debug_show()
225 seq_printf(m, " softirq off events: %11llu\n", si2); in lockdep_stats_debug_show()
226 seq_printf(m, " redundant softirq ons: %11llu\n", sr1); in lockdep_stats_debug_show()
227 seq_printf(m, " redundant softirq offs: %11llu\n", sr2); in lockdep_stats_debug_show()
231 static int lockdep_stats_show(struct seq_file *m, void *v) in lockdep_stats_show() argument
243 struct lock_class *class; in lockdep_stats_show() local
246 iterate_lock_classes(idx, class) { in lockdep_stats_show()
250 if (class->usage_mask == 0) in lockdep_stats_show()
252 if (class->usage_mask == LOCKF_USED) in lockdep_stats_show()
254 if (class->usage_mask & LOCKF_USED_IN_IRQ) in lockdep_stats_show()
256 if (class->usage_mask & LOCKF_ENABLED_IRQ) in lockdep_stats_show()
258 if (class->usage_mask & LOCKF_USED_IN_SOFTIRQ) in lockdep_stats_show()
260 if (class->usage_mask & LOCKF_ENABLED_SOFTIRQ) in lockdep_stats_show()
262 if (class->usage_mask & LOCKF_USED_IN_HARDIRQ) in lockdep_stats_show()
264 if (class->usage_mask & LOCKF_ENABLED_HARDIRQ) in lockdep_stats_show()
266 if (class->usage_mask & LOCKF_USED_IN_IRQ_READ) in lockdep_stats_show()
268 if (class->usage_mask & LOCKF_ENABLED_IRQ_READ) in lockdep_stats_show()
270 if (class->usage_mask & LOCKF_USED_IN_SOFTIRQ_READ) in lockdep_stats_show()
272 if (class->usage_mask & LOCKF_ENABLED_SOFTIRQ_READ) in lockdep_stats_show()
274 if (class->usage_mask & LOCKF_USED_IN_HARDIRQ_READ) in lockdep_stats_show()
276 if (class->usage_mask & LOCKF_ENABLED_HARDIRQ_READ) in lockdep_stats_show()
279 sum_forward_deps += lockdep_count_forward_deps(class); in lockdep_stats_show()
287 seq_printf(m, " lock-classes: %11lu [max: %lu]\n", in lockdep_stats_show()
289 seq_printf(m, " direct dependencies: %11lu [max: %lu]\n", in lockdep_stats_show()
291 seq_printf(m, " indirect dependencies: %11lu\n", in lockdep_stats_show()
297 * All irq-safe locks may nest inside irq-unsafe locks, in lockdep_stats_show()
300 seq_printf(m, " all direct dependencies: %11lu\n", in lockdep_stats_show()
306 seq_printf(m, " dependency chains: %11lu [max: %lu]\n", in lockdep_stats_show()
308 seq_printf(m, " dependency chain hlocks used: %11lu [max: %lu]\n", in lockdep_stats_show()
309 MAX_LOCKDEP_CHAIN_HLOCKS - in lockdep_stats_show()
312 seq_printf(m, " dependency chain hlocks lost: %11u\n", in lockdep_stats_show()
317 seq_printf(m, " in-hardirq chains: %11u\n", in lockdep_stats_show()
319 seq_printf(m, " in-softirq chains: %11u\n", in lockdep_stats_show()
322 seq_printf(m, " in-process chains: %11u\n", in lockdep_stats_show()
324 seq_printf(m, " stack-trace entries: %11lu [max: %lu]\n", in lockdep_stats_show()
327 seq_printf(m, " number of stack traces: %11llu\n", in lockdep_stats_show()
329 seq_printf(m, " number of stack hash chains: %11llu\n", in lockdep_stats_show()
332 seq_printf(m, " combined max dependencies: %11u\n", in lockdep_stats_show()
337 seq_printf(m, " hardirq-safe locks: %11lu\n", in lockdep_stats_show()
339 seq_printf(m, " hardirq-unsafe locks: %11lu\n", in lockdep_stats_show()
341 seq_printf(m, " softirq-safe locks: %11lu\n", in lockdep_stats_show()
343 seq_printf(m, " softirq-unsafe locks: %11lu\n", in lockdep_stats_show()
345 seq_printf(m, " irq-safe locks: %11lu\n", in lockdep_stats_show()
347 seq_printf(m, " irq-unsafe locks: %11lu\n", in lockdep_stats_show()
350 seq_printf(m, " hardirq-read-safe locks: %11lu\n", in lockdep_stats_show()
352 seq_printf(m, " hardirq-read-unsafe locks: %11lu\n", in lockdep_stats_show()
354 seq_printf(m, " softirq-read-safe locks: %11lu\n", in lockdep_stats_show()
356 seq_printf(m, " softirq-read-unsafe locks: %11lu\n", in lockdep_stats_show()
358 seq_printf(m, " irq-read-safe locks: %11lu\n", in lockdep_stats_show()
360 seq_printf(m, " irq-read-unsafe locks: %11lu\n", in lockdep_stats_show()
363 seq_printf(m, " uncategorized locks: %11lu\n", in lockdep_stats_show()
365 seq_printf(m, " unused locks: %11lu\n", in lockdep_stats_show()
367 seq_printf(m, " max locking depth: %11u\n", in lockdep_stats_show()
370 seq_printf(m, " max bfs queue depth: %11u\n", in lockdep_stats_show()
373 seq_printf(m, " max lock class index: %11lu\n", in lockdep_stats_show()
375 lockdep_stats_debug_show(m); in lockdep_stats_show()
376 seq_printf(m, " debug_locks: %11u\n", in lockdep_stats_show()
382 seq_puts(m, "\n"); in lockdep_stats_show()
383 seq_printf(m, " zapped classes: %11lu\n", in lockdep_stats_show()
386 seq_printf(m, " zapped lock chains: %11lu\n", in lockdep_stats_show()
388 seq_printf(m, " large chain blocks: %11u\n", in lockdep_stats_show()
397 struct lock_class *class; member
414 nl = dl->stats.read_waittime.nr + dl->stats.write_waittime.nr; in lock_stat_cmp()
415 nr = dr->stats.read_waittime.nr + dr->stats.write_waittime.nr; in lock_stat_cmp()
417 return nr - nl; in lock_stat_cmp()
420 static void seq_line(struct seq_file *m, char c, int offset, int length) in seq_line() argument
425 seq_puts(m, " "); in seq_line()
427 seq_putc(m, c); in seq_line()
428 seq_puts(m, "\n"); in seq_line()
441 static void seq_time(struct seq_file *m, s64 time) in seq_time() argument
446 seq_printf(m, " %14s", num); in seq_time()
449 static void seq_lock_time(struct seq_file *m, struct lock_time *lt) in seq_lock_time() argument
451 seq_printf(m, "%14lu", lt->nr); in seq_lock_time()
452 seq_time(m, lt->min); in seq_lock_time()
453 seq_time(m, lt->max); in seq_lock_time()
454 seq_time(m, lt->total); in seq_lock_time()
455 seq_time(m, lt->nr ? div64_u64(lt->total, lt->nr) : 0); in seq_lock_time()
458 static void seq_stats(struct seq_file *m, struct lock_stat_data *data) in seq_stats() argument
462 struct lock_class *class; in seq_stats() local
467 class = data->class; in seq_stats()
468 stats = &data->stats; in seq_stats()
471 if (class->name_version > 1) in seq_stats()
472 namelen -= 2; /* XXX truncates versions > 9 */ in seq_stats()
473 if (class->subclass) in seq_stats()
474 namelen -= 2; in seq_stats()
477 cname = rcu_dereference_sched(class->name); in seq_stats()
478 ckey = rcu_dereference_sched(class->key); in seq_stats()
496 if (class->name_version > 1) { in seq_stats()
497 snprintf(name+namelen, 3, "#%d", class->name_version); in seq_stats()
500 if (class->subclass) { in seq_stats()
501 snprintf(name+namelen, 3, "/%d", class->subclass); in seq_stats()
505 if (stats->write_holdtime.nr) { in seq_stats()
506 if (stats->read_holdtime.nr) in seq_stats()
507 seq_printf(m, "%38s-W:", name); in seq_stats()
509 seq_printf(m, "%40s:", name); in seq_stats()
511 seq_printf(m, "%14lu ", stats->bounces[bounce_contended_write]); in seq_stats()
512 seq_lock_time(m, &stats->write_waittime); in seq_stats()
513 seq_printf(m, " %14lu ", stats->bounces[bounce_acquired_write]); in seq_stats()
514 seq_lock_time(m, &stats->write_holdtime); in seq_stats()
515 seq_puts(m, "\n"); in seq_stats()
518 if (stats->read_holdtime.nr) { in seq_stats()
519 seq_printf(m, "%38s-R:", name); in seq_stats()
520 seq_printf(m, "%14lu ", stats->bounces[bounce_contended_read]); in seq_stats()
521 seq_lock_time(m, &stats->read_waittime); in seq_stats()
522 seq_printf(m, " %14lu ", stats->bounces[bounce_acquired_read]); in seq_stats()
523 seq_lock_time(m, &stats->read_holdtime); in seq_stats()
524 seq_puts(m, "\n"); in seq_stats()
527 if (stats->read_waittime.nr + stats->write_waittime.nr == 0) in seq_stats()
530 if (stats->read_holdtime.nr) in seq_stats()
536 if (class->contention_point[i] == 0) in seq_stats()
540 seq_line(m, '-', 40-namelen, namelen); in seq_stats()
543 (void *)class->contention_point[i]); in seq_stats()
544 seq_printf(m, "%40s %14lu %29s %pS\n", in seq_stats()
545 name, stats->contention_point[i], in seq_stats()
546 ip, (void *)class->contention_point[i]); in seq_stats()
551 if (class->contending_point[i] == 0) in seq_stats()
555 seq_line(m, '-', 40-namelen, namelen); in seq_stats()
558 (void *)class->contending_point[i]); in seq_stats()
559 seq_printf(m, "%40s %14lu %29s %pS\n", in seq_stats()
560 name, stats->contending_point[i], in seq_stats()
561 ip, (void *)class->contending_point[i]); in seq_stats()
564 seq_puts(m, "\n"); in seq_stats()
565 seq_line(m, '.', 0, 40 + 1 + 12 * (14 + 1)); in seq_stats()
566 seq_puts(m, "\n"); in seq_stats()
570 static void seq_header(struct seq_file *m) in seq_header() argument
572 seq_puts(m, "lock_stat version 0.4\n"); in seq_header()
575 seq_printf(m, "*WARNING* lock debugging disabled!! - possibly due to a lockdep warning\n"); in seq_header()
577 seq_line(m, '-', 0, 40 + 1 + 12 * (14 + 1)); in seq_header()
578 seq_printf(m, "%40s %14s %14s %14s %14s %14s %14s %14s %14s %14s %14s " in seq_header()
580 "class name", in seq_header()
581 "con-bounces", in seq_header()
583 "waittime-min", in seq_header()
584 "waittime-max", in seq_header()
585 "waittime-total", in seq_header()
586 "waittime-avg", in seq_header()
587 "acq-bounces", in seq_header()
589 "holdtime-min", in seq_header()
590 "holdtime-max", in seq_header()
591 "holdtime-total", in seq_header()
592 "holdtime-avg"); in seq_header()
593 seq_line(m, '-', 0, 40 + 1 + 12 * (14 + 1)); in seq_header()
594 seq_printf(m, "\n"); in seq_header()
597 static void *ls_start(struct seq_file *m, loff_t *pos) in ls_start() argument
599 struct lock_stat_seq *data = m->private; in ls_start()
605 iter = data->stats + (*pos - 1); in ls_start()
606 if (iter >= data->iter_end) in ls_start()
612 static void *ls_next(struct seq_file *m, void *v, loff_t *pos) in ls_next() argument
615 return ls_start(m, pos); in ls_next()
618 static void ls_stop(struct seq_file *m, void *v) in ls_stop() argument
622 static int ls_show(struct seq_file *m, void *v) in ls_show() argument
625 seq_header(m); in ls_show()
627 seq_stats(m, v); in ls_show()
642 struct lock_class *class; in lock_stat_open() local
646 return -ENOMEM; in lock_stat_open()
650 struct lock_stat_data *iter = data->stats; in lock_stat_open()
651 struct seq_file *m = file->private_data; in lock_stat_open() local
654 iterate_lock_classes(idx, class) { in lock_stat_open()
657 iter->class = class; in lock_stat_open()
658 iter->stats = lock_stats(class); in lock_stat_open()
662 data->iter_end = iter; in lock_stat_open()
664 sort(data->stats, data->iter_end - data->stats, in lock_stat_open()
668 m->private = data; in lock_stat_open()
678 struct lock_class *class; in lock_stat_write() local
684 return -EFAULT; in lock_stat_write()
689 iterate_lock_classes(idx, class) { in lock_stat_write()
692 clear_lock_stats(class); in lock_stat_write()
700 struct seq_file *seq = file->private_data; in lock_stat_release()
702 vfree(seq->private); in lock_stat_release()