lockdep_proc.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. /*
  2. * kernel/lockdep_proc.c
  3. *
  4. * Runtime locking correctness validator
  5. *
  6. * Started by Ingo Molnar:
  7. *
  8. * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
  9. * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com>
  10. *
  11. * Code for /proc/lockdep and /proc/lockdep_stats:
  12. *
  13. */
  14. #include <linux/module.h>
  15. #include <linux/proc_fs.h>
  16. #include <linux/seq_file.h>
  17. #include <linux/kallsyms.h>
  18. #include <linux/debug_locks.h>
  19. #include <linux/vmalloc.h>
  20. #include <linux/sort.h>
  21. #include <asm/uaccess.h>
  22. #include <asm/div64.h>
  23. #include "lockdep_internals.h"
  24. static void *l_next(struct seq_file *m, void *v, loff_t *pos)
  25. {
  26. struct lock_class *class = v;
  27. (*pos)++;
  28. if (class->lock_entry.next != &all_lock_classes)
  29. class = list_entry(class->lock_entry.next, struct lock_class,
  30. lock_entry);
  31. else
  32. class = NULL;
  33. m->private = class;
  34. return class;
  35. }
  36. static void *l_start(struct seq_file *m, loff_t *pos)
  37. {
  38. struct lock_class *class = m->private;
  39. if (&class->lock_entry == all_lock_classes.next)
  40. seq_printf(m, "all lock classes:\n");
  41. return class;
  42. }
  43. static void l_stop(struct seq_file *m, void *v)
  44. {
  45. }
  46. static unsigned long count_forward_deps(struct lock_class *class)
  47. {
  48. struct lock_list *entry;
  49. unsigned long ret = 1;
  50. /*
  51. * Recurse this class's dependency list:
  52. */
  53. list_for_each_entry(entry, &class->locks_after, entry)
  54. ret += count_forward_deps(entry->class);
  55. return ret;
  56. }
  57. static unsigned long count_backward_deps(struct lock_class *class)
  58. {
  59. struct lock_list *entry;
  60. unsigned long ret = 1;
  61. /*
  62. * Recurse this class's dependency list:
  63. */
  64. list_for_each_entry(entry, &class->locks_before, entry)
  65. ret += count_backward_deps(entry->class);
  66. return ret;
  67. }
  68. static void print_name(struct seq_file *m, struct lock_class *class)
  69. {
  70. char str[128];
  71. const char *name = class->name;
  72. if (!name) {
  73. name = __get_key_name(class->key, str);
  74. seq_printf(m, "%s", name);
  75. } else{
  76. seq_printf(m, "%s", name);
  77. if (class->name_version > 1)
  78. seq_printf(m, "#%d", class->name_version);
  79. if (class->subclass)
  80. seq_printf(m, "/%d", class->subclass);
  81. }
  82. }
  83. static int l_show(struct seq_file *m, void *v)
  84. {
  85. unsigned long nr_forward_deps, nr_backward_deps;
  86. struct lock_class *class = m->private;
  87. struct lock_list *entry;
  88. char c1, c2, c3, c4;
  89. seq_printf(m, "%p", class->key);
  90. #ifdef CONFIG_DEBUG_LOCKDEP
  91. seq_printf(m, " OPS:%8ld", class->ops);
  92. #endif
  93. nr_forward_deps = count_forward_deps(class);
  94. seq_printf(m, " FD:%5ld", nr_forward_deps);
  95. nr_backward_deps = count_backward_deps(class);
  96. seq_printf(m, " BD:%5ld", nr_backward_deps);
  97. get_usage_chars(class, &c1, &c2, &c3, &c4);
  98. seq_printf(m, " %c%c%c%c", c1, c2, c3, c4);
  99. seq_printf(m, ": ");
  100. print_name(m, class);
  101. seq_puts(m, "\n");
  102. list_for_each_entry(entry, &class->locks_after, entry) {
  103. if (entry->distance == 1) {
  104. seq_printf(m, " -> [%p] ", entry->class);
  105. print_name(m, entry->class);
  106. seq_puts(m, "\n");
  107. }
  108. }
  109. seq_puts(m, "\n");
  110. return 0;
  111. }
  112. static const struct seq_operations lockdep_ops = {
  113. .start = l_start,
  114. .next = l_next,
  115. .stop = l_stop,
  116. .show = l_show,
  117. };
  118. static int lockdep_open(struct inode *inode, struct file *file)
  119. {
  120. int res = seq_open(file, &lockdep_ops);
  121. if (!res) {
  122. struct seq_file *m = file->private_data;
  123. if (!list_empty(&all_lock_classes))
  124. m->private = list_entry(all_lock_classes.next,
  125. struct lock_class, lock_entry);
  126. else
  127. m->private = NULL;
  128. }
  129. return res;
  130. }
  131. static const struct file_operations proc_lockdep_operations = {
  132. .open = lockdep_open,
  133. .read = seq_read,
  134. .llseek = seq_lseek,
  135. .release = seq_release,
  136. };
  137. static void lockdep_stats_debug_show(struct seq_file *m)
  138. {
  139. #ifdef CONFIG_DEBUG_LOCKDEP
  140. unsigned int hi1 = debug_atomic_read(&hardirqs_on_events),
  141. hi2 = debug_atomic_read(&hardirqs_off_events),
  142. hr1 = debug_atomic_read(&redundant_hardirqs_on),
  143. hr2 = debug_atomic_read(&redundant_hardirqs_off),
  144. si1 = debug_atomic_read(&softirqs_on_events),
  145. si2 = debug_atomic_read(&softirqs_off_events),
  146. sr1 = debug_atomic_read(&redundant_softirqs_on),
  147. sr2 = debug_atomic_read(&redundant_softirqs_off);
  148. seq_printf(m, " chain lookup misses: %11u\n",
  149. debug_atomic_read(&chain_lookup_misses));
  150. seq_printf(m, " chain lookup hits: %11u\n",
  151. debug_atomic_read(&chain_lookup_hits));
  152. seq_printf(m, " cyclic checks: %11u\n",
  153. debug_atomic_read(&nr_cyclic_checks));
  154. seq_printf(m, " cyclic-check recursions: %11u\n",
  155. debug_atomic_read(&nr_cyclic_check_recursions));
  156. seq_printf(m, " find-mask forwards checks: %11u\n",
  157. debug_atomic_read(&nr_find_usage_forwards_checks));
  158. seq_printf(m, " find-mask forwards recursions: %11u\n",
  159. debug_atomic_read(&nr_find_usage_forwards_recursions));
  160. seq_printf(m, " find-mask backwards checks: %11u\n",
  161. debug_atomic_read(&nr_find_usage_backwards_checks));
  162. seq_printf(m, " find-mask backwards recursions:%11u\n",
  163. debug_atomic_read(&nr_find_usage_backwards_recursions));
  164. seq_printf(m, " hardirq on events: %11u\n", hi1);
  165. seq_printf(m, " hardirq off events: %11u\n", hi2);
  166. seq_printf(m, " redundant hardirq ons: %11u\n", hr1);
  167. seq_printf(m, " redundant hardirq offs: %11u\n", hr2);
  168. seq_printf(m, " softirq on events: %11u\n", si1);
  169. seq_printf(m, " softirq off events: %11u\n", si2);
  170. seq_printf(m, " redundant softirq ons: %11u\n", sr1);
  171. seq_printf(m, " redundant softirq offs: %11u\n", sr2);
  172. #endif
  173. }
  174. static int lockdep_stats_show(struct seq_file *m, void *v)
  175. {
  176. struct lock_class *class;
  177. unsigned long nr_unused = 0, nr_uncategorized = 0,
  178. nr_irq_safe = 0, nr_irq_unsafe = 0,
  179. nr_softirq_safe = 0, nr_softirq_unsafe = 0,
  180. nr_hardirq_safe = 0, nr_hardirq_unsafe = 0,
  181. nr_irq_read_safe = 0, nr_irq_read_unsafe = 0,
  182. nr_softirq_read_safe = 0, nr_softirq_read_unsafe = 0,
  183. nr_hardirq_read_safe = 0, nr_hardirq_read_unsafe = 0,
  184. sum_forward_deps = 0, factor = 0;
  185. list_for_each_entry(class, &all_lock_classes, lock_entry) {
  186. if (class->usage_mask == 0)
  187. nr_unused++;
  188. if (class->usage_mask == LOCKF_USED)
  189. nr_uncategorized++;
  190. if (class->usage_mask & LOCKF_USED_IN_IRQ)
  191. nr_irq_safe++;
  192. if (class->usage_mask & LOCKF_ENABLED_IRQS)
  193. nr_irq_unsafe++;
  194. if (class->usage_mask & LOCKF_USED_IN_SOFTIRQ)
  195. nr_softirq_safe++;
  196. if (class->usage_mask & LOCKF_ENABLED_SOFTIRQS)
  197. nr_softirq_unsafe++;
  198. if (class->usage_mask & LOCKF_USED_IN_HARDIRQ)
  199. nr_hardirq_safe++;
  200. if (class->usage_mask & LOCKF_ENABLED_HARDIRQS)
  201. nr_hardirq_unsafe++;
  202. if (class->usage_mask & LOCKF_USED_IN_IRQ_READ)
  203. nr_irq_read_safe++;
  204. if (class->usage_mask & LOCKF_ENABLED_IRQS_READ)
  205. nr_irq_read_unsafe++;
  206. if (class->usage_mask & LOCKF_USED_IN_SOFTIRQ_READ)
  207. nr_softirq_read_safe++;
  208. if (class->usage_mask & LOCKF_ENABLED_SOFTIRQS_READ)
  209. nr_softirq_read_unsafe++;
  210. if (class->usage_mask & LOCKF_USED_IN_HARDIRQ_READ)
  211. nr_hardirq_read_safe++;
  212. if (class->usage_mask & LOCKF_ENABLED_HARDIRQS_READ)
  213. nr_hardirq_read_unsafe++;
  214. sum_forward_deps += count_forward_deps(class);
  215. }
  216. #ifdef CONFIG_DEBUG_LOCKDEP
  217. DEBUG_LOCKS_WARN_ON(debug_atomic_read(&nr_unused_locks) != nr_unused);
  218. #endif
  219. seq_printf(m, " lock-classes: %11lu [max: %lu]\n",
  220. nr_lock_classes, MAX_LOCKDEP_KEYS);
  221. seq_printf(m, " direct dependencies: %11lu [max: %lu]\n",
  222. nr_list_entries, MAX_LOCKDEP_ENTRIES);
  223. seq_printf(m, " indirect dependencies: %11lu\n",
  224. sum_forward_deps);
  225. /*
  226. * Total number of dependencies:
  227. *
  228. * All irq-safe locks may nest inside irq-unsafe locks,
  229. * plus all the other known dependencies:
  230. */
  231. seq_printf(m, " all direct dependencies: %11lu\n",
  232. nr_irq_unsafe * nr_irq_safe +
  233. nr_hardirq_unsafe * nr_hardirq_safe +
  234. nr_list_entries);
  235. /*
  236. * Estimated factor between direct and indirect
  237. * dependencies:
  238. */
  239. if (nr_list_entries)
  240. factor = sum_forward_deps / nr_list_entries;
  241. #ifdef CONFIG_PROVE_LOCKING
  242. seq_printf(m, " dependency chains: %11lu [max: %lu]\n",
  243. nr_lock_chains, MAX_LOCKDEP_CHAINS);
  244. #endif
  245. #ifdef CONFIG_TRACE_IRQFLAGS
  246. seq_printf(m, " in-hardirq chains: %11u\n",
  247. nr_hardirq_chains);
  248. seq_printf(m, " in-softirq chains: %11u\n",
  249. nr_softirq_chains);
  250. #endif
  251. seq_printf(m, " in-process chains: %11u\n",
  252. nr_process_chains);
  253. seq_printf(m, " stack-trace entries: %11lu [max: %lu]\n",
  254. nr_stack_trace_entries, MAX_STACK_TRACE_ENTRIES);
  255. seq_printf(m, " combined max dependencies: %11u\n",
  256. (nr_hardirq_chains + 1) *
  257. (nr_softirq_chains + 1) *
  258. (nr_process_chains + 1)
  259. );
  260. seq_printf(m, " hardirq-safe locks: %11lu\n",
  261. nr_hardirq_safe);
  262. seq_printf(m, " hardirq-unsafe locks: %11lu\n",
  263. nr_hardirq_unsafe);
  264. seq_printf(m, " softirq-safe locks: %11lu\n",
  265. nr_softirq_safe);
  266. seq_printf(m, " softirq-unsafe locks: %11lu\n",
  267. nr_softirq_unsafe);
  268. seq_printf(m, " irq-safe locks: %11lu\n",
  269. nr_irq_safe);
  270. seq_printf(m, " irq-unsafe locks: %11lu\n",
  271. nr_irq_unsafe);
  272. seq_printf(m, " hardirq-read-safe locks: %11lu\n",
  273. nr_hardirq_read_safe);
  274. seq_printf(m, " hardirq-read-unsafe locks: %11lu\n",
  275. nr_hardirq_read_unsafe);
  276. seq_printf(m, " softirq-read-safe locks: %11lu\n",
  277. nr_softirq_read_safe);
  278. seq_printf(m, " softirq-read-unsafe locks: %11lu\n",
  279. nr_softirq_read_unsafe);
  280. seq_printf(m, " irq-read-safe locks: %11lu\n",
  281. nr_irq_read_safe);
  282. seq_printf(m, " irq-read-unsafe locks: %11lu\n",
  283. nr_irq_read_unsafe);
  284. seq_printf(m, " uncategorized locks: %11lu\n",
  285. nr_uncategorized);
  286. seq_printf(m, " unused locks: %11lu\n",
  287. nr_unused);
  288. seq_printf(m, " max locking depth: %11u\n",
  289. max_lockdep_depth);
  290. seq_printf(m, " max recursion depth: %11u\n",
  291. max_recursion_depth);
  292. lockdep_stats_debug_show(m);
  293. seq_printf(m, " debug_locks: %11u\n",
  294. debug_locks);
  295. return 0;
  296. }
  297. static int lockdep_stats_open(struct inode *inode, struct file *file)
  298. {
  299. return single_open(file, lockdep_stats_show, NULL);
  300. }
  301. static const struct file_operations proc_lockdep_stats_operations = {
  302. .open = lockdep_stats_open,
  303. .read = seq_read,
  304. .llseek = seq_lseek,
  305. .release = seq_release,
  306. };
  307. #ifdef CONFIG_LOCK_STAT
  308. struct lock_stat_data {
  309. struct lock_class *class;
  310. struct lock_class_stats stats;
  311. };
  312. struct lock_stat_seq {
  313. struct lock_stat_data *iter;
  314. struct lock_stat_data *iter_end;
  315. struct lock_stat_data stats[MAX_LOCKDEP_KEYS];
  316. };
  317. /*
  318. * sort on absolute number of contentions
  319. */
  320. static int lock_stat_cmp(const void *l, const void *r)
  321. {
  322. const struct lock_stat_data *dl = l, *dr = r;
  323. unsigned long nl, nr;
  324. nl = dl->stats.read_waittime.nr + dl->stats.write_waittime.nr;
  325. nr = dr->stats.read_waittime.nr + dr->stats.write_waittime.nr;
  326. return nr - nl;
  327. }
  328. static void seq_line(struct seq_file *m, char c, int offset, int length)
  329. {
  330. int i;
  331. for (i = 0; i < offset; i++)
  332. seq_puts(m, " ");
  333. for (i = 0; i < length; i++)
  334. seq_printf(m, "%c", c);
  335. seq_puts(m, "\n");
  336. }
  337. static void snprint_time(char *buf, size_t bufsiz, s64 nr)
  338. {
  339. unsigned long rem;
  340. rem = do_div(nr, 1000); /* XXX: do_div_signed */
  341. snprintf(buf, bufsiz, "%lld.%02d", (long long)nr, ((int)rem+5)/10);
  342. }
  343. static void seq_time(struct seq_file *m, s64 time)
  344. {
  345. char num[15];
  346. snprint_time(num, sizeof(num), time);
  347. seq_printf(m, " %14s", num);
  348. }
  349. static void seq_lock_time(struct seq_file *m, struct lock_time *lt)
  350. {
  351. seq_printf(m, "%14lu", lt->nr);
  352. seq_time(m, lt->min);
  353. seq_time(m, lt->max);
  354. seq_time(m, lt->total);
  355. }
  356. static void seq_stats(struct seq_file *m, struct lock_stat_data *data)
  357. {
  358. char name[39];
  359. struct lock_class *class;
  360. struct lock_class_stats *stats;
  361. int i, namelen;
  362. class = data->class;
  363. stats = &data->stats;
  364. namelen = 38;
  365. if (class->name_version > 1)
  366. namelen -= 2; /* XXX truncates versions > 9 */
  367. if (class->subclass)
  368. namelen -= 2;
  369. if (!class->name) {
  370. char str[KSYM_NAME_LEN];
  371. const char *key_name;
  372. key_name = __get_key_name(class->key, str);
  373. snprintf(name, namelen, "%s", key_name);
  374. } else {
  375. snprintf(name, namelen, "%s", class->name);
  376. }
  377. namelen = strlen(name);
  378. if (class->name_version > 1) {
  379. snprintf(name+namelen, 3, "#%d", class->name_version);
  380. namelen += 2;
  381. }
  382. if (class->subclass) {
  383. snprintf(name+namelen, 3, "/%d", class->subclass);
  384. namelen += 2;
  385. }
  386. if (stats->write_holdtime.nr) {
  387. if (stats->read_holdtime.nr)
  388. seq_printf(m, "%38s-W:", name);
  389. else
  390. seq_printf(m, "%40s:", name);
  391. seq_printf(m, "%14lu ", stats->bounces[bounce_contended_write]);
  392. seq_lock_time(m, &stats->write_waittime);
  393. seq_printf(m, " %14lu ", stats->bounces[bounce_acquired_write]);
  394. seq_lock_time(m, &stats->write_holdtime);
  395. seq_puts(m, "\n");
  396. }
  397. if (stats->read_holdtime.nr) {
  398. seq_printf(m, "%38s-R:", name);
  399. seq_printf(m, "%14lu ", stats->bounces[bounce_contended_read]);
  400. seq_lock_time(m, &stats->read_waittime);
  401. seq_printf(m, " %14lu ", stats->bounces[bounce_acquired_read]);
  402. seq_lock_time(m, &stats->read_holdtime);
  403. seq_puts(m, "\n");
  404. }
  405. if (stats->read_waittime.nr + stats->write_waittime.nr == 0)
  406. return;
  407. if (stats->read_holdtime.nr)
  408. namelen += 2;
  409. for (i = 0; i < ARRAY_SIZE(class->contention_point); i++) {
  410. char sym[KSYM_SYMBOL_LEN];
  411. char ip[32];
  412. if (class->contention_point[i] == 0)
  413. break;
  414. if (!i)
  415. seq_line(m, '-', 40-namelen, namelen);
  416. sprint_symbol(sym, class->contention_point[i]);
  417. snprintf(ip, sizeof(ip), "[<%p>]",
  418. (void *)class->contention_point[i]);
  419. seq_printf(m, "%40s %14lu %29s %s\n", name,
  420. stats->contention_point[i],
  421. ip, sym);
  422. }
  423. if (i) {
  424. seq_puts(m, "\n");
  425. seq_line(m, '.', 0, 40 + 1 + 10 * (14 + 1));
  426. seq_puts(m, "\n");
  427. }
  428. }
  429. static void seq_header(struct seq_file *m)
  430. {
  431. seq_printf(m, "lock_stat version 0.2\n");
  432. seq_line(m, '-', 0, 40 + 1 + 10 * (14 + 1));
  433. seq_printf(m, "%40s %14s %14s %14s %14s %14s %14s %14s %14s "
  434. "%14s %14s\n",
  435. "class name",
  436. "con-bounces",
  437. "contentions",
  438. "waittime-min",
  439. "waittime-max",
  440. "waittime-total",
  441. "acq-bounces",
  442. "acquisitions",
  443. "holdtime-min",
  444. "holdtime-max",
  445. "holdtime-total");
  446. seq_line(m, '-', 0, 40 + 1 + 10 * (14 + 1));
  447. seq_printf(m, "\n");
  448. }
  449. static void *ls_start(struct seq_file *m, loff_t *pos)
  450. {
  451. struct lock_stat_seq *data = m->private;
  452. if (data->iter == data->stats)
  453. seq_header(m);
  454. if (data->iter == data->iter_end)
  455. data->iter = NULL;
  456. return data->iter;
  457. }
  458. static void *ls_next(struct seq_file *m, void *v, loff_t *pos)
  459. {
  460. struct lock_stat_seq *data = m->private;
  461. (*pos)++;
  462. data->iter = v;
  463. data->iter++;
  464. if (data->iter == data->iter_end)
  465. data->iter = NULL;
  466. return data->iter;
  467. }
  468. static void ls_stop(struct seq_file *m, void *v)
  469. {
  470. }
  471. static int ls_show(struct seq_file *m, void *v)
  472. {
  473. struct lock_stat_seq *data = m->private;
  474. seq_stats(m, data->iter);
  475. return 0;
  476. }
  477. static struct seq_operations lockstat_ops = {
  478. .start = ls_start,
  479. .next = ls_next,
  480. .stop = ls_stop,
  481. .show = ls_show,
  482. };
  483. static int lock_stat_open(struct inode *inode, struct file *file)
  484. {
  485. int res;
  486. struct lock_class *class;
  487. struct lock_stat_seq *data = vmalloc(sizeof(struct lock_stat_seq));
  488. if (!data)
  489. return -ENOMEM;
  490. res = seq_open(file, &lockstat_ops);
  491. if (!res) {
  492. struct lock_stat_data *iter = data->stats;
  493. struct seq_file *m = file->private_data;
  494. data->iter = iter;
  495. list_for_each_entry(class, &all_lock_classes, lock_entry) {
  496. iter->class = class;
  497. iter->stats = lock_stats(class);
  498. iter++;
  499. }
  500. data->iter_end = iter;
  501. sort(data->stats, data->iter_end - data->iter,
  502. sizeof(struct lock_stat_data),
  503. lock_stat_cmp, NULL);
  504. m->private = data;
  505. } else
  506. vfree(data);
  507. return res;
  508. }
  509. static ssize_t lock_stat_write(struct file *file, const char __user *buf,
  510. size_t count, loff_t *ppos)
  511. {
  512. struct lock_class *class;
  513. char c;
  514. if (count) {
  515. if (get_user(c, buf))
  516. return -EFAULT;
  517. if (c != '0')
  518. return count;
  519. list_for_each_entry(class, &all_lock_classes, lock_entry)
  520. clear_lock_stats(class);
  521. }
  522. return count;
  523. }
  524. static int lock_stat_release(struct inode *inode, struct file *file)
  525. {
  526. struct seq_file *seq = file->private_data;
  527. vfree(seq->private);
  528. seq->private = NULL;
  529. return seq_release(inode, file);
  530. }
  531. static const struct file_operations proc_lock_stat_operations = {
  532. .open = lock_stat_open,
  533. .write = lock_stat_write,
  534. .read = seq_read,
  535. .llseek = seq_lseek,
  536. .release = lock_stat_release,
  537. };
  538. #endif /* CONFIG_LOCK_STAT */
  539. static int __init lockdep_proc_init(void)
  540. {
  541. struct proc_dir_entry *entry;
  542. entry = create_proc_entry("lockdep", S_IRUSR, NULL);
  543. if (entry)
  544. entry->proc_fops = &proc_lockdep_operations;
  545. entry = create_proc_entry("lockdep_stats", S_IRUSR, NULL);
  546. if (entry)
  547. entry->proc_fops = &proc_lockdep_stats_operations;
  548. #ifdef CONFIG_LOCK_STAT
  549. entry = create_proc_entry("lock_stat", S_IRUSR, NULL);
  550. if (entry)
  551. entry->proc_fops = &proc_lock_stat_operations;
  552. #endif
  553. return 0;
  554. }
  555. __initcall(lockdep_proc_init);