lockdep_internals.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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_KEYS_BITS 11
  19. #define MAX_LOCKDEP_KEYS (1UL << MAX_LOCKDEP_KEYS_BITS)
  20. #define MAX_LOCKDEP_CHAINS_BITS 14
  21. #define MAX_LOCKDEP_CHAINS (1UL << MAX_LOCKDEP_CHAINS_BITS)
  22. /*
  23. * Stack-trace: tightly packed array of stack backtrace
  24. * addresses. Protected by the hash_lock.
  25. */
  26. #define MAX_STACK_TRACE_ENTRIES 262144UL
  27. extern struct list_head all_lock_classes;
  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. extern unsigned long nr_lock_classes;
  32. extern unsigned long nr_list_entries;
  33. extern unsigned long nr_lock_chains;
  34. extern unsigned long nr_stack_trace_entries;
  35. extern unsigned int nr_hardirq_chains;
  36. extern unsigned int nr_softirq_chains;
  37. extern unsigned int nr_process_chains;
  38. extern unsigned int max_lockdep_depth;
  39. extern unsigned int max_recursion_depth;
  40. #ifdef CONFIG_DEBUG_LOCKDEP
  41. /*
  42. * Various lockdep statistics:
  43. */
  44. extern atomic_t chain_lookup_hits;
  45. extern atomic_t chain_lookup_misses;
  46. extern atomic_t hardirqs_on_events;
  47. extern atomic_t hardirqs_off_events;
  48. extern atomic_t redundant_hardirqs_on;
  49. extern atomic_t redundant_hardirqs_off;
  50. extern atomic_t softirqs_on_events;
  51. extern atomic_t softirqs_off_events;
  52. extern atomic_t redundant_softirqs_on;
  53. extern atomic_t redundant_softirqs_off;
  54. extern atomic_t nr_unused_locks;
  55. extern atomic_t nr_cyclic_checks;
  56. extern atomic_t nr_cyclic_check_recursions;
  57. extern atomic_t nr_find_usage_forwards_checks;
  58. extern atomic_t nr_find_usage_forwards_recursions;
  59. extern atomic_t nr_find_usage_backwards_checks;
  60. extern atomic_t nr_find_usage_backwards_recursions;
  61. # define debug_atomic_inc(ptr) atomic_inc(ptr)
  62. # define debug_atomic_dec(ptr) atomic_dec(ptr)
  63. # define debug_atomic_read(ptr) atomic_read(ptr)
  64. #else
  65. # define debug_atomic_inc(ptr) do { } while (0)
  66. # define debug_atomic_dec(ptr) do { } while (0)
  67. # define debug_atomic_read(ptr) 0
  68. #endif