Skip to contentSkip to conversation

x86/mce: Unify vendors grading logic and provide AMD machine error checks

PATCH In review Carlos Bilbao 2 participants 3 messages Mar 8, 2022 – Mar 9, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/mce: Unify vendors grading logic and provide 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. Furthermore, with the current implementation AMD MCEs have no support for the severities-coverage file. Adding new severities for AMD with the current logic would be too convoluted.

Fix the above issues including AMD severities to the severity table, in combination with Intel MCEs. Unify the severity grading logic of both vendors. Label the vendor-specific cases (e.g. cases with different registers) where checks cannot be implicit with the available features.

---
 arch/x86/include/asm/mce.h         |   7 ++
 arch/x86/kernel/cpu/mce/severity.c | 188 +++++++++++++++--------------
 2 files changed, 103 insertions(+), 92 deletions(-)
arch/x86/include/asm/mce.h +7 -0
index cc73061e7255..d83adc2da522 100644
@@ -50,6 +50,13 @@
 #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_T_DATA 0x4  /* Transaction type of error is Data */
+
+#define ERRORCODE_M_MSK GENMASK(7, 4)  /* Mask for memory transaction type */
+#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 +96 -92

264 lines not on this page · raw message

base-commit: 7f1b8e0d6360178e3527d4f14e6921c254a86035

Signature · 1 line
2.27.0
maintainer
#1 lore raw
Quoted 11 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. Furthermore, with the current implementation AMD MCEs have no support for the severities-coverage file. Adding new severities for AMD with the current logic would be too convoluted.

Fix the above issues including AMD severities to the severity table, in combination with Intel MCEs. Unify the severity grading logic of both vendors. Label the vendor-specific cases (e.g. cases with different registers) where checks cannot be implicit with the available features.

Quoted 5 lines
---
 arch/x86/include/asm/mce.h         |   7 ++
 arch/x86/kernel/cpu/mce/severity.c | 188 +++++++++++++++--------------
 2 files changed, 103 insertions(+), 92 deletions(-)

Sorry, maybe you're too new to this and you probably haven't read the old discussions we have had about the severity grading turd. In order to save you some time: adding more to that macro insanity is not going to happen.

The AMD severity grading functions are *actually* readable vs this abomination which I hate with passion.

If you want to add more logic, you should add to mce_severity_amd(), perhaps call other helper functions which grade based on a certain aspect of the error type, split the logic, use comments, etc, but *definitely* not this.

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#2 lore raw
Quoted 26 lines · Borislav Petkov
Quoted 11 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. Furthermore, with the current implementation AMD MCEs have no support for the severities-coverage file. Adding new severities for AMD with the current logic would be too convoluted.

Fix the above issues including AMD severities to the severity table, in combination with Intel MCEs. Unify the severity grading logic of both vendors. Label the vendor-specific cases (e.g. cases with different registers) where checks cannot be implicit with the available features.

Quoted 5 lines
---
 arch/x86/include/asm/mce.h         |   7 ++
 arch/x86/kernel/cpu/mce/severity.c | 188 +++++++++++++++--------------
 2 files changed, 103 insertions(+), 92 deletions(-)

Sorry, maybe you're too new to this and you probably haven't read the old discussions we have had about the severity grading turd. In order to save you some time: adding more to that macro insanity is not going to happen.

The AMD severity grading functions are *actually* readable vs this abomination which I hate with passion.

Quoted 7 lines

If you want to add more logic, you should add to mce_severity_amd(), perhaps call other helper functions which grade based on a certain aspect of the error type, split the logic, use comments, etc, but *definitely* not this.

Thx.

Understood, sending a new patch in that direction.

Thanks,
Carlos