From: Huang Shijie <shijie@os.amperecomputing.com>
To: will@kernel.org, catalin.marinas@arm.com
Cc: patches@amperecomputing.com, zwang@amperecomputing.com,
darren@os.amperecomputing.com, pasha.tatashin@soleen.com,
pmladek@suse.com, senozhatsky@chromium.org, rostedt@goodmis.org,
john.ogness@linutronix.de, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Huang Shijie <shijie@os.amperecomputing.com>,
Adam Li <adam.li@amperecomputing.com>
Subject: [PATCH v2] arm64: kexec: flush log to console in NMI context
Date: Sun, 24 Apr 2022 15:19:52 +0000 [thread overview]
Message-ID: <20220424151952.183208-1-shijie@os.amperecomputing.com> (raw)
If kdump is configured, nmi_panic() may run to machine_kexec().
In NMI context, the defer_console_output() defers the console
output by using wake_up_klogd to flush the printk ringbuffer
to console.
But in the machine_kexec, the system will reset, and there is
no chance for the wake_up_klogd to do its job. So we can _not_
see any log on the console since the nmi_panic
(nmi_panic() will disable the irq).
This patch fixes this issue by using console_flush_on_panic()
to flush to console.
After this patch, we can see all the log since the nmi_panic
in the panic console.
Tested-by: Adam Li <adam.li@amperecomputing.com>
Signed-off-by: Huang Shijie <shijie@os.amperecomputing.com>
---
v1 --> v2:
update this patch since the printk system is changed.
v1:https://lkml.iu.edu/hypermail/linux/kernel/2106.2/01703.html
---
arch/arm64/kernel/machine_kexec.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c
index e16b248699d5..e961464a881e 100644
--- a/arch/arm64/kernel/machine_kexec.c
+++ b/arch/arm64/kernel/machine_kexec.c
@@ -6,6 +6,7 @@
* Copyright (C) Huawei Futurewei Technologies.
*/
+#include <linux/console.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/kernel.h>
@@ -188,6 +189,8 @@ void machine_kexec(struct kimage *kimage)
"Some CPUs may be stale, kdump will be unreliable.\n");
pr_info("Bye!\n");
+ if (in_nmi())
+ console_flush_on_panic(CONSOLE_FLUSH_PENDING);
local_daif_mask();
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2022-04-24 7:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-24 15:19 Huang Shijie [this message]
2022-04-26 8:19 ` [PATCH v2] arm64: kexec: flush log to console in NMI context Petr Mladek
2022-04-26 16:43 ` Huang Shijie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220424151952.183208-1-shijie@os.amperecomputing.com \
--to=shijie@os.amperecomputing.com \
--cc=adam.li@amperecomputing.com \
--cc=catalin.marinas@arm.com \
--cc=darren@os.amperecomputing.com \
--cc=john.ogness@linutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pasha.tatashin@soleen.com \
--cc=patches@amperecomputing.com \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=will@kernel.org \
--cc=zwang@amperecomputing.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).