History

locking/lockdep: Mark local_lock_t

The local_lock_t's are special, because they cannot form IRQ inversions, make sure we can tell them apart from the rest of the locks.

Peter Zijlstra committed 5 years ago

Commit dfd5e3f1 parent 5831c0f4 files · +39 −15Browse files

Showing the changes to kernel/locking (1 of 4 files). Show all

Unified · Split

kernel/locking/lockdep.c+9−7
@@ -1290,6 +1290,7 @@ register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force) · 1289 unmodified lines
12901290 class->name_version = count_matching_names(class);
12911291 class->wait_type_inner = lock->wait_type_inner;
12921292 class->wait_type_outer = lock->wait_type_outer;
1293+ class->lock_type = lock->lock_type;
12931294 /*
12941295 * We use RCU's safe list-add method to make
12951296 * parallel walking of the hash-list safe:
@@ -4503,9 +4504,9 @@ print_lock_invalid_wait_context(struct task_struct *curr, · 3207 unmodified lines
45034504 */
45044505 static int check_wait_context(struct task_struct *curr, struct held_lock *next)
45054506 {
4506− short next_inner = hlock_class(next)->wait_type_inner;
4507− short next_outer = hlock_class(next)->wait_type_outer;
4508− short curr_inner;
4507+ u8 next_inner = hlock_class(next)->wait_type_inner;
4508+ u8 next_outer = hlock_class(next)->wait_type_outer;
4509+ u8 curr_inner;
45094510 int depth;
45104511
45114512 if (!curr->lockdep_depth || !next_inner || next->trylock)
@@ -4528,7 +4529,7 @@ static int check_wait_context(struct task_struct *curr, struct held_lock *next) · 16 unmodified lines
45284529
45294530 for (; depth < curr->lockdep_depth; depth++) {
45304531 struct held_lock *prev = curr->held_locks + depth;
4531− short prev_inner = hlock_class(prev)->wait_type_inner;
4532+ u8 prev_inner = hlock_class(prev)->wait_type_inner;
45324533
45334534 if (prev_inner) {
45344535 /*
@@ -4577,9 +4578,9 @@ static inline int check_wait_context(struct task_struct *curr, · 42 unmodified lines
45774578 /*
45784579 * Initialize a lock instance's lock-class mapping info:
45794580 */
4580−void lockdep_init_map_waits(struct lockdep_map *lock, const char *name,
4581+void lockdep_init_map_type(struct lockdep_map *lock, const char *name,
45814582 struct lock_class_key *key, int subclass,
4582− short inner, short outer)
4583+ u8 inner, u8 outer, u8 lock_type)
45834584 {
45844585 int i;
45854586
@@ -4602,6 +4603,7 @@ void lockdep_init_map_waits(struct lockdep_map *lock, const char *name, · 16 unmodified lines
46024603
46034604 lock->wait_type_outer = outer;
46044605 lock->wait_type_inner = inner;
4606+ lock->lock_type = lock_type;
46054607
46064608 /*
46074609 * No key, no joy, we need to hash something.
@@ -4636,7 +4638,7 @@ void lockdep_init_map_waits(struct lockdep_map *lock, const char *name, · 28 unmodified lines
46364638 raw_local_irq_restore(flags);
46374639 }
46384640 }
4639−EXPORT_SYMBOL_GPL(lockdep_init_map_waits);
4641+EXPORT_SYMBOL_GPL(lockdep_init_map_type);
46404642
46414643 struct lock_class_key __lockdep_no_validate__;
46424644 EXPORT_SYMBOL_GPL(__lockdep_no_validate__);