Skip to content

Commit dcc960b

Browse files
qzhuo2suryasaimadhu
authored andcommitted
EDAC, sb_edac: Return early on ADDRV bit and address type test
Users of the mce_register_decode_chain() are called for every logged error. EDAC drivers should check: 1) Is this a memory error? [bit 7 in status register] 2) Is there a valid address? [bit 58 in status register] 3) Is the address a system address? [bitfield 8:6 in misc register] The sb_edac driver performed test "1" twice. Waited far too long to perform check "2". Didn't do check "3" at all. Fix it by moving the test for valid address from sbridge_mce_output_error() into sbridge_mce_check_error() and add a test for the type immediately after. Delete the redundant check for the type of the error from sbridge_mce_output_error(). Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com> Cc: Aristeu Rozanski <aris@redhat.com> Cc: Mauro Carvalho Chehab <mchehab@kernel.org> Cc: Qiuxu Zhuo <qiuxu.zhuo@intel.com> Cc: linux-edac <linux-edac@vger.kernel.org> Link: http://lkml.kernel.org/r/20180907230828.13901-2-tony.luck@intel.com [ Re-word commit message. ] Signed-off-by: Tony Luck <tony.luck@intel.com> Signed-off-by: Borislav Petkov <bp@suse.de>
1 parent 528d132 commit dcc960b

File tree

1 file changed

+35
-33
lines changed

1 file changed

+35
-33
lines changed

drivers/edac/sb_edac.c

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2911,35 +2911,27 @@ static void sbridge_mce_output_error(struct mem_ctl_info *mci,
29112911
* cccc = channel
29122912
* If the mask doesn't match, report an error to the parsing logic
29132913
*/
2914-
if (! ((errcode & 0xef80) == 0x80)) {
2915-
optype = "Can't parse: it is not a mem";
2916-
} else {
2917-
switch (optypenum) {
2918-
case 0:
2919-
optype = "generic undef request error";
2920-
break;
2921-
case 1:
2922-
optype = "memory read error";
2923-
break;
2924-
case 2:
2925-
optype = "memory write error";
2926-
break;
2927-
case 3:
2928-
optype = "addr/cmd error";
2929-
break;
2930-
case 4:
2931-
optype = "memory scrubbing error";
2932-
break;
2933-
default:
2934-
optype = "reserved";
2935-
break;
2936-
}
2914+
switch (optypenum) {
2915+
case 0:
2916+
optype = "generic undef request error";
2917+
break;
2918+
case 1:
2919+
optype = "memory read error";
2920+
break;
2921+
case 2:
2922+
optype = "memory write error";
2923+
break;
2924+
case 3:
2925+
optype = "addr/cmd error";
2926+
break;
2927+
case 4:
2928+
optype = "memory scrubbing error";
2929+
break;
2930+
default:
2931+
optype = "reserved";
2932+
break;
29372933
}
29382934

2939-
/* Only decode errors with an valid address (ADDRV) */
2940-
if (!GET_BITFIELD(m->status, 58, 58))
2941-
return;
2942-
29432935
if (pvt->info.type == KNIGHTS_LANDING) {
29442936
if (channel == 14) {
29452937
edac_dbg(0, "%s%s err_code:%04x:%04x EDRAM bank %d\n",
@@ -3045,17 +3037,11 @@ static int sbridge_mce_check_error(struct notifier_block *nb, unsigned long val,
30453037
{
30463038
struct mce *mce = (struct mce *)data;
30473039
struct mem_ctl_info *mci;
3048-
struct sbridge_pvt *pvt;
30493040
char *type;
30503041

30513042
if (edac_get_report_status() == EDAC_REPORTING_DISABLED)
30523043
return NOTIFY_DONE;
30533044

3054-
mci = get_mci_for_node_id(mce->socketid, IMC0);
3055-
if (!mci)
3056-
return NOTIFY_DONE;
3057-
pvt = mci->pvt_info;
3058-
30593045
/*
30603046
* Just let mcelog handle it if the error is
30613047
* outside the memory controller. A memory error
@@ -3065,6 +3051,22 @@ static int sbridge_mce_check_error(struct notifier_block *nb, unsigned long val,
30653051
if ((mce->status & 0xefff) >> 7 != 1)
30663052
return NOTIFY_DONE;
30673053

3054+
/* Check ADDRV bit in STATUS */
3055+
if (!GET_BITFIELD(mce->status, 58, 58))
3056+
return NOTIFY_DONE;
3057+
3058+
/* Check MISCV bit in STATUS */
3059+
if (!GET_BITFIELD(mce->status, 59, 59))
3060+
return NOTIFY_DONE;
3061+
3062+
/* Check address type in MISC (physical address only) */
3063+
if (GET_BITFIELD(mce->misc, 6, 8) != 2)
3064+
return NOTIFY_DONE;
3065+
3066+
mci = get_mci_for_node_id(mce->socketid, IMC0);
3067+
if (!mci)
3068+
return NOTIFY_DONE;
3069+
30683070
if (mce->mcgstatus & MCG_STATUS_MCIP)
30693071
type = "Exception";
30703072
else

0 commit comments

Comments
 (0)