* [PATCH] arm64: traps: Dump registers prior to panic() in bad_mode()
@ 2020-06-15 11:34 Will Deacon
2020-06-15 13:55 ` Mark Rutland
0 siblings, 1 reply; 2+ messages in thread
From: Will Deacon @ 2020-06-15 11:34 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Mark Rutland, Will Deacon, Mark Brown, kernel-team,
Catalin Marinas
When panicing due to an unknown/unhandled exception at EL1, dump the
registers of the faulting context so that it's easier to figure out
what went wrong. In particular, this makes it a lot easier to debug
in-kernel BTI failures since it pretty-prints PSTATE.BTYPE in the crash
log.
Cc: Mark Brown <broonie@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
---
arch/arm64/kernel/traps.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index 50cc30acf106..f1869e5bd743 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -812,6 +812,8 @@ asmlinkage void bad_mode(struct pt_regs *regs, int reason, unsigned int esr)
pr_crit("Bad mode in %s handler detected on CPU%d, code 0x%08x -- %s\n",
handler[reason], smp_processor_id(), esr,
esr_get_class_string(esr));
+ if (regs)
+ __show_regs(regs);
local_daif_mask();
panic("bad mode");
--
2.27.0.290.gba653c62da-goog
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] arm64: traps: Dump registers prior to panic() in bad_mode()
2020-06-15 11:34 [PATCH] arm64: traps: Dump registers prior to panic() in bad_mode() Will Deacon
@ 2020-06-15 13:55 ` Mark Rutland
0 siblings, 0 replies; 2+ messages in thread
From: Mark Rutland @ 2020-06-15 13:55 UTC (permalink / raw)
To: Will Deacon; +Cc: Catalin Marinas, Mark Brown, kernel-team, linux-arm-kernel
On Mon, Jun 15, 2020 at 12:34:58PM +0100, Will Deacon wrote:
> When panicing due to an unknown/unhandled exception at EL1, dump the
> registers of the faulting context so that it's easier to figure out
> what went wrong. In particular, this makes it a lot easier to debug
> in-kernel BTI failures since it pretty-prints PSTATE.BTYPE in the crash
> log.
>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Signed-off-by: Will Deacon <will@kernel.org>
> ---
> arch/arm64/kernel/traps.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
> index 50cc30acf106..f1869e5bd743 100644
> --- a/arch/arm64/kernel/traps.c
> +++ b/arch/arm64/kernel/traps.c
> @@ -812,6 +812,8 @@ asmlinkage void bad_mode(struct pt_regs *regs, int reason, unsigned int esr)
> pr_crit("Bad mode in %s handler detected on CPU%d, code 0x%08x -- %s\n",
> handler[reason], smp_processor_id(), esr,
> esr_get_class_string(esr));
> + if (regs)
> + __show_regs(regs);
For bad_mode() regs is never NULL, so you don't need to check that here.
Otherwise, this looks sane to me, so with the redundant check removed:
Acked-by: Mark Rutland <mark.rutland@arm.con>
Mark.
>
> local_daif_mask();
> panic("bad mode");
> --
> 2.27.0.290.gba653c62da-goog
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-15 13:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-15 11:34 [PATCH] arm64: traps: Dump registers prior to panic() in bad_mode() Will Deacon
2020-06-15 13:55 ` Mark Rutland
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).