Pull debugobjects fixes from Thomas Gleixner: "Two fixes for debugobjects: - Prevent the allocation path from waking up kswapd. That's a long standing issue due to the GFP_ATOMIC allocation flag. As debug objects can be invoked from pretty much any context waking kswapd can end up in arbitrary lock chains versus the waitqueue lock - Correct the explicit lockdep wait-type violation in debug_object_fill_pool()" * tag 'core-debugobjects-2023-05-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: debugobjects: Don't wake up kswapd from fill_pool() debugobjects,locking: Annotate debug_object_fill_pool() wait type violation
Showing the changes to kernel (1 of 4 files). Show all
Unified · Split
| @@ -2263,6 +2263,9 @@ static inline bool usage_match(struct lock_list *entry, void *mask) · 2262 unmodified lines | |||
| 2263 | 2263 | ||
| 2264 | static inline bool usage_skip(struct lock_list *entry, void *mask) | 2264 | static inline bool usage_skip(struct lock_list *entry, void *mask) |
| 2265 | { | 2265 | { |
| 2266 | if (entry->class->lock_type == LD_LOCK_NORMAL) | ||
| 2267 | return false; | ||
| 2268 | |||
| 2266 | /* | 2269 | /* |
| 2267 | * Skip local_lock() for irq inversion detection. | 2270 | * Skip local_lock() for irq inversion detection. |
| 2268 | * | 2271 | * |
| @@ -2289,14 +2292,16 @@ static inline bool usage_skip(struct lock_list *entry, void *mask) · 20 unmodified lines | |||
| 2289 | * As a result, we will skip local_lock(), when we search for irq | 2292 | * As a result, we will skip local_lock(), when we search for irq |
| 2290 | * inversion bugs. | 2293 | * inversion bugs. |
| 2291 | */ | 2294 | */ |
| 2292 | if (entry->class->lock_type == LD_LOCK_PERCPU) { | 2295 | if (entry->class->lock_type == LD_LOCK_PERCPU && |
| 2293 | if (DEBUG_LOCKS_WARN_ON(entry->class->wait_type_inner < LD_WAIT_CONFIG)) | 2296 | DEBUG_LOCKS_WARN_ON(entry->class->wait_type_inner < LD_WAIT_CONFIG)) |
| 2294 | return false; | 2297 | return false; |
| 2295 | 2298 | ||
| 2296 | return true; | 2299 | /* |
| 2297 | } | 2300 | * Skip WAIT_OVERRIDE for irq inversion detection -- it's not actually |
| 2301 | * a lock and only used to override the wait_type. | ||
| 2302 | */ | ||
| 2298 | 2303 | ||
| 2299 | return false; | 2304 | return true; |
| 2300 | } | 2305 | } |
| 2301 | 2306 | ||
| 2302 | /* | 2307 | /* |
| @@ -4768,7 +4773,8 @@ static int check_wait_context(struct task_struct *curr, struct held_lock *next) · 2465 unmodified lines | |||
| 4768 | 4773 | ||
| 4769 | for (; depth < curr->lockdep_depth; depth++) { | 4774 | for (; depth < curr->lockdep_depth; depth++) { |
| 4770 | struct held_lock *prev = curr->held_locks + depth; | 4775 | struct held_lock *prev = curr->held_locks + depth; |
| 4771 | u8 prev_inner = hlock_class(prev)->wait_type_inner; | 4776 | struct lock_class *class = hlock_class(prev); |
| 4777 | u8 prev_inner = class->wait_type_inner; | ||
| 4772 | 4778 | ||
| 4773 | if (prev_inner) { | 4779 | if (prev_inner) { |
| 4774 | /* | 4780 | /* |
| @@ -4778,6 +4784,14 @@ static int check_wait_context(struct task_struct *curr, struct held_lock *next) · 3 unmodified lines | |||
| 4778 | * Also due to trylocks. | 4784 | * Also due to trylocks. |
| 4779 | */ | 4785 | */ |
| 4780 | curr_inner = min(curr_inner, prev_inner); | 4786 | curr_inner = min(curr_inner, prev_inner); |
| 4787 | |||
| 4788 | /* | ||
| 4789 | * Allow override for annotations -- this is typically | ||
| 4790 | * only valid/needed for code that only exists when | ||
| 4791 | * CONFIG_PREEMPT_RT=n. | ||
| 4792 | */ | ||
| 4793 | if (unlikely(class->lock_type == LD_LOCK_WAIT_OVERRIDE)) | ||
| 4794 | curr_inner = prev_inner; | ||
| 4781 | } | 4795 | } |
| 4782 | } | 4796 | } |
| 4783 | 4797 | ||