[tip: sched/rt] panic: Mark emergency section in oops

From: tip-bot2 for John Ogness
Date: Mon Sep 09 2024 - 13:31:07 EST


The following commit has been merged into the sched/rt branch of tip:

Commit-ID: 4bdfa0d8e920c391e6cc0aa1feef8ed91d81f724
Gitweb: https://git.kernel.org/tip/4bdfa0d8e920c391e6cc0aa1feef8ed91d81f724
Author: John Ogness <john.ogness@xxxxxxxxxxxxx>
AuthorDate: Tue, 20 Aug 2024 08:35:59 +02:06
Committer: Petr Mladek <pmladek@xxxxxxxx>
CommitterDate: Wed, 21 Aug 2024 15:03:04 +02:00

panic: Mark emergency section in oops

Mark an emergency section beginning with oops_enter() until the
end of oops_exit(). In this section, every printk() call will
attempt to directly flush to the consoles using the EMERGENCY
priority.

The very end of oops_exit() performs a kmsg_dump(). This is not
included in the emergency section because it is another
flushing mechanism that should occur after the consoles have
flushed the oops messages.

Signed-off-by: John Ogness <john.ogness@xxxxxxxxxxxxx>
Reviewed-by: Petr Mladek <pmladek@xxxxxxxx>
Link: https://lore.kernel.org/r/20240820063001.36405-34-john.ogness@xxxxxxxxxxxxx
Signed-off-by: Petr Mladek <pmladek@xxxxxxxx>
---
kernel/panic.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/kernel/panic.c b/kernel/panic.c
index 1a10b6e..753d12f 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -685,6 +685,7 @@ bool oops_may_print(void)
*/
void oops_enter(void)
{
+ nbcon_cpu_emergency_enter();
tracing_off();
/* can't trust the integrity of the kernel anymore: */
debug_locks_off();
@@ -707,6 +708,7 @@ void oops_exit(void)
{
do_oops_enter_exit();
print_oops_end_marker();
+ nbcon_cpu_emergency_exit();
kmsg_dump(KMSG_DUMP_OOPS);
}