diff mbox series

[2/2] x86/mce: Add messages for panic errors in AMD's MCE grading

Message ID 20220405183212.354606-3-carlos.bilbao@amd.com (mailing list archive)
State New, archived
Headers show
Series x86/mce: Simplify AMD MCEs severity grading and include messages for panic cases | expand

Commit Message

Carlos Bilbao April 5, 2022, 6:32 p.m. UTC
When a machine error is graded as PANIC by AMD grading logic, the MCE
handler calls mce_panic(). The notification chain does not come into effect
so the AMD EDAC driver does not decode the errors. In these cases, the
messages displayed to the user are more cryptic and miss information
that might be relevant, like the context in which the error took place.

Fix the above issue including messages on AMD's grading logic for machine
errors graded as PANIC.

Signed-off-by: Carlos Bilbao <carlos.bilbao@amd.com>
---
 arch/x86/kernel/cpu/mce/severity.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Yazen Ghannam April 10, 2022, 1:06 p.m. UTC | #1
On Tue, Apr 05, 2022 at 01:32:14PM -0500, Carlos Bilbao wrote:
> When a machine error is graded as PANIC by AMD grading logic, the MCE
> handler calls mce_panic(). The notification chain does not come into effect
> so the AMD EDAC driver does not decode the errors. In these cases, the
> messages displayed to the user are more cryptic and miss information
> that might be relevant, like the context in which the error took place.
> 
> Fix the above issue including messages on AMD's grading logic for machine
> errors graded as PANIC.
> 
> Signed-off-by: Carlos Bilbao <carlos.bilbao@amd.com>
> ---

Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com>

Thanks!

-Yazen
diff mbox series

Patch

diff --git a/arch/x86/kernel/cpu/mce/severity.c b/arch/x86/kernel/cpu/mce/severity.c
index 25aec5a27899..c09fa4f01616 100644
--- a/arch/x86/kernel/cpu/mce/severity.c
+++ b/arch/x86/kernel/cpu/mce/severity.c
@@ -306,6 +306,7 @@  static noinstr int error_context(struct mce *m, struct pt_regs *regs)
  */
 static noinstr int mce_severity_amd(struct mce *m, struct pt_regs *regs, char **msg, bool is_excp)
 {
+	char *panic_msg = NULL;
 	int ret;
 
 	/*
@@ -316,6 +317,7 @@  static noinstr int mce_severity_amd(struct mce *m, struct pt_regs *regs, char **
 
 	/* Processor Context Corrupt, no need to fumble too much, die! */
 	if (m->status & MCI_STATUS_PCC) {
+		panic_msg = "Processor Context Corrupt";
 		ret = MCE_PANIC_SEVERITY;
 		goto out_amd_severity;
 	}
@@ -339,20 +341,27 @@  static noinstr int mce_severity_amd(struct mce *m, struct pt_regs *regs, char **
 	 * system will not be able to recover.
 	 */
 	if ((m->status & MCI_STATUS_OVER) && !mce_flags.overflow_recov) {
+		panic_msg = "Overflowed uncorrected error without MCA Overflow Recovery";
 		ret = MCE_PANIC_SEVERITY;
 		goto out_amd_severity;
 	}
 
 	if (!mce_flags.succor) {
+		panic_msg = "Uncorrected error without MCA Recovery";
 		ret = MCE_PANIC_SEVERITY;
 		goto out_amd_severity;
 	}
 
-	if (error_context(m, regs) == IN_KERNEL)
+	if (error_context(m, regs) == IN_KERNEL) {
+		panic_msg = "Uncorrected unrecoverable error in kernel context";
 		ret = MCE_PANIC_SEVERITY;
+	}
 
 out_amd_severity:
 
+	if (msg && panic_msg)
+		*msg = panic_msg;
+
 	return ret;
 }