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 include/linux (2 of 4 files). Show all
Unified · Split
| @@ -344,6 +344,16 @@ extern void lock_unpin_lock(struct lockdep_map *lock, struct pin_cookie); · 343 unmodified lines | ||
| 344 | 344 | #define lockdep_repin_lock(l,c) lock_repin_lock(&(l)->dep_map, (c)) |
| 345 | 345 | #define lockdep_unpin_lock(l,c) lock_unpin_lock(&(l)->dep_map, (c)) |
| 346 | 346 | |
| 347 | +/* | |
| 348 | + * Must use lock_map_aquire_try() with override maps to avoid | |
| 349 | + * lockdep thinking they participate in the block chain. | |
| 350 | + */ | |
| 351 | +#define DEFINE_WAIT_OVERRIDE_MAP(_name, _wait_type) \ | |
| 352 | + struct lockdep_map _name = { \ | |
| 353 | + .name = #_name "-wait-type-override", \ | |
| 354 | + .wait_type_inner = _wait_type, \ | |
| 355 | + .lock_type = LD_LOCK_WAIT_OVERRIDE, } | |
| 356 | + | |
| 347 | 357 | #else /* !CONFIG_LOCKDEP */ |
| 348 | 358 | |
| 349 | 359 | static inline void lockdep_init_task(struct task_struct *task) |
| @@ -432,6 +442,9 @@ extern int lockdep_is_held(const void *); · 82 unmodified lines | ||
| 432 | 442 | #define lockdep_repin_lock(l, c) do { (void)(l); (void)(c); } while (0) |
| 433 | 443 | #define lockdep_unpin_lock(l, c) do { (void)(l); (void)(c); } while (0) |
| 434 | 444 | |
| 445 | +#define DEFINE_WAIT_OVERRIDE_MAP(_name, _wait_type) \ | |
| 446 | + struct lockdep_map __maybe_unused _name = {} | |
| 447 | + | |
| 435 | 448 | #endif /* !LOCKDEP */ |
| 436 | 449 | |
| 437 | 450 | enum xhlock_context_t { |
| @@ -556,6 +569,7 @@ do { \ · 118 unmodified lines | ||
| 556 | 569 | #define rwsem_release(l, i) lock_release(l, i) |
| 557 | 570 | |
| 558 | 571 | #define lock_map_acquire(l) lock_acquire_exclusive(l, 0, 0, NULL, _THIS_IP_) |
| 572 | +#define lock_map_acquire_try(l) lock_acquire_exclusive(l, 0, 1, NULL, _THIS_IP_) | |
| 559 | 573 | #define lock_map_acquire_read(l) lock_acquire_shared_recursive(l, 0, 0, NULL, _THIS_IP_) |
| 560 | 574 | #define lock_map_acquire_tryread(l) lock_acquire_shared_recursive(l, 0, 1, NULL, _THIS_IP_) |
| 561 | 575 | #define lock_map_release(l) lock_release(l, _THIS_IP_) |
| @@ -33,6 +33,7 @@ enum lockdep_wait_type { · 32 unmodified lines | ||
| 33 | 33 | enum lockdep_lock_type { |
| 34 | 34 | LD_LOCK_NORMAL = 0, /* normal, catch all */ |
| 35 | 35 | LD_LOCK_PERCPU, /* percpu */ |
| 36 | + LD_LOCK_WAIT_OVERRIDE, /* annotation */ | |
| 36 | 37 | LD_LOCK_MAX, |
| 37 | 38 | }; |
| 38 | 39 | |