diff options
| author | Ingo Molnar <mingo@kernel.org> | 2024-03-25 13:32:29 +0300 | 
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2024-03-25 13:32:29 +0300 | 
| commit | f4566a1e73957800df75a3dd2dccee8a4697f327 (patch) | |
| tree | b043b875228c0b25988af66c680d60cae69d761d /lib/dump_stack.c | |
| parent | b9e6e28663928cab836a19abbdec3d036a07db3b (diff) | |
| parent | 4cece764965020c22cff7665b18a012006359095 (diff) | |
| download | linux-f4566a1e73957800df75a3dd2dccee8a4697f327.tar.xz | |
Merge tag 'v6.9-rc1' into sched/core, to pick up fixes and to refresh the branch
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'lib/dump_stack.c')
| -rw-r--r-- | lib/dump_stack.c | 16 | 
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/dump_stack.c b/lib/dump_stack.c index 83471e81501a..222c6d6c8281 100644 --- a/lib/dump_stack.c +++ b/lib/dump_stack.c @@ -96,15 +96,25 @@ static void __dump_stack(const char *log_lvl)   */  asmlinkage __visible void dump_stack_lvl(const char *log_lvl)  { +	bool in_panic = this_cpu_in_panic();  	unsigned long flags;  	/*  	 * Permit this cpu to perform nested stack dumps while serialising -	 * against other CPUs +	 * against other CPUs, unless this CPU is in panic. +	 * +	 * When in panic, non-panic CPUs are not permitted to store new +	 * printk messages so there is no need to synchronize the output. +	 * This avoids potential deadlock in panic() if another CPU is +	 * holding and unable to release the printk_cpu_sync.  	 */ -	printk_cpu_sync_get_irqsave(flags); +	if (!in_panic) +		printk_cpu_sync_get_irqsave(flags); +  	__dump_stack(log_lvl); -	printk_cpu_sync_put_irqrestore(flags); + +	if (!in_panic) +		printk_cpu_sync_put_irqrestore(flags);  }  EXPORT_SYMBOL(dump_stack_lvl);  | 
