aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/lockdep.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/lockdep.h')
-rw-r--r--include/linux/lockdep.h31
1 files changed, 27 insertions, 4 deletions
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 331e5f1c2d8e..fc9f8e88123b 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -73,6 +73,8 @@ struct lock_class_key {
73 struct lockdep_subclass_key subkeys[MAX_LOCKDEP_SUBCLASSES]; 73 struct lockdep_subclass_key subkeys[MAX_LOCKDEP_SUBCLASSES];
74}; 74};
75 75
76#define LOCKSTAT_POINTS 4
77
76/* 78/*
77 * The lock-class itself: 79 * The lock-class itself:
78 */ 80 */
@@ -119,7 +121,8 @@ struct lock_class {
119 int name_version; 121 int name_version;
120 122
121#ifdef CONFIG_LOCK_STAT 123#ifdef CONFIG_LOCK_STAT
122 unsigned long contention_point[4]; 124 unsigned long contention_point[LOCKSTAT_POINTS];
125 unsigned long contending_point[LOCKSTAT_POINTS];
123#endif 126#endif
124}; 127};
125 128
@@ -144,6 +147,7 @@ enum bounce_type {
144 147
145struct lock_class_stats { 148struct lock_class_stats {
146 unsigned long contention_point[4]; 149 unsigned long contention_point[4];
150 unsigned long contending_point[4];
147 struct lock_time read_waittime; 151 struct lock_time read_waittime;
148 struct lock_time write_waittime; 152 struct lock_time write_waittime;
149 struct lock_time read_holdtime; 153 struct lock_time read_holdtime;
@@ -165,6 +169,7 @@ struct lockdep_map {
165 const char *name; 169 const char *name;
166#ifdef CONFIG_LOCK_STAT 170#ifdef CONFIG_LOCK_STAT
167 int cpu; 171 int cpu;
172 unsigned long ip;
168#endif 173#endif
169}; 174};
170 175
@@ -355,7 +360,7 @@ struct lock_class_key { };
355#ifdef CONFIG_LOCK_STAT 360#ifdef CONFIG_LOCK_STAT
356 361
357extern void lock_contended(struct lockdep_map *lock, unsigned long ip); 362extern void lock_contended(struct lockdep_map *lock, unsigned long ip);
358extern void lock_acquired(struct lockdep_map *lock); 363extern void lock_acquired(struct lockdep_map *lock, unsigned long ip);
359 364
360#define LOCK_CONTENDED(_lock, try, lock) \ 365#define LOCK_CONTENDED(_lock, try, lock) \
361do { \ 366do { \
@@ -363,13 +368,13 @@ do { \
363 lock_contended(&(_lock)->dep_map, _RET_IP_); \ 368 lock_contended(&(_lock)->dep_map, _RET_IP_); \
364 lock(_lock); \ 369 lock(_lock); \
365 } \ 370 } \
366 lock_acquired(&(_lock)->dep_map); \ 371 lock_acquired(&(_lock)->dep_map, _RET_IP_); \
367} while (0) 372} while (0)
368 373
369#else /* CONFIG_LOCK_STAT */ 374#else /* CONFIG_LOCK_STAT */
370 375
371#define lock_contended(lockdep_map, ip) do {} while (0) 376#define lock_contended(lockdep_map, ip) do {} while (0)
372#define lock_acquired(lockdep_map) do {} while (0) 377#define lock_acquired(lockdep_map, ip) do {} while (0)
373 378
374#define LOCK_CONTENDED(_lock, try, lock) \ 379#define LOCK_CONTENDED(_lock, try, lock) \
375 lock(_lock) 380 lock(_lock)
@@ -480,4 +485,22 @@ static inline void print_irqtrace_events(struct task_struct *curr)
480# define lock_map_release(l) do { } while (0) 485# define lock_map_release(l) do { } while (0)
481#endif 486#endif
482 487
488#ifdef CONFIG_PROVE_LOCKING
489# define might_lock(lock) \
490do { \
491 typecheck(struct lockdep_map *, &(lock)->dep_map); \
492 lock_acquire(&(lock)->dep_map, 0, 0, 0, 2, NULL, _THIS_IP_); \
493 lock_release(&(lock)->dep_map, 0, _THIS_IP_); \
494} while (0)
495# define might_lock_read(lock) \
496do { \
497 typecheck(struct lockdep_map *, &(lock)->dep_map); \
498 lock_acquire(&(lock)->dep_map, 0, 0, 1, 2, NULL, _THIS_IP_); \
499 lock_release(&(lock)->dep_map, 0, _THIS_IP_); \
500} while (0)
501#else
502# define might_lock(lock) do { } while (0)
503# define might_lock_read(lock) do { } while (0)
504#endif
505
483#endif /* __LINUX_LOCKDEP_H */ 506#endif /* __LINUX_LOCKDEP_H */