diff options
author | Peter Zijlstra <peterz@infradead.org> | 2024-12-20 15:31:19 +0100 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2024-12-20 15:31:19 +0100 |
commit | c2db11a750fb626d0d04f2dc76e548a1f07617df (patch) | |
tree | 01c899b2a06855633ae991f2064242f976987809 /lib/stackdepot.c | |
parent | 63a48181fbcddefe5fb4c6618938bb64c543945b (diff) | |
parent | 4a077914578183ec397ad09f7156a357e00e5d72 (diff) |
Merge branch 'locking/urgent'
Sync with urgent -- avoid conflicts.
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Diffstat (limited to 'lib/stackdepot.c')
-rw-r--r-- | lib/stackdepot.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/stackdepot.c b/lib/stackdepot.c index 5ed34cc963fc3..245d5b4166999 100644 --- a/lib/stackdepot.c +++ b/lib/stackdepot.c @@ -630,7 +630,15 @@ depot_stack_handle_t stack_depot_save_flags(unsigned long *entries, prealloc = page_address(page); } - raw_spin_lock_irqsave(&pool_lock, flags); + if (in_nmi()) { + /* We can never allocate in NMI context. */ + WARN_ON_ONCE(can_alloc); + /* Best effort; bail if we fail to take the lock. */ + if (!raw_spin_trylock_irqsave(&pool_lock, flags)) + goto exit; + } else { + raw_spin_lock_irqsave(&pool_lock, flags); + } printk_deferred_enter(); /* Try to find again, to avoid concurrently inserting duplicates. */ |