lockdep_internals.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * kernel/lockdep_internals.h
  3. *
  4. * Runtime locking correctness validator
  5. *
  6. * lockdep subsystem internal functions and variables.
  7. */
  8. /*
  9. * MAX_LOCKDEP_ENTRIES is the maximum number of lock dependencies
  10. * we track.
  11. *
  12. * We use the per-lock dependency maps in two ways: we grow it by adding
  13. * every to-be-taken lock to all currently held lock's own dependency
  14. * table (if it's not there yet), and we check it for lock order
  15. * conflicts and deadlocks.
  16. */
  17. #define MAX_LOCKDEP_ENTRIES 8192UL
  18. #define MAX_LOCKDEP_CHAINS_BITS 14
  19. #define MAX_LOCKDEP_CHAINS (1UL << MAX_LOCKDEP_CHAINS_BITS)
  20. #define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5)
  21. /*
  22. * Stack-trace: tightly packed array of stack backtrace
  23. * addresses. Protected by the hash_lock.
  24. */
  25. #define MAX_STACK_TRACE_ENTRIES 262144UL
  26. extern struct list_head all_lock_classes;
  27. extern struct lock_chain lock_chains[];
  28. extern void
  29. get_usage_chars(struct lock_class *class, char *c1, char *c2, char *c3, char *c4);
  30. extern const char * __get_key_name(struct lockdep_subclass_key *key, char *str);
  31. struct lock_class *lock_chain_get_class(struct lock_chain *chain, int i);
  32. extern unsigned long nr_lock_classes;
  33. extern unsigned long nr_list_entries;
  34. extern unsigned long nr_lock_chains;
  35. extern int nr_chain_hlocks;
  36. extern unsigned long nr_stack_trace_entries;
  37. extern unsigned int nr_hardirq_chains;
  38. extern unsigned int nr_softirq_chains;
  39. extern unsigned int nr_process_chains;
  40. extern unsigned int max_lockdep_depth;
  41. extern unsigned int max_recursion_depth;
  42. #ifdef CONFIG_PROVE_LOCKING
  43. extern unsigned long lockdep_count_forward_deps(struct lock_class *);
  44. extern unsigned long lockdep_count_backward_deps(struct lock_class *);
  45. #else
  46. static inline unsigned long
  47. lockdep_count_forward_deps(struct lock_class *class)
  48. {
  49. return 0;
  50. }
  51. static inline unsigned long
  52. lockdep_count_backward_deps(struct lock_class *class)
  53. {
  54. return 0;
  55. }
  56. #endif
  57. #ifdef CONFIG_DEBUG_LOCKDEP
  58. /*
  59. * Various lockdep statistics:
  60. */
  61. extern atomic_t chain_lookup_hits;
  62. extern atomic_t chain_lookup_misses;
  63. extern atomic_t hardirqs_on_events;
  64. extern atomic_t hardirqs_off_events;
  65. extern atomic_t redundant_hardirqs_on;
  66. extern atomic_t redundant_hardirqs_off;
  67. extern atomic_t softirqs_on_events;
  68. extern atomic_t softirqs_off_events;
  69. extern atomic_t redundant_softirqs_on;
  70. extern atomic_t redundant_softirqs_off;
  71. extern atomic_t nr_unused_locks;
  72. extern atomic_t nr_cyclic_checks;
  73. extern atomic_t nr_cyclic_check_recursions;
  74. extern atomic_t nr_find_usage_forwards_checks;
  75. extern atomic_t nr_find_usage_forwards_recursions;
  76. extern atomic_t nr_find_usage_backwards_checks;
  77. extern atomic_t nr_find_usage_backwards_recursions;
  78. # define debug_atomic_inc(ptr) atomic_inc(ptr)
  79. # define debug_atomic_dec(ptr) atomic_dec(ptr)
  80. # define debug_atomic_read(ptr) atomic_read(ptr)
  81. #else
  82. # define debug_atomic_inc(ptr) do { } while (0)
  83. # define debug_atomic_dec(ptr) do { } while (0)
  84. # define debug_atomic_read(ptr) 0
  85. #endif