From 6778948f9de86c3cfaf36725a7c87dcff9ba247f Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Mon, 11 Dec 2023 08:20:59 +0000 Subject: [PATCH] kernel_5.10 no rt --- kernel/kernel/panic.c | 33 ++++++++++++++------------------- 1 files changed, 14 insertions(+), 19 deletions(-) diff --git a/kernel/kernel/panic.c b/kernel/kernel/panic.c index 873fedb..332736a 100644 --- a/kernel/kernel/panic.c +++ b/kernel/kernel/panic.c @@ -177,7 +177,6 @@ void panic(const char *fmt, ...) { static char buf[1024]; - va_list args2; va_list args; long i, i_next = 0, len; int state = 0; @@ -192,21 +191,6 @@ */ local_irq_disable(); preempt_disable_notrace(); - - console_verbose(); - pr_emerg("Kernel panic - not syncing:\n"); - va_start(args2, fmt); - va_copy(args, args2); - vprintk(fmt, args2); - va_end(args2); -#ifdef CONFIG_DEBUG_BUGVERBOSE - /* - * Avoid nested stack-dumping if a panic occurs during oops processing - */ - if (!test_taint(TAINT_DIE) && oops_in_progress <= 1) - dump_stack(); -#endif - pr_flush(1000, true); /* * It's possible to come here directly from a panic-assertion and @@ -229,12 +213,23 @@ if (old_cpu != PANIC_CPU_INVALID && old_cpu != this_cpu) panic_smp_self_stop(); + console_verbose(); bust_spinlocks(1); + va_start(args, fmt); len = vscnprintf(buf, sizeof(buf), fmt, args); va_end(args); if (len && buf[len - 1] == '\n') buf[len - 1] = '\0'; + + pr_emerg("Kernel panic - not syncing: %s\n", buf); +#ifdef CONFIG_DEBUG_BUGVERBOSE + /* + * Avoid nested stack-dumping if a panic occurs during oops processing + */ + if (!test_taint(TAINT_DIE) && oops_in_progress <= 1) + dump_stack(); +#endif /* * If kgdb is enabled, give it a chance to run before we stop all @@ -252,6 +247,7 @@ * Bypass the panic_cpu check and call __crash_kexec directly. */ if (!_crash_kexec_post_notifiers) { + printk_safe_flush_on_panic(); __crash_kexec(NULL); /* @@ -275,6 +271,8 @@ */ atomic_notifier_call_chain(&panic_notifier_list, 0, buf); + /* Call flush even twice. It tries harder with a single online CPU */ + printk_safe_flush_on_panic(); kmsg_dump(KMSG_DUMP_PANIC); /* @@ -544,11 +542,9 @@ static int init_oops_id(void) { -#ifndef CONFIG_PREEMPT_RT if (!oops_id) get_random_bytes(&oops_id, sizeof(oops_id)); else -#endif oops_id++; return 0; @@ -559,7 +555,6 @@ { init_oops_id(); pr_warn("---[ end trace %016llx ]---\n", (unsigned long long)oops_id); - pr_flush(1000, true); } /* -- Gitblit v1.6.2