Commit 6dcbfe4f authored by Borislav Petkov's avatar Borislav Petkov Committed by Ingo Molnar

x86, AMD, MCE thresholding: Fix the MCi_MISCj iteration order

This fixes possible cases of not collecting valid error info in
the MCE error thresholding groups on F10h hardware.

The current code contains a subtle problem of checking only the
Valid bit of MSR0000_0413 (which is MC4_MISC0 - DRAM
thresholding group) in its first iteration and breaking out if
the bit is cleared.

But (!), this MSR contains an offset value, BlkPtr[31:24], which
points to the remaining MSRs in this thresholding group which
might contain valid information too. But if we bail out only
after we checked the valid bit in the first MSR and not the
block pointer too, we miss that other information.

The thing is, MC4_MISC0[BlkPtr] is not predicated on
MCi_STATUS[MiscV] or MC4_MISC0[Valid] and should be checked
prior to iterating over the MCI_MISCj thresholding group,
irrespective of the MC4_MISC0[Valid] setting.
Signed-off-by: default avatarBorislav Petkov <borislav.petkov@amd.com>
Cc: <stable@kernel.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent b62be8ea
...@@ -141,6 +141,7 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c) ...@@ -141,6 +141,7 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c)
address = (low & MASK_BLKPTR_LO) >> 21; address = (low & MASK_BLKPTR_LO) >> 21;
if (!address) if (!address)
break; break;
address += MCG_XBLK_ADDR; address += MCG_XBLK_ADDR;
} else } else
++address; ++address;
...@@ -148,12 +149,8 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c) ...@@ -148,12 +149,8 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c)
if (rdmsr_safe(address, &low, &high)) if (rdmsr_safe(address, &low, &high))
break; break;
if (!(high & MASK_VALID_HI)) { if (!(high & MASK_VALID_HI))
if (block) continue;
continue;
else
break;
}
if (!(high & MASK_CNTP_HI) || if (!(high & MASK_CNTP_HI) ||
(high & MASK_LOCKED_HI)) (high & MASK_LOCKED_HI))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment