Messages in this thread Patch in this message | | | From | Stephen Brennan <> | Subject | [PATCH 4/4] printk: Drop console_sem during panic | Date | Fri, 21 Jan 2022 11:02:22 -0800 |
| |
If another CPU is in panic, we are about to be halted. Try to gracefully drop console_sem and allow the panic CPU to grab it easily.
Suggested-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Stephen Brennan <stephen.s.brennan@oracle.com> --- kernel/printk/printk.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index ca253ac07615..c2dc8ebd9509 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2668,7 +2668,7 @@ void console_unlock(void) for (;;) { size_t ext_len = 0; - int handover; + int handover, pcpu; size_t len; skip: @@ -2739,6 +2739,12 @@ void console_unlock(void) if (handover) return; + /* Allow panic_cpu to take over the consoles safely */ + pcpu = atomic_read(&panic_cpu); + if (unlikely(pcpu != PANIC_CPU_INVALID && + pcpu != raw_smp_processor_id())) + break; + if (do_cond_resched) cond_resched(); } -- 2.30.2
| |