diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-x86/irqflags_32.h | 13 | ||||
| -rw-r--r-- | include/asm-x86/irqflags_64.h | 14 | ||||
| -rw-r--r-- | include/linux/fs.h | 6 | ||||
| -rw-r--r-- | include/linux/jbd.h | 5 | ||||
| -rw-r--r-- | include/linux/lockdep.h | 9 | ||||
| -rw-r--r-- | include/linux/mutex.h | 9 | ||||
| -rw-r--r-- | include/linux/rcupdate.h | 14 |
7 files changed, 67 insertions, 3 deletions
diff --git a/include/asm-x86/irqflags_32.h b/include/asm-x86/irqflags_32.h index eff8585cb741..d058b04e0083 100644 --- a/include/asm-x86/irqflags_32.h +++ b/include/asm-x86/irqflags_32.h | |||
| @@ -160,4 +160,17 @@ static inline int raw_irqs_disabled(void) | |||
| 160 | # define TRACE_IRQS_OFF | 160 | # define TRACE_IRQS_OFF |
| 161 | #endif | 161 | #endif |
| 162 | 162 | ||
| 163 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
| 164 | # define LOCKDEP_SYS_EXIT \ | ||
| 165 | pushl %eax; \ | ||
| 166 | pushl %ecx; \ | ||
| 167 | pushl %edx; \ | ||
| 168 | call lockdep_sys_exit; \ | ||
| 169 | popl %edx; \ | ||
| 170 | popl %ecx; \ | ||
| 171 | popl %eax; | ||
| 172 | #else | ||
| 173 | # define LOCKDEP_SYS_EXIT | ||
| 174 | #endif | ||
| 175 | |||
| 163 | #endif | 176 | #endif |
diff --git a/include/asm-x86/irqflags_64.h b/include/asm-x86/irqflags_64.h index 86e70fe23659..5341ea1f815a 100644 --- a/include/asm-x86/irqflags_64.h +++ b/include/asm-x86/irqflags_64.h | |||
| @@ -137,6 +137,20 @@ static inline void halt(void) | |||
| 137 | # define TRACE_IRQS_ON | 137 | # define TRACE_IRQS_ON |
| 138 | # define TRACE_IRQS_OFF | 138 | # define TRACE_IRQS_OFF |
| 139 | # endif | 139 | # endif |
| 140 | # ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
| 141 | # define LOCKDEP_SYS_EXIT call lockdep_sys_exit_thunk | ||
| 142 | # define LOCKDEP_SYS_EXIT_IRQ \ | ||
| 143 | TRACE_IRQS_ON; \ | ||
| 144 | sti; \ | ||
| 145 | SAVE_REST; \ | ||
| 146 | LOCKDEP_SYS_EXIT; \ | ||
| 147 | RESTORE_REST; \ | ||
| 148 | cli; \ | ||
| 149 | TRACE_IRQS_OFF; | ||
| 150 | # else | ||
| 151 | # define LOCKDEP_SYS_EXIT | ||
| 152 | # define LOCKDEP_SYS_EXIT_IRQ | ||
| 153 | # endif | ||
| 140 | #endif | 154 | #endif |
| 141 | 155 | ||
| 142 | #endif | 156 | #endif |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 16421f662a7a..6d760f1ad875 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -1302,8 +1302,14 @@ struct file_system_type { | |||
| 1302 | struct module *owner; | 1302 | struct module *owner; |
| 1303 | struct file_system_type * next; | 1303 | struct file_system_type * next; |
| 1304 | struct list_head fs_supers; | 1304 | struct list_head fs_supers; |
| 1305 | |||
| 1305 | struct lock_class_key s_lock_key; | 1306 | struct lock_class_key s_lock_key; |
| 1306 | struct lock_class_key s_umount_key; | 1307 | struct lock_class_key s_umount_key; |
| 1308 | |||
| 1309 | struct lock_class_key i_lock_key; | ||
| 1310 | struct lock_class_key i_mutex_key; | ||
| 1311 | struct lock_class_key i_mutex_dir_key; | ||
| 1312 | struct lock_class_key i_alloc_sem_key; | ||
| 1307 | }; | 1313 | }; |
| 1308 | 1314 | ||
| 1309 | extern int get_sb_bdev(struct file_system_type *fs_type, | 1315 | extern int get_sb_bdev(struct file_system_type *fs_type, |
diff --git a/include/linux/jbd.h b/include/linux/jbd.h index 452737551260..700a93b79189 100644 --- a/include/linux/jbd.h +++ b/include/linux/jbd.h | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #include <linux/bit_spinlock.h> | 30 | #include <linux/bit_spinlock.h> |
| 31 | #include <linux/mutex.h> | 31 | #include <linux/mutex.h> |
| 32 | #include <linux/timer.h> | 32 | #include <linux/timer.h> |
| 33 | #include <linux/lockdep.h> | ||
| 33 | 34 | ||
| 34 | #include <asm/semaphore.h> | 35 | #include <asm/semaphore.h> |
| 35 | #endif | 36 | #endif |
| @@ -396,6 +397,10 @@ struct handle_s | |||
| 396 | unsigned int h_sync: 1; /* sync-on-close */ | 397 | unsigned int h_sync: 1; /* sync-on-close */ |
| 397 | unsigned int h_jdata: 1; /* force data journaling */ | 398 | unsigned int h_jdata: 1; /* force data journaling */ |
| 398 | unsigned int h_aborted: 1; /* fatal error on handle */ | 399 | unsigned int h_aborted: 1; /* fatal error on handle */ |
| 400 | |||
| 401 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
| 402 | struct lockdep_map h_lockdep_map; | ||
| 403 | #endif | ||
| 399 | }; | 404 | }; |
| 400 | 405 | ||
| 401 | 406 | ||
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 0e843bf65877..f6279f68a827 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h | |||
| @@ -238,6 +238,7 @@ extern void lockdep_info(void); | |||
| 238 | extern void lockdep_reset(void); | 238 | extern void lockdep_reset(void); |
| 239 | extern void lockdep_reset_lock(struct lockdep_map *lock); | 239 | extern void lockdep_reset_lock(struct lockdep_map *lock); |
| 240 | extern void lockdep_free_key_range(void *start, unsigned long size); | 240 | extern void lockdep_free_key_range(void *start, unsigned long size); |
| 241 | extern void lockdep_sys_exit(void); | ||
| 241 | 242 | ||
| 242 | extern void lockdep_off(void); | 243 | extern void lockdep_off(void); |
| 243 | extern void lockdep_on(void); | 244 | extern void lockdep_on(void); |
| @@ -252,6 +253,13 @@ extern void lockdep_init_map(struct lockdep_map *lock, const char *name, | |||
| 252 | struct lock_class_key *key, int subclass); | 253 | struct lock_class_key *key, int subclass); |
| 253 | 254 | ||
| 254 | /* | 255 | /* |
| 256 | * To initialize a lockdep_map statically use this macro. | ||
| 257 | * Note that _name must not be NULL. | ||
| 258 | */ | ||
| 259 | #define STATIC_LOCKDEP_MAP_INIT(_name, _key) \ | ||
| 260 | { .name = (_name), .key = (void *)(_key), } | ||
| 261 | |||
| 262 | /* | ||
| 255 | * Reinitialize a lock key - for cases where there is special locking or | 263 | * Reinitialize a lock key - for cases where there is special locking or |
| 256 | * special initialization of locks so that the validator gets the scope | 264 | * special initialization of locks so that the validator gets the scope |
| 257 | * of dependencies wrong: they are either too broad (they need a class-split) | 265 | * of dependencies wrong: they are either too broad (they need a class-split) |
| @@ -317,6 +325,7 @@ static inline void lockdep_on(void) | |||
| 317 | # define INIT_LOCKDEP | 325 | # define INIT_LOCKDEP |
| 318 | # define lockdep_reset() do { debug_locks = 1; } while (0) | 326 | # define lockdep_reset() do { debug_locks = 1; } while (0) |
| 319 | # define lockdep_free_key_range(start, size) do { } while (0) | 327 | # define lockdep_free_key_range(start, size) do { } while (0) |
| 328 | # define lockdep_sys_exit() do { } while (0) | ||
| 320 | /* | 329 | /* |
| 321 | * The class key takes no space if lockdep is disabled: | 330 | * The class key takes no space if lockdep is disabled: |
| 322 | */ | 331 | */ |
diff --git a/include/linux/mutex.h b/include/linux/mutex.h index 0d50ea3df689..6a735c72f23f 100644 --- a/include/linux/mutex.h +++ b/include/linux/mutex.h | |||
| @@ -120,14 +120,17 @@ static inline int fastcall mutex_is_locked(struct mutex *lock) | |||
| 120 | * See kernel/mutex.c for detailed documentation of these APIs. | 120 | * See kernel/mutex.c for detailed documentation of these APIs. |
| 121 | * Also see Documentation/mutex-design.txt. | 121 | * Also see Documentation/mutex-design.txt. |
| 122 | */ | 122 | */ |
| 123 | extern void fastcall mutex_lock(struct mutex *lock); | ||
| 124 | extern int __must_check fastcall mutex_lock_interruptible(struct mutex *lock); | ||
| 125 | |||
| 126 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 123 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 127 | extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass); | 124 | extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass); |
| 128 | extern int __must_check mutex_lock_interruptible_nested(struct mutex *lock, | 125 | extern int __must_check mutex_lock_interruptible_nested(struct mutex *lock, |
| 129 | unsigned int subclass); | 126 | unsigned int subclass); |
| 127 | |||
| 128 | #define mutex_lock(lock) mutex_lock_nested(lock, 0) | ||
| 129 | #define mutex_lock_interruptible(lock) mutex_lock_interruptible_nested(lock, 0) | ||
| 130 | #else | 130 | #else |
| 131 | extern void fastcall mutex_lock(struct mutex *lock); | ||
| 132 | extern int __must_check fastcall mutex_lock_interruptible(struct mutex *lock); | ||
| 133 | |||
| 131 | # define mutex_lock_nested(lock, subclass) mutex_lock(lock) | 134 | # define mutex_lock_nested(lock, subclass) mutex_lock(lock) |
| 132 | # define mutex_lock_interruptible_nested(lock, subclass) mutex_lock_interruptible(lock) | 135 | # define mutex_lock_interruptible_nested(lock, subclass) mutex_lock_interruptible(lock) |
| 133 | #endif | 136 | #endif |
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index fe17d7d750c2..76c1a530edc5 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
| @@ -41,6 +41,7 @@ | |||
| 41 | #include <linux/percpu.h> | 41 | #include <linux/percpu.h> |
| 42 | #include <linux/cpumask.h> | 42 | #include <linux/cpumask.h> |
| 43 | #include <linux/seqlock.h> | 43 | #include <linux/seqlock.h> |
| 44 | #include <linux/lockdep.h> | ||
| 44 | 45 | ||
| 45 | /** | 46 | /** |
| 46 | * struct rcu_head - callback structure for use with RCU | 47 | * struct rcu_head - callback structure for use with RCU |
| @@ -133,6 +134,15 @@ static inline void rcu_bh_qsctr_inc(int cpu) | |||
| 133 | extern int rcu_pending(int cpu); | 134 | extern int rcu_pending(int cpu); |
| 134 | extern int rcu_needs_cpu(int cpu); | 135 | extern int rcu_needs_cpu(int cpu); |
| 135 | 136 | ||
| 137 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
| 138 | extern struct lockdep_map rcu_lock_map; | ||
| 139 | # define rcu_read_acquire() lock_acquire(&rcu_lock_map, 0, 0, 2, 1, _THIS_IP_) | ||
| 140 | # define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_) | ||
| 141 | #else | ||
| 142 | # define rcu_read_acquire() do { } while (0) | ||
| 143 | # define rcu_read_release() do { } while (0) | ||
| 144 | #endif | ||
| 145 | |||
| 136 | /** | 146 | /** |
| 137 | * rcu_read_lock - mark the beginning of an RCU read-side critical section. | 147 | * rcu_read_lock - mark the beginning of an RCU read-side critical section. |
| 138 | * | 148 | * |
| @@ -166,6 +176,7 @@ extern int rcu_needs_cpu(int cpu); | |||
| 166 | do { \ | 176 | do { \ |
| 167 | preempt_disable(); \ | 177 | preempt_disable(); \ |
| 168 | __acquire(RCU); \ | 178 | __acquire(RCU); \ |
| 179 | rcu_read_acquire(); \ | ||
| 169 | } while(0) | 180 | } while(0) |
| 170 | 181 | ||
| 171 | /** | 182 | /** |
| @@ -175,6 +186,7 @@ extern int rcu_needs_cpu(int cpu); | |||
| 175 | */ | 186 | */ |
| 176 | #define rcu_read_unlock() \ | 187 | #define rcu_read_unlock() \ |
| 177 | do { \ | 188 | do { \ |
| 189 | rcu_read_release(); \ | ||
| 178 | __release(RCU); \ | 190 | __release(RCU); \ |
| 179 | preempt_enable(); \ | 191 | preempt_enable(); \ |
| 180 | } while(0) | 192 | } while(0) |
| @@ -204,6 +216,7 @@ extern int rcu_needs_cpu(int cpu); | |||
| 204 | do { \ | 216 | do { \ |
| 205 | local_bh_disable(); \ | 217 | local_bh_disable(); \ |
| 206 | __acquire(RCU_BH); \ | 218 | __acquire(RCU_BH); \ |
| 219 | rcu_read_acquire(); \ | ||
| 207 | } while(0) | 220 | } while(0) |
| 208 | 221 | ||
| 209 | /* | 222 | /* |
| @@ -213,6 +226,7 @@ extern int rcu_needs_cpu(int cpu); | |||
| 213 | */ | 226 | */ |
| 214 | #define rcu_read_unlock_bh() \ | 227 | #define rcu_read_unlock_bh() \ |
| 215 | do { \ | 228 | do { \ |
| 229 | rcu_read_release(); \ | ||
| 216 | __release(RCU_BH); \ | 230 | __release(RCU_BH); \ |
| 217 | local_bh_enable(); \ | 231 | local_bh_enable(); \ |
| 218 | } while(0) | 232 | } while(0) |
