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
1290 class->name_version = count_matching_names(class);1290 class->name_version = count_matching_names(class);
1291 class->wait_type_inner = lock->wait_type_inner;1291 class->wait_type_inner = lock->wait_type_inner;
1292 class->wait_type_outer = lock->wait_type_outer;1292 class->wait_type_outer = lock->wait_type_outer;
1293 class->lock_type = lock->lock_type;
1293 /*1294 /*
1294 * We use RCU's safe list-add method to make1295 * We use RCU's safe list-add method to make
1295 * parallel walking of the hash-list safe:1296 * parallel walking of the hash-list safe:
@@ -4503,9 +4504,9 @@ print_lock_invalid_wait_context(struct task_struct *curr, · 3207 unmodified lines
4503 */4504 */
4504static int check_wait_context(struct task_struct *curr, struct held_lock *next)4505static int check_wait_context(struct task_struct *curr, struct held_lock *next)
4505{4506{
4506 short next_inner = hlock_class(next)->wait_type_inner;4507 u8 next_inner = hlock_class(next)->wait_type_inner;
4507 short next_outer = hlock_class(next)->wait_type_outer;4508 u8 next_outer = hlock_class(next)->wait_type_outer;
4508 short curr_inner;4509 u8 curr_inner;
4509 int depth;4510 int depth;
4510 4511
4511 if (!curr->lockdep_depth || !next_inner || next->trylock)4512 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
4528 4529
4529 for (; depth < curr->lockdep_depth; depth++) {4530 for (; depth < curr->lockdep_depth; depth++) {
4530 struct held_lock *prev = curr->held_locks + depth;4531 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;
4532 4533
4533 if (prev_inner) {4534 if (prev_inner) {
4534 /*4535 /*
@@ -4577,9 +4578,9 @@ static inline int check_wait_context(struct task_struct *curr, · 42 unmodified lines
4577/*4578/*
4578 * Initialize a lock instance's lock-class mapping info:4579 * Initialize a lock instance's lock-class mapping info:
4579 */4580 */
4580void lockdep_init_map_waits(struct lockdep_map *lock, const char *name,4581void lockdep_init_map_type(struct lockdep_map *lock, const char *name,
4581 struct lock_class_key *key, int subclass,4582 struct lock_class_key *key, int subclass,
4582 short inner, short outer)4583 u8 inner, u8 outer, u8 lock_type)
4583{4584{
4584 int i;4585 int i;
4585 4586
@@ -4602,6 +4603,7 @@ void lockdep_init_map_waits(struct lockdep_map *lock, const char *name, · 16 unmodified lines
4602 4603
4603 lock->wait_type_outer = outer;4604 lock->wait_type_outer = outer;
4604 lock->wait_type_inner = inner;4605 lock->wait_type_inner = inner;
4606 lock->lock_type = lock_type;
4605 4607
4606 /*4608 /*
4607 * No key, no joy, we need to hash something.4609 * 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
4636 raw_local_irq_restore(flags);4638 raw_local_irq_restore(flags);
4637 }4639 }
4638}4640}
4639EXPORT_SYMBOL_GPL(lockdep_init_map_waits);4641EXPORT_SYMBOL_GPL(lockdep_init_map_type);
4640 4642
4641struct lock_class_key __lockdep_no_validate__;4643struct lock_class_key __lockdep_no_validate__;
4642EXPORT_SYMBOL_GPL(__lockdep_no_validate__);4644EXPORT_SYMBOL_GPL(__lockdep_no_validate__);