x86/mce: Cover grading of AMD machine error checks
Subsystems (3)
PATCH 1/1 x86/mce: Cover grading of AMD machine error checks
AMD's severity grading covers very few machine errors. In the graded cases there are no user-readable messages, complicating debugging of critical hardware errors.
Fix the above issues extending the current grading logic for AMD with cases not previously considered and their corresponding messages.
--- arch/x86/include/asm/mce.h | 6 + arch/x86/kernel/cpu/mce/severity.c | 232 +++++++++++++++++++++++++---- 2 files changed, 205 insertions(+), 33 deletions(-)
arch/x86/include/asm/mce.h +6 -0
@@ -50,6 +50,12 @@#define MCI_STATUS_POISON BIT_ULL(43)/* access poisonous data */ #define MCI_STATUS_SCRUB BIT_ULL(40)/* Error detected during scrub operation */ +/* AMD Error codes from PPR(s) section 3.1 Machine Check Architecture */ +#define ERRORCODE_T_MSK GENMASK(3, 2)/* Mask for transaction type bits */ +#define ERRORCODE_M_MSK GENMASK(7, 4)/* Mask for memory transaction type */ +#define ERRORCODE_T_DATA 0x4/* Transaction type of error is Data */ +#define ERRORCODE_M_FETCH 0x50/* Memory transaction type of error is Instruction Fetch */ +/* * McaX field if set indicates a given bank supports MCA extensions: * - Deferred error interrupt type is specifiable by bank.
arch/x86/kernel/cpu/mce/severity.c +199 -33
258 lines not on this page · raw message
base-commit: 7f1b8e0d6360178e3527d4f14e6921c254a86035
Signature · 1 line
2.27.0
Borislav Petkov
maintainerDefinitely a step in the right direction.
Now...
Quoted 3 lines · Carlos Bilbao
AMD's severity grading covers very few machine errors. In the graded cases there are no user-readable messages, complicating debugging of critical hardware errors.
That's too generic. What is the actual use case here you're spending all this time for?
Quoted 8 lines
Fix the above issues extending the current grading logic for AMD with cases not previously considered and their corresponding messages.
Signed-off-by Carlos Bilbao <[email protected]>--- arch/x86/include/asm/mce.h | 6 + arch/x86/kernel/cpu/mce/severity.c | 232 +++++++++++++++++++++++++---- 2 files changed, 205 insertions(+), 33 deletions(-)
Now, looking at the whole thing, AFAICT all you're interested in is getting some strings out from those error types. But but, we already have something like that. That's even mentioned in the patch:
arch/x86/kernel/cpu/mce/severity.c static __always_inline int mce_severity_amd_smca(struct mce *m, enum context err · line 494
Quoted 2 lines
arch/x86/kernel/cpu/mce/severity.c +2
-0+* Default return values. The poll handler catches these and passes +* responsibility of decoding them to EDAC
So there's a big fat module mce_amd.c which does convert MCEs to strings. So why can't that be used and extended instead of adding more strings to more places in the kernel?
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteQuoted 4 lines · Borislav Petkov
Definitely a step in the right direction.
Now...
Quoted 8 lines
Quoted 3 lines · Carlos Bilbao
AMD's severity grading covers very few machine errors. In the graded cases there are no user-readable messages, complicating debugging of critical hardware errors.
That's too generic. What is the actual use case here you're spending all this time for?
We will cover grading of MCEs like deferred memory scrub errors, attempts to access poisonous data, etc. I could list all new covered cases in the commit message if you think that'd be positive.
Quoted 13 lines
Quoted 8 lines
Fix the above issues extending the current grading logic for AMD with cases not previously considered and their corresponding messages.
Signed-off-by Carlos Bilbao <[email protected]>--- arch/x86/include/asm/mce.h | 6 + arch/x86/kernel/cpu/mce/severity.c | 232 +++++++++++++++++++++++++---- 2 files changed, 205 insertions(+), 33 deletions(-)Now, looking at the whole thing, AFAICT all you're interested in is getting some strings out from those error types. But but, we already have something like that. That's even mentioned in the patch:
Quoted 9 lines
arch/x86/kernel/cpu/mce/severity.c static __always_inline int mce_severity_amd_smca(struct mce *m, enum context err · line 494
Quoted 2 lines
arch/x86/kernel/cpu/mce/severity.c +2
-0+* Default return values. The poll handler catches these and passes +* responsibility of decoding them to EDAC So there's a big fat module
mce_amd.cwhich does convert MCEs to strings. So why can't that be used and extended instead of adding more strings to more places in the kernel?Thx.
The severity grading logic has a double functionality: (1) Grade the machine errors and (2) Assign them a severity message. The first task is arguably more important because depending on the severity we assign, the MCE handler do_machine_check() will do things differently.
The part of this patch that grades new errors is needed for (1). But -as you mention- why do we need these new strings if we have the EDAC driver?
If we grade the error as a PANIC, the handler will not notify EDAC, and the kernel will use our new severity messages when displaying the error with mce_panic().
If the machine error is not graded as PANIC, the notification chain will come into play, and EDAC will eventually decode the machine errors without using the severity message. Hence, you have a good point, these new strings will be unnecessary -We should send a new version of the patch that only includes msgs for PANIC cases. We probably won't need helper functions by then. I'll also take some time to think of any other error cases we might not be covering yet.
Hope that helps clarify,
Carlos
Borislav Petkov
maintainerQuoted 3 lines · Carlos Bilbao
We will cover grading of MCEs like deferred memory scrub errors, attempts to access poisonous data, etc. I could list all new covered cases in the commit message if you think that'd be positive.
So no actual use case - you want to grade error severity for all types of MCEs.
Quoted 1 line
Hope that helps clarify,
Yes, it does a bit.
It sounds to me like you want to do at least two patches:
1. Extend the severity grading function with the new types of errors
2. Add string descriptions of the error types mce_severity_amd() looks at, so that mce_panic() issues them.
I.e., you want to decode the fatal MCEs which panic the machine.
In general, what would help is if you think about what you're trying to achieve and write it down first. How to achieve that we can figure out later.
What happens now is you send me a patch and I'm trying to decipher from the code why you're doing what you're doing. Which is kinda backwards if you think about it...
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteQuoted 21 lines · Borislav Petkov
Quoted 3 lines · Carlos Bilbao
We will cover grading of MCEs like deferred memory scrub errors, attempts to access poisonous data, etc. I could list all new covered cases in the commit message if you think that'd be positive.
So no actual use case - you want to grade error severity for all types of MCEs.
Quoted 1 line
Hope that helps clarify,
Yes, it does a bit.
It sounds to me like you want to do at least two patches:
1. Extend the severity grading function with the new types of errors
2. Add string descriptions of the error types
mce_severity_amd()looks at, so thatmce_panic()issues them.I.e., you want to decode the fatal MCEs which panic the machine.
Quoted 8 lines
In general, what would help is if you think about what you're trying to achieve and write it down first. How to achieve that we can figure out later.
What happens now is you send me a patch and I'm trying to decipher from the code why you're doing what you're doing. Which is kinda backwards if you think about it...
Glad we are on the same page now. I will prepare a pachset and include more informative commit messages.
Thanks,
Carlos