From patchwork Wed Nov 6 09:33:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 11229811 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 799E015AB for ; Wed, 6 Nov 2019 09:34:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 399DE217F4 for ; Wed, 6 Nov 2019 09:34:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="Lu6pg/4Q"; dkim=pass (1024-bit key) header.d=marvell.onmicrosoft.com header.i=@marvell.onmicrosoft.com header.b="MEqb3uUR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726969AbfKFJdS (ORCPT ); Wed, 6 Nov 2019 04:33:18 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:28584 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725868AbfKFJdR (ORCPT ); Wed, 6 Nov 2019 04:33:17 -0500 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA69UQxU002783; Wed, 6 Nov 2019 01:33:06 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=AqbSREJcrO5nwEtUWH5vMsLEAS0gOaUFemX+87Ba9RA=; b=Lu6pg/4QG8zeCrMPaiqjoDYhZ8GFWR6P2vVk9bZvBnSFSfpOrDie+Hk+TWw6ujhG2afi ql5cqOBdrtR/Y/qvDmp7sxH1N1OL0xjHbk6q4e+/YI1c/OiJposxr2u4BPiR8Tf0n8Vh NwrdTNFzLfeHdtCzeVfzoYqRgo1eNndpWC/sTUNFjmEtKIFpQ6Y6yKIYJvc2GaWA/oB5 8kDWcCsyQDoUmW9lMs1ljf4xGi2T+/bfNWqscaYP6imiyzidDWOJ5IWorRi8f3/24tIa fevW9bxbL2Z6RLG/bjCSKGMFErhBDQTgd6SKbI5xOV4ab3fwto1yhTpx2Sz5r6CvYyZ2 jA== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2w3eud3c64-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2019 01:33:06 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Nov 2019 01:33:05 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.50) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 6 Nov 2019 01:33:05 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e1A+sEaxCiq64mc4VIzptnBlMqfOkKa1t744xICe9WxCjo+8uEsM49/VD3u5j2/lxruMqMYxw9aQDtpZdJ1/ykQMs1JzpFMEpKl/6Iutz3+RdsC0IAniBkjgPvCHSEIonWwTRWcxU9ZDLLUW1o1Q+T49JcunYh46k9pSVJuE2Z4XPvwq7u8ETURMCwIwTsxc3fNn7zLr8q+8LeSyGHyhiilG+0B0WZzGwsp5UGaNbONTV7RykWqFum+nxi4ybPv0Cg0IWuOyf9MszPGc+/ZS9CT5zgwwHEJvOMtWGaQzRL7KNK4csUdnJzskIrPSZVVkvkrMo7+FkSQ9mM0CQ+1EWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AqbSREJcrO5nwEtUWH5vMsLEAS0gOaUFemX+87Ba9RA=; b=GdpP39+8KT5tXIyzdHLQelfpI/0k6E56wnN6IGtCIznLFMruQOXZ8YKQ3PLHSEb2TDR856KVVpS8wYCw0Sh85F9Q6pvFwtrq97rO1sWDCMhIJIO35dEEWptYaW5BMlQUfYk2Kw6bUwqIi6EB3sraI+cky9mMW6AC8a8xHbhhIFAxpYOfag22PftNrUqURZ1hdU6fo+qzCD4oXpCmKVIcMqExQWoYCrRDWannJ/FzqiGwMru6iNbqOC185jGRzrmo9QgbAr8EFw7Yd5nH6lwQboMPg3Pg50hGX+CqbK4dSNcv6sOS7eKSQCPQNb0Jr86hFZCEJy/iznfoOsMLcIjazA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AqbSREJcrO5nwEtUWH5vMsLEAS0gOaUFemX+87Ba9RA=; b=MEqb3uURY3x0ePXIazTWdcr9HcJrDERXEVJnHA/FxHW3niaqlCtijLW/I4QvXcp124bAlnZAYCTfxt2eWlNYctDlTUUIvLH9vWnrua65EXqKfCpoUWE+8LA4J6wwUZV4v2qmwRpvWhtOyiKHXTG3HWXPvTMgo4TE56nAJsiNoV8= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB3165.namprd18.prod.outlook.com (10.255.236.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Wed, 6 Nov 2019 09:33:02 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6%6]) with mapi id 15.20.2430.020; Wed, 6 Nov 2019 09:33:02 +0000 From: Robert Richter To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck , Jason Baron , Tero Kristo CC: James Morse , Robert Richter , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Qiuxu Zhuo Subject: [PATCH v2 01/20] EDAC: Replace EDAC_DIMM_PTR() macro with edac_get_dimm() function Thread-Topic: [PATCH v2 01/20] EDAC: Replace EDAC_DIMM_PTR() macro with edac_get_dimm() function Thread-Index: AQHVlIUvhVbkmNwWpkSXfR2CjynYLw== Date: Wed, 6 Nov 2019 09:33:02 +0000 Message-ID: <20191106093239.25517-2-rrichter@marvell.com> References: <20191106093239.25517-1-rrichter@marvell.com> In-Reply-To: <20191106093239.25517-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0287.eurprd05.prod.outlook.com (2603:10a6:7:93::18) To MN2PR18MB3408.namprd18.prod.outlook.com (2603:10b6:208:165::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [31.208.96.227] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: fab27e4c-34d4-45bf-a12e-08d7629c519f x-ms-traffictypediagnostic: MN2PR18MB3165: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:154; x-forefront-prvs: 02135EB356 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(396003)(376002)(39860400002)(346002)(136003)(199004)(189003)(52116002)(305945005)(6486002)(76176011)(30864003)(71190400001)(71200400001)(256004)(11346002)(446003)(7736002)(14444005)(6436002)(4326008)(6512007)(66446008)(66556008)(66476007)(66946007)(64756008)(5660300002)(1076003)(476003)(6116002)(3846002)(110136005)(54906003)(36756003)(2906002)(8676002)(99286004)(81166006)(81156014)(316002)(8936002)(50226002)(486006)(6506007)(386003)(102836004)(66066001)(2616005)(86362001)(478600001)(25786009)(186003)(14454004)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR18MB3165;H:MN2PR18MB3408.namprd18.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: pzuxCEANNhAaLeK9lENWrGHTFhW+WXXtbTvD3B3KGq8Y1rzH+b08Rc8g185XKS4DMYUvU9ieqECOixq6Ta+KUXMmDbitnrjK1/pK4l8kknDlYykNoOPVxR8N1gL5Sn28I1BjaBFRIWMWYArRPKrBlHNoafiJklhuX+nRlu5uVVpTmjWLorTMK3M5KlsV5ZN4MKbQYPaqwbwftYK/FXrCHY18lkgp6AvL45KgykgmcM/aDqriW2OLFyGBa8c268cqSlUX4BP7CYyqJ2fniCO8OmacX0Ou7XqbuNZQCdoTEhms1+/M+iHtpl8KixeBoZbj/Hg0PHYxlj7+9yz/efRuSlXryql83esoKDg31W7vzyn5S2DX9xz5xDmk1iGA3JGSpwABMoa5lTO8J3fiZcni/eoknbGr0G0HivkNhxzL/oA4meR2nOhi1L2A8+Zu4FWT MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: fab27e4c-34d4-45bf-a12e-08d7629c519f X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 09:33:02.3278 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: gv5+XaKLkYmXLv7GrdqocHtEHXPDTVPjjv6TjcJcpziGGldT8x/f7+sOVnZHQVuU3ak2PZMBdMDRK/utLT0PGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3165 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-06_02:2019-11-06,2019-11-06 signatures=0 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org The EDAC_DIMM_PTR() macro takes 3 arguments from struct mem_ctl_info. Clean up this interface to only pass the mci struct and replace this macro with the new function edac_get_dimm(). Also introduce the edac_get_dimm_by_index() function for later use. This allows it to get a dimm pointer only by a given index. This can be useful if the dimm's position within the layers of the memory controller or the exact size of the layers are unknown. Small style changes made for some hunks after applying the semantic patch. Semantic patch used: @@ expression mci, a, b,c; @@ -EDAC_DIMM_PTR(mci->layers, mci->dimms, mci->n_layers, a, b, c) +edac_get_dimm(mci, a, b, c) Signed-off-by: Robert Richter Reviewed-by: Mauro Carvalho Chehab --- drivers/edac/ghes_edac.c | 7 +-- drivers/edac/i10nm_base.c | 3 +- drivers/edac/i3200_edac.c | 3 +- drivers/edac/i5000_edac.c | 5 +-- drivers/edac/i5100_edac.c | 3 +- drivers/edac/i5400_edac.c | 3 +- drivers/edac/i7300_edac.c | 3 +- drivers/edac/i7core_edac.c | 3 +- drivers/edac/ie31200_edac.c | 7 +-- drivers/edac/pnd2_edac.c | 4 +- drivers/edac/sb_edac.c | 2 +- drivers/edac/skx_base.c | 3 +- drivers/edac/ti_edac.c | 2 +- include/linux/edac.h | 88 ++++++++++++++++++++++++------------- 14 files changed, 74 insertions(+), 62 deletions(-) diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c index 5da85ef7966d..d92cd99081d2 100644 --- a/drivers/edac/ghes_edac.c +++ b/drivers/edac/ghes_edac.c @@ -106,9 +106,7 @@ static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg) if (dh->type == DMI_ENTRY_MEM_DEVICE) { struct memdev_dmi_entry *entry = (struct memdev_dmi_entry *)dh; - struct dimm_info *dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms, - mci->n_layers, - dimm_fill->count, 0, 0); + struct dimm_info *dimm = edac_get_dimm(mci, dimm_fill->count, 0, 0); u16 rdr_mask = BIT(7) | BIT(13); if (entry->size == 0xffff) { @@ -543,8 +541,7 @@ int ghes_edac_register(struct ghes *ghes, struct device *dev) dimm_fill.mci = mci; dmi_walk(ghes_edac_dmidecode, &dimm_fill); } else { - struct dimm_info *dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms, - mci->n_layers, 0, 0, 0); + struct dimm_info *dimm = edac_get_dimm(mci, 0, 0, 0); dimm->nr_pages = 1; dimm->grain = 128; diff --git a/drivers/edac/i10nm_base.c b/drivers/edac/i10nm_base.c index c370d5457e6b..059eccf0582b 100644 --- a/drivers/edac/i10nm_base.c +++ b/drivers/edac/i10nm_base.c @@ -154,8 +154,7 @@ static int i10nm_get_dimm_config(struct mem_ctl_info *mci) ndimms = 0; for (j = 0; j < I10NM_NUM_DIMMS; j++) { - dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms, - mci->n_layers, i, j, 0); + dimm = edac_get_dimm(mci, i, j, 0); mtr = I10NM_GET_DIMMMTR(imc, i, j); mcddrtcfg = I10NM_GET_MCDDRTCFG(imc, i, j); edac_dbg(1, "dimmmtr 0x%x mcddrtcfg 0x%x (mc%d ch%d dimm%d)\n", diff --git a/drivers/edac/i3200_edac.c b/drivers/edac/i3200_edac.c index 299b441647cd..432b375a4075 100644 --- a/drivers/edac/i3200_edac.c +++ b/drivers/edac/i3200_edac.c @@ -392,8 +392,7 @@ static int i3200_probe1(struct pci_dev *pdev, int dev_idx) unsigned long nr_pages; for (j = 0; j < nr_channels; j++) { - struct dimm_info *dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms, - mci->n_layers, i, j, 0); + struct dimm_info *dimm = edac_get_dimm(mci, i, j, 0); nr_pages = drb_to_nr_pages(drbs, stacked, j, i); if (nr_pages == 0) diff --git a/drivers/edac/i5000_edac.c b/drivers/edac/i5000_edac.c index 078a7351bf05..1a6f69c859ab 100644 --- a/drivers/edac/i5000_edac.c +++ b/drivers/edac/i5000_edac.c @@ -1275,9 +1275,8 @@ static int i5000_init_csrows(struct mem_ctl_info *mci) if (!MTR_DIMMS_PRESENT(mtr)) continue; - dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms, mci->n_layers, - channel / MAX_BRANCHES, - channel % MAX_BRANCHES, slot); + dimm = edac_get_dimm(mci, channel / MAX_BRANCHES, + channel % MAX_BRANCHES, slot); csrow_megs = pvt->dimm_info[slot][channel].megabytes; dimm->grain = 8; diff --git a/drivers/edac/i5100_edac.c b/drivers/edac/i5100_edac.c index 12bebecb203b..134586753311 100644 --- a/drivers/edac/i5100_edac.c +++ b/drivers/edac/i5100_edac.c @@ -858,8 +858,7 @@ static void i5100_init_csrows(struct mem_ctl_info *mci) if (!npages) continue; - dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms, mci->n_layers, - chan, rank, 0); + dimm = edac_get_dimm(mci, chan, rank, 0); dimm->nr_pages = npages; dimm->grain = 32; diff --git a/drivers/edac/i5400_edac.c b/drivers/edac/i5400_edac.c index 8c86c6fd7da7..f131c05ade9f 100644 --- a/drivers/edac/i5400_edac.c +++ b/drivers/edac/i5400_edac.c @@ -1187,8 +1187,7 @@ static int i5400_init_dimms(struct mem_ctl_info *mci) if (!MTR_DIMMS_PRESENT(mtr)) continue; - dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms, mci->n_layers, - channel / 2, channel % 2, slot); + dimm = edac_get_dimm(mci, channel / 2, channel % 2, slot); size_mb = pvt->dimm_info[slot][channel].megabytes; diff --git a/drivers/edac/i7300_edac.c b/drivers/edac/i7300_edac.c index 447d357c7a67..2e9bbe56cde9 100644 --- a/drivers/edac/i7300_edac.c +++ b/drivers/edac/i7300_edac.c @@ -794,8 +794,7 @@ static int i7300_init_csrows(struct mem_ctl_info *mci) for (ch = 0; ch < max_channel; ch++) { int channel = to_channel(ch, branch); - dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms, - mci->n_layers, branch, ch, slot); + dimm = edac_get_dimm(mci, branch, ch, slot); dinfo = &pvt->dimm_info[slot][channel]; diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c index a71cca6eeb33..b3135b208f9a 100644 --- a/drivers/edac/i7core_edac.c +++ b/drivers/edac/i7core_edac.c @@ -585,8 +585,7 @@ static int get_dimm_config(struct mem_ctl_info *mci) if (!DIMM_PRESENT(dimm_dod[j])) continue; - dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms, mci->n_layers, - i, j, 0); + dimm = edac_get_dimm(mci, i, j, 0); banks = numbank(MC_DOD_NUMBANK(dimm_dod[j])); ranks = numrank(MC_DOD_NUMRANK(dimm_dod[j])); rows = numrow(MC_DOD_NUMROW(dimm_dod[j])); diff --git a/drivers/edac/ie31200_edac.c b/drivers/edac/ie31200_edac.c index d26300f9cb07..4f65073f230b 100644 --- a/drivers/edac/ie31200_edac.c +++ b/drivers/edac/ie31200_edac.c @@ -490,9 +490,7 @@ static int ie31200_probe1(struct pci_dev *pdev, int dev_idx) if (dimm_info[j][i].dual_rank) { nr_pages = nr_pages / 2; - dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms, - mci->n_layers, (i * 2) + 1, - j, 0); + dimm = edac_get_dimm(mci, (i * 2) + 1, j, 0); dimm->nr_pages = nr_pages; edac_dbg(0, "set nr pages: 0x%lx\n", nr_pages); dimm->grain = 8; /* just a guess */ @@ -503,8 +501,7 @@ static int ie31200_probe1(struct pci_dev *pdev, int dev_idx) dimm->dtype = DEV_UNKNOWN; dimm->edac_mode = EDAC_UNKNOWN; } - dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms, - mci->n_layers, i * 2, j, 0); + dimm = edac_get_dimm(mci, i * 2, j, 0); dimm->nr_pages = nr_pages; edac_dbg(0, "set nr pages: 0x%lx\n", nr_pages); dimm->grain = 8; /* same guess */ diff --git a/drivers/edac/pnd2_edac.c b/drivers/edac/pnd2_edac.c index b1193be1ef1d..933f7722b893 100644 --- a/drivers/edac/pnd2_edac.c +++ b/drivers/edac/pnd2_edac.c @@ -1231,7 +1231,7 @@ static void apl_get_dimm_config(struct mem_ctl_info *mci) if (!(chan_mask & BIT(i))) continue; - dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms, mci->n_layers, i, 0, 0); + dimm = edac_get_dimm(mci, i, 0, 0); if (!dimm) { edac_dbg(0, "No allocated DIMM for channel %d\n", i); continue; @@ -1311,7 +1311,7 @@ static void dnv_get_dimm_config(struct mem_ctl_info *mci) if (!ranks_of_dimm[j]) continue; - dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms, mci->n_layers, i, j, 0); + dimm = edac_get_dimm(mci, i, j, 0); if (!dimm) { edac_dbg(0, "No allocated DIMM for channel %d DIMM %d\n", i, j); continue; diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c index a2fd39d330d6..4957e8ee1879 100644 --- a/drivers/edac/sb_edac.c +++ b/drivers/edac/sb_edac.c @@ -1621,7 +1621,7 @@ static int __populate_dimms(struct mem_ctl_info *mci, } for (j = 0; j < max_dimms_per_channel; j++) { - dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms, mci->n_layers, i, j, 0); + dimm = edac_get_dimm(mci, i, j, 0); if (pvt->info.type == KNIGHTS_LANDING) { pci_read_config_dword(pvt->knl.pci_channel[i], knl_mtr_reg, &mtr); diff --git a/drivers/edac/skx_base.c b/drivers/edac/skx_base.c index a8853e724d1f..83545b4facb7 100644 --- a/drivers/edac/skx_base.c +++ b/drivers/edac/skx_base.c @@ -189,8 +189,7 @@ static int skx_get_dimm_config(struct mem_ctl_info *mci) pci_read_config_dword(imc->chan[i].cdev, 0x8C, &amap); pci_read_config_dword(imc->chan[i].cdev, 0x400, &mcddrtcfg); for (j = 0; j < SKX_NUM_DIMMS; j++) { - dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms, - mci->n_layers, i, j, 0); + dimm = edac_get_dimm(mci, i, j, 0); pci_read_config_dword(imc->chan[i].cdev, 0x80 + 4 * j, &mtr); if (IS_DIMM_PRESENT(mtr)) { diff --git a/drivers/edac/ti_edac.c b/drivers/edac/ti_edac.c index 6ac26d1b929f..8be3e89a510e 100644 --- a/drivers/edac/ti_edac.c +++ b/drivers/edac/ti_edac.c @@ -135,7 +135,7 @@ static void ti_edac_setup_dimm(struct mem_ctl_info *mci, u32 type) u32 val; u32 memsize; - dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms, mci->n_layers, 0, 0, 0); + dimm = edac_get_dimm(mci, 0, 0, 0); val = ti_edac_readl(edac, EMIF_SDRAM_CONFIG); diff --git a/include/linux/edac.h b/include/linux/edac.h index c19483b90079..696bfb684d92 100644 --- a/include/linux/edac.h +++ b/include/linux/edac.h @@ -403,37 +403,6 @@ struct edac_mc_layer { __i; \ }) -/** - * EDAC_DIMM_PTR - Macro responsible to get a pointer inside a pointer array - * for the element given by [layer0,layer1,layer2] position - * - * @layers: a struct edac_mc_layer array, describing how many elements - * were allocated for each layer - * @var: name of the var where we want to get the pointer - * (like mci->dimms) - * @nlayers: Number of layers at the @layers array - * @layer0: layer0 position - * @layer1: layer1 position. Unused if n_layers < 2 - * @layer2: layer2 position. Unused if n_layers < 3 - * - * For 1 layer, this macro returns "var[layer0]"; - * - * For 2 layers, this macro is similar to allocate a bi-dimensional array - * and to return "var[layer0][layer1]"; - * - * For 3 layers, this macro is similar to allocate a tri-dimensional array - * and to return "var[layer0][layer1][layer2]"; - */ -#define EDAC_DIMM_PTR(layers, var, nlayers, layer0, layer1, layer2) ({ \ - typeof(*var) __p; \ - int ___i = EDAC_DIMM_OFF(layers, nlayers, layer0, layer1, layer2); \ - if (___i < 0) \ - __p = NULL; \ - else \ - __p = (var)[___i]; \ - __p; \ -}) - struct dimm_info { struct device dev; @@ -669,4 +638,61 @@ struct mem_ctl_info { bool fake_inject_ue; u16 fake_inject_count; }; + +/** + * edac_get_dimm_by_index - Get DIMM info from a memory controller + * given by an index + * + * @mci: a struct mem_ctl_info + * @index: index in the memory controller's DIMM array + * + * Returns a struct dimm_info* or NULL on failure. + */ +static inline struct dimm_info * +edac_get_dimm_by_index(struct mem_ctl_info *mci, int index) +{ + if (index < 0 || index >= mci->tot_dimms) + return NULL; + + return mci->dimms[index]; +} + +/** + * edac_get_dimm - Get DIMM info from a memory controller given by + * [layer0,layer1,layer2] position + * + * @mci: a struct mem_ctl_info + * @layer0: layer0 position + * @layer1: layer1 position. Unused if n_layers < 2 + * @layer2: layer2 position. Unused if n_layers < 3 + * + * For 1 layer, this function returns "dimms[layer0]"; + * + * For 2 layers, this function is similar to allocate a bi-dimensional + * array and to return "dimms[layer0][layer1]"; + * + * For 3 layers, this function is similar to allocate a tri-dimensional array + * and to return "dimms[layer0][layer1][layer2]"; + */ +static inline struct dimm_info *edac_get_dimm(struct mem_ctl_info *mci, + int layer0, int layer1, int layer2) +{ + int index; + + if (layer0 < 0 + || (mci->n_layers > 1 && layer1 < 0) + || (mci->n_layers > 2 && layer2 < 0)) + return NULL; + + index = layer0; + + if (mci->n_layers > 1) + index = index * mci->layers[1].size + layer1; + + if (mci->n_layers > 2) + index = index * mci->layers[2].size + layer2; + + return edac_get_dimm_by_index(mci, index); +} + #endif From patchwork Wed Nov 6 09:33:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 11229771 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 503E01575 for ; Wed, 6 Nov 2019 09:33:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1A2922187F for ; Wed, 6 Nov 2019 09:33:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="FV6H3dx9"; dkim=pass (1024-bit key) header.d=marvell.onmicrosoft.com header.i=@marvell.onmicrosoft.com header.b="I331/8wH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725906AbfKFJdQ (ORCPT ); Wed, 6 Nov 2019 04:33:16 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:23972 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725856AbfKFJdQ (ORCPT ); Wed, 6 Nov 2019 04:33:16 -0500 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA69Unxj003167; Wed, 6 Nov 2019 01:33:08 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=DSDXJqBl84EvmUJYBfU1UHYK2SRl9BBOA2sWchkTMjU=; b=FV6H3dx9duVnaIymdVo5Kna/OwvCL/UGO832KOGtdMDBB2P4PKuE29/OfEWmxTO/y7g8 DMG7YZreytfgWiivCEwoXKssrEvJyfa/n/+Ltke2kUhCWHcV7aPs4nQa0lnyajmiCt+l I94IXD3FRzlqB9Mvqz0ODk4NAKEF97EORNvTXAjBmLXzhep5Pjh3bXypxySBhmIScDHG yQ32yCQjq5CpIv9OXfmWoel4ZURnK7bcsZryhUezuoUN6RllpsUczanJl/vwzufaUQwc b6U4NpePEbxbxjsNAc6u45gITvInEmoTmMdMhA64/rEjnK1DUO1n+9N+bB6xiC+LzUaH Kg== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2w3eud3c68-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2019 01:33:08 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Nov 2019 01:33:07 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.50) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 6 Nov 2019 01:33:06 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IbiI+ndT6e+FVegzvXyNGADFIwn/Va/jRkBs+WkJdaIwT1V7dPXnZou9IGRPD4cx0I5kkH9zY5bxHy+Z44sFcV3EGzZjFp3QCYrusCve8ijdhRY32oPQiE8iJOHQtOQlsq37TjuWIvz8JDa9gejbZwIV3Tm1jk958piyzCYjZhgLqnvo49bajAy27IXibuL7GJStzKqWp2k4YhsMIxuI57GzhMCGD+E8MWq2FtXZD/lXAC78L/A123tCh5MidFCCk84rU/AeOm3iEIMvco7iCGAJ+rVYo+SOfGq14CHfLX2noWPPxBXlqeUXaJ3+/4HjQkqj60QaXAZjsWj10x2g3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DSDXJqBl84EvmUJYBfU1UHYK2SRl9BBOA2sWchkTMjU=; b=iLJcH9I5Ok9bX9pwNOxMnIVcuolY/DLVIppFNxAKWoxs6nuc0ktd54yAq1muoLyl132H5XXja9AofP7A/U0UZw5nm3GXzOMj+Qm79ItsMi8JLgk9SkC9HRDVEF44Ds5JAaLIsApZI9mEeQaJNeZFP3X3QnwIsdhEe+AMxWvnIPPtrOEZqPrd/gCYjfisMGltUVi65OBk0IivMbFFUU3jvoFUNBhq+2Ijt0WaMIJHemmM5ZbBw/drPPqHtXruPXlFc1fwLwlvpMcWCkAQ4Eu7qU2u3lTWURghmxmlCT31n7zpJWvK+u7XZFyYrnUbpZFW8Ny5lIX5awwf6Ka8ggAdFQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DSDXJqBl84EvmUJYBfU1UHYK2SRl9BBOA2sWchkTMjU=; b=I331/8wHi8sx4LUt/laYnSmJtLXfn6dE3IfkvtAy36N3/EcN204truHhAXrvhOCcg8ez6WxrMlvU6s79cPKJRUGLJhOFEuJ4c81iXB0Gp5A4smeCbwIWp9t2pMMLb6mxsbxaGWHf4N+3oMDMmblDzbZjgys7DnOSBRFB5my9gfI= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB3165.namprd18.prod.outlook.com (10.255.236.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Wed, 6 Nov 2019 09:33:04 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6%6]) with mapi id 15.20.2430.020; Wed, 6 Nov 2019 09:33:04 +0000 From: Robert Richter To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck CC: James Morse , Robert Richter , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH v2 02/20] EDAC: Remove EDAC_DIMM_OFF() macro Thread-Topic: [PATCH v2 02/20] EDAC: Remove EDAC_DIMM_OFF() macro Thread-Index: AQHVlIUwz6HF5naXQkGmp5+ZC78PIA== Date: Wed, 6 Nov 2019 09:33:04 +0000 Message-ID: <20191106093239.25517-3-rrichter@marvell.com> References: <20191106093239.25517-1-rrichter@marvell.com> In-Reply-To: <20191106093239.25517-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0287.eurprd05.prod.outlook.com (2603:10a6:7:93::18) To MN2PR18MB3408.namprd18.prod.outlook.com (2603:10b6:208:165::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [31.208.96.227] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a4520a4e-5809-4ec5-23ad-08d7629c5308 x-ms-traffictypediagnostic: MN2PR18MB3165: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5236; x-forefront-prvs: 02135EB356 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(396003)(376002)(39860400002)(346002)(136003)(199004)(189003)(52116002)(305945005)(6486002)(76176011)(71190400001)(71200400001)(256004)(11346002)(446003)(7736002)(14444005)(6436002)(4326008)(6512007)(66446008)(66556008)(66476007)(66946007)(64756008)(5660300002)(1076003)(476003)(6116002)(3846002)(110136005)(54906003)(36756003)(2906002)(8676002)(99286004)(81166006)(81156014)(316002)(8936002)(50226002)(486006)(6506007)(386003)(102836004)(66066001)(2616005)(86362001)(478600001)(25786009)(186003)(14454004)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR18MB3165;H:MN2PR18MB3408.namprd18.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Zn3QNqwGBhTHsruqgFZ4hpbU0t4MqN/lLHcYWF+FFF2U+ub04NsU1ZoL3cpgp8L6l6+NONnBP9sVJdXIlmskz8aJuUWXMGL7dmp7qsFDLSefV6fv8PPcedTBrXR9n4OXhsWQ1J6hhfp/jvw2xELcTUaxD+BX+56dSyKSPYUggKFccItp6rkV2Lmv0c/RA7FZraOgftxsyxctWrQ0w+YkcPDY0cW5rg4N3WatHkbRg1uhvHP+CKlYYHUoC3C1qk4M0KfEu+glJKFH6o8BRB73jjqN1t3HhkMGQNdPzAKphTzthcwet65Wi5B1rwpPe93kmF3Tl1B2nHU2WdXXLBXLKiMT4G9OpbFjqIblxJMTrTEoFHeLLnJ3QLsBX8xbhYENClSq/2Q5LICLTnMBPcL6Sb/O1Wy5UVg7j4/o1U+IDa6Aq7GeeyYJEh60rB2OxsxK MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: a4520a4e-5809-4ec5-23ad-08d7629c5308 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 09:33:04.5815 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: AcUKPm766T1yE0EXTcoSifbIoOn0JkTnl+Pls2zZPPmjmwPEVHDZPHs2J9D0lLufJWjxz4x4D4Wo5o3TiSVuwg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3165 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-06_02:2019-11-06,2019-11-06 signatures=0 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org The EDAC_DIMM_OFF() macro takes 5 arguments to get the DIMM's index. This can be much simplified. Store the index in struct dimm_info to avoid its calculation and remove the EDAC_DIMM_OFF() macro. The index can be directly used. Another advantage is that edac_mc_alloc() could be used even if the exact size of the layers is unknown. Only the number of DIMMs would be needed. Signed-off-by: Robert Richter Reviewed-by: Mauro Carvalho Chehab --- drivers/edac/edac_mc.c | 14 ++++------- drivers/edac/edac_mc_sysfs.c | 20 ++++------------ include/linux/edac.h | 45 ++++-------------------------------- 3 files changed, 13 insertions(+), 66 deletions(-) diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index e6fd079783bd..72088d49b03b 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -314,10 +314,10 @@ struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num, struct dimm_info *dimm; u32 *ce_per_layer[EDAC_MAX_LAYERS], *ue_per_layer[EDAC_MAX_LAYERS]; unsigned int pos[EDAC_MAX_LAYERS]; - unsigned int size, tot_dimms = 1, count = 1; + unsigned int idx, size, tot_dimms = 1, count = 1; unsigned int tot_csrows = 1, tot_channels = 1, tot_errcount = 0; void *pvt, *p, *ptr = NULL; - int i, j, row, chn, n, len, off; + int i, j, row, chn, n, len; bool per_rank = false; BUG_ON(n_layers > EDAC_MAX_LAYERS || n_layers == 0); @@ -425,19 +425,15 @@ struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num, memset(&pos, 0, sizeof(pos)); row = 0; chn = 0; - for (i = 0; i < tot_dimms; i++) { + for (idx = 0; idx < tot_dimms; idx++) { chan = mci->csrows[row]->channels[chn]; - off = EDAC_DIMM_OFF(layer, n_layers, pos[0], pos[1], pos[2]); - if (off < 0 || off >= tot_dimms) { - edac_mc_printk(mci, KERN_ERR, "EDAC core bug: EDAC_DIMM_OFF is trying to do an illegal data access\n"); - goto error; - } dimm = kzalloc(sizeof(**mci->dimms), GFP_KERNEL); if (!dimm) goto error; - mci->dimms[off] = dimm; + mci->dimms[idx] = dimm; dimm->mci = mci; + dimm->idx = idx; /* * Copy DIMM location and initialize it. diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c index 32d016f1ecd1..91e4c8f155af 100644 --- a/drivers/edac/edac_mc_sysfs.c +++ b/drivers/edac/edac_mc_sysfs.c @@ -557,14 +557,8 @@ static ssize_t dimmdev_ce_count_show(struct device *dev, { struct dimm_info *dimm = to_dimm(dev); u32 count; - int off; - - off = EDAC_DIMM_OFF(dimm->mci->layers, - dimm->mci->n_layers, - dimm->location[0], - dimm->location[1], - dimm->location[2]); - count = dimm->mci->ce_per_layer[dimm->mci->n_layers-1][off]; + + count = dimm->mci->ce_per_layer[dimm->mci->n_layers-1][dimm->idx]; return sprintf(data, "%u\n", count); } @@ -574,14 +568,8 @@ static ssize_t dimmdev_ue_count_show(struct device *dev, { struct dimm_info *dimm = to_dimm(dev); u32 count; - int off; - - off = EDAC_DIMM_OFF(dimm->mci->layers, - dimm->mci->n_layers, - dimm->location[0], - dimm->location[1], - dimm->location[2]); - count = dimm->mci->ue_per_layer[dimm->mci->n_layers-1][off]; + + count = dimm->mci->ue_per_layer[dimm->mci->n_layers-1][dimm->idx]; return sprintf(data, "%u\n", count); } diff --git a/include/linux/edac.h b/include/linux/edac.h index 696bfb684d92..79c5564ee314 100644 --- a/include/linux/edac.h +++ b/include/linux/edac.h @@ -362,47 +362,6 @@ struct edac_mc_layer { */ #define EDAC_MAX_LAYERS 3 -/** - * EDAC_DIMM_OFF - Macro responsible to get a pointer offset inside a pointer - * array for the element given by [layer0,layer1,layer2] - * position - * - * @layers: a struct edac_mc_layer array, describing how many elements - * were allocated for each layer - * @nlayers: Number of layers at the @layers array - * @layer0: layer0 position - * @layer1: layer1 position. Unused if n_layers < 2 - * @layer2: layer2 position. Unused if n_layers < 3 - * - * For 1 layer, this macro returns "var[layer0] - var"; - * - * For 2 layers, this macro is similar to allocate a bi-dimensional array - * and to return "var[layer0][layer1] - var"; - * - * For 3 layers, this macro is similar to allocate a tri-dimensional array - * and to return "var[layer0][layer1][layer2] - var". - * - * A loop could be used here to make it more generic, but, as we only have - * 3 layers, this is a little faster. - * - * By design, layers can never be 0 or more than 3. If that ever happens, - * a NULL is returned, causing an OOPS during the memory allocation routine, - * with would point to the developer that he's doing something wrong. - */ -#define EDAC_DIMM_OFF(layers, nlayers, layer0, layer1, layer2) ({ \ - int __i; \ - if ((nlayers) == 1) \ - __i = layer0; \ - else if ((nlayers) == 2) \ - __i = (layer1) + ((layers[1]).size * (layer0)); \ - else if ((nlayers) == 3) \ - __i = (layer2) + ((layers[2]).size * ((layer1) + \ - ((layers[1]).size * (layer0)))); \ - else \ - __i = -EINVAL; \ - __i; \ -}) - struct dimm_info { struct device dev; @@ -412,6 +371,7 @@ struct dimm_info { unsigned int location[EDAC_MAX_LAYERS]; struct mem_ctl_info *mci; /* the parent */ + unsigned int idx; /* index within the parent dimm array */ u32 grain; /* granularity of reported error in bytes */ enum dev_type dtype; /* memory device type */ @@ -654,6 +614,9 @@ edac_get_dimm_by_index(struct mem_ctl_info *mci, int index) if (index < 0 || index >= mci->tot_dimms) return NULL; + if (WARN_ON_ONCE(mci->dimms[index]->idx != index)) + return NULL; + return mci->dimms[index]; } From patchwork Wed Nov 6 09:33:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 11229773 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 192671575 for ; Wed, 6 Nov 2019 09:33:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D81BA21882 for ; Wed, 6 Nov 2019 09:33:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="ZgMG1x6y"; dkim=pass (1024-bit key) header.d=marvell.onmicrosoft.com header.i=@marvell.onmicrosoft.com header.b="E7X+jlzm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727642AbfKFJdX (ORCPT ); Wed, 6 Nov 2019 04:33:23 -0500 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:24842 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730951AbfKFJdW (ORCPT ); Wed, 6 Nov 2019 04:33:22 -0500 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA69VwXB027788; Wed, 6 Nov 2019 01:33:10 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=jcjtbOmJ9NrTjtGOHognQ8Dkd11UM20Z22o5XXVpwGE=; b=ZgMG1x6yXOBhp9xv3mnzbS9OPk7vIoT/z3uHSd/lfuojw4ZNIZq9GfkVc7AI4HxGFXGs 4luI9iMyQnoXkucXY/s7PcHLM/FHchujZxdxNM9mliXPQHu9FeonzlDWLdPnUMPgIG8N wXd9n8+gWx2zP7bNAn520TYr8l2edmTwRyp4zZszGAc5VHZw9IWfN0Scd4r4vnOh60lV 9jhwA1/XDSJ5iKPWFqmXyaEIGJ8CpurQvBf8RslnQJy8y3U+/txAJfayjrzKQqx8XrKO bfrN2KwhiWXFykidnE7S/9a75a34hO3shn5tdOxxpc5K8NMom6nkZrVNr/uzM6B1Sq3u Lw== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2w19amyaj9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2019 01:33:10 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Nov 2019 01:33:08 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.50) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 6 Nov 2019 01:33:08 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BvIK3l3DIQCyA5F9d7VQZv0BCMshL9HLuR9g6LMtFwduEXgqMzPlD4MhNy8sm+xUv7h72jZVJzB7Co++DLxv4N022FqX/2vFI1MHMUiyGteb5Xj3fy++zqmU7ANUhX/r93Y5c7pOR/BTtlqtxboCN/YwaW7sgGgxJWmVNk+0csgjP88DNkxFcmY1NkVsOe027fvftkM/jZbgBOkLIlcPJx7zm42+RnaQ4xyo4azvDfpHt+vIdHtI9edjisfXUbn4ycoACYsoYapcmHhCmBJoExdjcAH65ZdWgYC+Fiqt9ikz0QBM2RXOxUAJbE7xQd8xm2o5FfnHW2hcz2rVbB/H1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jcjtbOmJ9NrTjtGOHognQ8Dkd11UM20Z22o5XXVpwGE=; b=AO5TlmvUm/FvyCaHyKzdYnmT65Ond/hDBJ0Gqg0rCHWbdJs/D13SNj1UxwBu+fV3YhAwJ8VPSG9w/bhGW18oEc0sqkptAHReA3ip/mLUcyjH9Zpz3GLlFFbohx1ICN0TrjQbUzlfuySqsMPFdZc+r9zVuIvmds7jPmnSIkUisv+rk4BCS9d/PNTFX+E8/xoWCR5C2eULCsZiLYCmZFj1QkjZiKZEL3dUpXAvqUArsCboaAfRHxKwLcJ+cjRtXGrdeujGB9JnuGSiIayzNFMf0/u3/qusTCCB/0G3rh4xoP4k82L1PpgfAxJ9zRBGEcQ/GljiCnHGZ7UG11OXCIZFPQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jcjtbOmJ9NrTjtGOHognQ8Dkd11UM20Z22o5XXVpwGE=; b=E7X+jlzm77sNFhL5+1J5no+Vo/kROmaVh7QwzawjW7L1EX7TWhFJLrAtzDu+yNY4zrGjjto6ZNFhsSRHY8md6d3e4i37kliqMsb/71xsmJoTMcT9hqsdkcxOl2mFwOZovB1qC2qYhGi3KZz4xlvloVx9xfMsoI7FjqKR3svb3ww= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB3165.namprd18.prod.outlook.com (10.255.236.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Wed, 6 Nov 2019 09:33:07 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6%6]) with mapi id 15.20.2430.020; Wed, 6 Nov 2019 09:33:07 +0000 From: Robert Richter To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck CC: James Morse , Robert Richter , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Mauro Carvalho Chehab" Subject: [PATCH v2 03/20] EDAC: Introduce mci_for_each_dimm() iterator Thread-Topic: [PATCH v2 03/20] EDAC: Introduce mci_for_each_dimm() iterator Thread-Index: AQHVlIUyV002ir1/PECNj5/y7jIwmw== Date: Wed, 6 Nov 2019 09:33:07 +0000 Message-ID: <20191106093239.25517-4-rrichter@marvell.com> References: <20191106093239.25517-1-rrichter@marvell.com> In-Reply-To: <20191106093239.25517-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0287.eurprd05.prod.outlook.com (2603:10a6:7:93::18) To MN2PR18MB3408.namprd18.prod.outlook.com (2603:10b6:208:165::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [31.208.96.227] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: aabfff52-44b9-4390-48b2-08d7629c5491 x-ms-traffictypediagnostic: MN2PR18MB3165: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:103; x-forefront-prvs: 02135EB356 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(396003)(376002)(39860400002)(346002)(136003)(199004)(189003)(52116002)(305945005)(6486002)(76176011)(71190400001)(71200400001)(256004)(11346002)(446003)(7736002)(14444005)(6436002)(4326008)(6512007)(66446008)(66556008)(66476007)(66946007)(64756008)(5660300002)(1076003)(476003)(6116002)(3846002)(110136005)(54906003)(36756003)(2906002)(8676002)(99286004)(81166006)(81156014)(316002)(8936002)(50226002)(486006)(6506007)(386003)(102836004)(66066001)(2616005)(86362001)(478600001)(25786009)(186003)(14454004)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR18MB3165;H:MN2PR18MB3408.namprd18.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: qe8yskx4IJfP88g1rdDBxVThQb5NACNOU2odbCkZ1bqHko/OiMAaATziFWkNTgsXKvwZm4+TbvD8XSBNojHtoFpd9bcorybj6jWSszP0yFI5upoDjTRYfpmoryl/3Eyg6O3Owqpb5bLYIgrh5r7aVMMqBJYrI0jYqMckB93KNR0BU/O5tYs7e4CPOfxMuwye5wt0nr9zDRlkfQN0zTV1dEQBQNuTtk6cCyKJg+Lz+Vx1hsVNM1op+WmdgYvfeUT1cN62bEAOa5QiboijeYILVH2wJfqDWuGdOiz7LCN95FT45RDwkmKS6uEtKfYHJpXdKK6P7BmkL1ITpusb1YlJrF140JthcpB/HQlwCaT3+mt/0OqjiB2eJz6yXXp77tye5dAz+AiKu+008+pUedCaynu83+nDrZ6a0nF4nWyhLC06Ld08tvzZgrcy34TcwGtL MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: aabfff52-44b9-4390-48b2-08d7629c5491 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 09:33:07.2660 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: y2AaES8VvWxxmHi42ygdbTT2IRh2jeNjFokpVL2Fh0+MzQNad8DJ2c/m7OYCcSRxy/RevNuQ/T5gr76SsVZIUw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3165 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-06_02:2019-11-06,2019-11-06 signatures=0 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org Introduce the mci_for_each_dimm() iterator. It returns a pointer to a struct dimm_info. This makes the declaration and use of an index obsolete and avoids access to internal data of struct mci (direct array access etc). Signed-off-by: Robert Richter Reviewed-by: Mauro Carvalho Chehab --- drivers/edac/edac_mc.c | 19 +++++++++++-------- drivers/edac/edac_mc_sysfs.c | 29 ++++++++++++----------------- drivers/edac/ghes_edac.c | 9 +++++---- drivers/edac/i5100_edac.c | 13 +++++-------- include/linux/edac.h | 7 +++++++ 5 files changed, 40 insertions(+), 37 deletions(-) diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index 72088d49b03b..c5240bb4c6c0 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -145,15 +145,18 @@ static void edac_mc_dump_channel(struct rank_info *chan) edac_dbg(4, " channel->dimm = %p\n", chan->dimm); } -static void edac_mc_dump_dimm(struct dimm_info *dimm, int number) +static void edac_mc_dump_dimm(struct dimm_info *dimm) { char location[80]; + if (!dimm->nr_pages) + return; + edac_dimm_info_location(dimm, location, sizeof(location)); edac_dbg(4, "%s%i: %smapped as virtual row %d, chan %d\n", dimm->mci->csbased ? "rank" : "dimm", - number, location, dimm->csrow, dimm->cschannel); + dimm->idx, location, dimm->csrow, dimm->cschannel); edac_dbg(4, " dimm = %p\n", dimm); edac_dbg(4, " dimm->label = '%s'\n", dimm->label); edac_dbg(4, " dimm->nr_pages = 0x%x\n", dimm->nr_pages); @@ -702,6 +705,7 @@ EXPORT_SYMBOL_GPL(edac_get_owner); int edac_mc_add_mc_with_groups(struct mem_ctl_info *mci, const struct attribute_group **groups) { + struct dimm_info *dimm; int ret = -EINVAL; edac_dbg(0, "\n"); @@ -726,9 +730,9 @@ int edac_mc_add_mc_with_groups(struct mem_ctl_info *mci, if (csrow->channels[j]->dimm->nr_pages) edac_mc_dump_channel(csrow->channels[j]); } - for (i = 0; i < mci->tot_dimms; i++) - if (mci->dimms[i]->nr_pages) - edac_mc_dump_dimm(mci->dimms[i], i); + + mci_for_each_dimm(mci, dimm) + edac_mc_dump_dimm(dimm); } #endif mutex_lock(&mem_ctls_mutex); @@ -1086,6 +1090,7 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, const char *msg, const char *other_detail) { + struct dimm_info *dimm; char *p; int row = -1, chan = -1; int pos[EDAC_MAX_LAYERS] = { top_layer, mid_layer, low_layer }; @@ -1146,9 +1151,7 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, p = e->label; *p = '\0'; - for (i = 0; i < mci->tot_dimms; i++) { - struct dimm_info *dimm = mci->dimms[i]; - + mci_for_each_dimm(mci, dimm) { if (top_layer >= 0 && top_layer != dimm->location[0]) continue; if (mid_layer >= 0 && mid_layer != dimm->location[1]) diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c index 91e4c8f155af..0367554e7437 100644 --- a/drivers/edac/edac_mc_sysfs.c +++ b/drivers/edac/edac_mc_sysfs.c @@ -621,8 +621,7 @@ static const struct device_type dimm_attr_type = { /* Create a DIMM object under specifed memory controller device */ static int edac_create_dimm_object(struct mem_ctl_info *mci, - struct dimm_info *dimm, - int index) + struct dimm_info *dimm) { int err; dimm->mci = mci; @@ -632,9 +631,9 @@ static int edac_create_dimm_object(struct mem_ctl_info *mci, dimm->dev.parent = &mci->dev; if (mci->csbased) - dev_set_name(&dimm->dev, "rank%d", index); + dev_set_name(&dimm->dev, "rank%d", dimm->idx); else - dev_set_name(&dimm->dev, "dimm%d", index); + dev_set_name(&dimm->dev, "dimm%d", dimm->idx); dev_set_drvdata(&dimm->dev, dimm); pm_runtime_forbid(&mci->dev); @@ -916,7 +915,8 @@ static const struct device_type mci_attr_type = { int edac_create_sysfs_mci_device(struct mem_ctl_info *mci, const struct attribute_group **groups) { - int i, err; + struct dimm_info *dimm; + int err; /* get the /sys/devices/system/edac subsys reference */ mci->dev.type = &mci_attr_type; @@ -940,13 +940,12 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci, /* * Create the dimm/rank devices */ - for (i = 0; i < mci->tot_dimms; i++) { - struct dimm_info *dimm = mci->dimms[i]; + mci_for_each_dimm(mci, dimm) { /* Only expose populated DIMMs */ if (!dimm->nr_pages) continue; - err = edac_create_dimm_object(mci, dimm, i); + err = edac_create_dimm_object(mci, dimm); if (err) goto fail_unregister_dimm; } @@ -961,12 +960,9 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci, return 0; fail_unregister_dimm: - for (i--; i >= 0; i--) { - struct dimm_info *dimm = mci->dimms[i]; - if (!dimm->nr_pages) - continue; - - device_unregister(&dimm->dev); + mci_for_each_dimm(mci, dimm) { + if (device_is_registered(&dimm->dev)) + device_unregister(&dimm->dev); } device_unregister(&mci->dev); @@ -978,7 +974,7 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci, */ void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci) { - int i; + struct dimm_info *dimm; edac_dbg(0, "\n"); @@ -989,8 +985,7 @@ void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci) edac_delete_csrow_objects(mci); #endif - for (i = 0; i < mci->tot_dimms; i++) { - struct dimm_info *dimm = mci->dimms[i]; + mci_for_each_dimm(mci, dimm) { if (dimm->nr_pages == 0) continue; edac_dbg(1, "unregistering device %s\n", dev_name(&dimm->dev)); diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c index d92cd99081d2..af27f8063891 100644 --- a/drivers/edac/ghes_edac.c +++ b/drivers/edac/ghes_edac.c @@ -90,12 +90,13 @@ static void ghes_edac_count_dimms(const struct dmi_header *dh, void *arg) static int get_dimm_smbios_index(struct mem_ctl_info *mci, u16 handle) { - int i; + struct dimm_info *dimm; - for (i = 0; i < mci->tot_dimms; i++) { - if (mci->dimms[i]->smbios_handle == handle) - return i; + mci_for_each_dimm(mci, dimm) { + if (dimm->smbios_handle == handle) + return dimm->idx; } + return -1; } diff --git a/drivers/edac/i5100_edac.c b/drivers/edac/i5100_edac.c index 134586753311..0ddc41e47a96 100644 --- a/drivers/edac/i5100_edac.c +++ b/drivers/edac/i5100_edac.c @@ -846,20 +846,17 @@ static void i5100_init_interleaving(struct pci_dev *pdev, static void i5100_init_csrows(struct mem_ctl_info *mci) { - int i; struct i5100_priv *priv = mci->pvt_info; + struct dimm_info *dimm; - for (i = 0; i < mci->tot_dimms; i++) { - struct dimm_info *dimm; - const unsigned long npages = i5100_npages(mci, i); - const unsigned int chan = i5100_csrow_to_chan(mci, i); - const unsigned int rank = i5100_csrow_to_rank(mci, i); + mci_for_each_dimm(mci, dimm) { + const unsigned long npages = i5100_npages(mci, dimm->idx); + const unsigned int chan = i5100_csrow_to_chan(mci, dimm->idx); + const unsigned int rank = i5100_csrow_to_rank(mci, dimm->idx); if (!npages) continue; - dimm = edac_get_dimm(mci, chan, rank, 0); - dimm->nr_pages = npages; dimm->grain = 32; dimm->dtype = (priv->mtr[chan][rank].width == 4) ? diff --git a/include/linux/edac.h b/include/linux/edac.h index 79c5564ee314..8beb6e834be9 100644 --- a/include/linux/edac.h +++ b/include/linux/edac.h @@ -599,6 +599,13 @@ struct mem_ctl_info { u16 fake_inject_count; }; +#define mci_for_each_dimm(mci, dimm) \ + for ((dimm) = (mci)->dimms[0]; \ + (dimm); \ + (dimm) = (dimm)->idx + 1 < (mci)->tot_dimms \ + ? (mci)->dimms[(dimm)->idx + 1] \ + : NULL) + /** * edac_get_dimm_by_index - Get DIMM info from a memory controller * given by an index From patchwork Wed Nov 6 09:33:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 11229807 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BE61015AB for ; Wed, 6 Nov 2019 09:34:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 91669217F4 for ; Wed, 6 Nov 2019 09:34:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="I9Mt4UAU"; dkim=pass (1024-bit key) header.d=marvell.onmicrosoft.com header.i=@marvell.onmicrosoft.com header.b="dmc/3sKo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729841AbfKFJdT (ORCPT ); Wed, 6 Nov 2019 04:33:19 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:42896 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727642AbfKFJdT (ORCPT ); Wed, 6 Nov 2019 04:33:19 -0500 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA69UIxI002503; Wed, 6 Nov 2019 01:33:12 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=aLaTuVZChfzcoBY6BX5AGWUoC40fMoccLj2A6AQxBNc=; b=I9Mt4UAUR0186E0dVwxThSbamnLtfqhSkHMjIWkF/oocaDJ8bD4D4btUZ5mFQfN1vca4 P5/RtfgNaBjTWmVZCHTbJ+bEhGYglQJFJv/cwQu7tGtBk+5gSrHgIe2tsDIRW1Zp5f6V 0mPBSGXUjH8gGBsXfFZTLEUklSlLpJTtl8KtQm0WKhASxVLYooUkhrRn/pzAiTPDtwlw LC7S2zVPtmWTInE+w0cmw0EtSUwngayYS7DqqerygF40jFURrQmvYegV9Yv/IAhuF+H8 sYcKAFIBcZJzN4pKGz/ilDp1Q+IxOSHorgk6ZUEexFZCN5ymMUMbxIEZX+wGaB5Wxt2P bA== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2w3eud3c6h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2019 01:33:12 -0800 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Nov 2019 01:33:11 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.57) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 6 Nov 2019 01:33:11 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CPz2cbitsvDgyGZWm4NuLTbNregSZ8L1traQTRGow6k8CIGMoaUyHtl964IlHy95aKQ+l0vKaHY7IBSblG6KODPEObZXF7QqjfVK83IhHgL0QgOfazZawFCzmQN03jbva+dn+j5di0Zd3zKjuLrJaTPgHveT982vgj4Q1eucMLXa4IVtiBKZUElFzpefpdrCx3bkF4FeAzYJ2a8znCbhN51qZRTMhnZygbTi0yDAxcO+2Ir2pgvVQ+drpT5P/Rc14LoV99RgNc9ni8TCp8kVmD6xQG4Rmykqw96XtdHvmdCVZejlKde+FxWdgrNxkG0qx81ruY2dcntC3BDIjOHRQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aLaTuVZChfzcoBY6BX5AGWUoC40fMoccLj2A6AQxBNc=; b=EXAWTgVVbOBXYE/1P0IPcgRmJj+pjlbYCbwDKGSuMJWVl2O8R2gcPl9twauiAG0esJ5C68dCBHtlJ+rKCSUWcmDSXtL0LwGj2EMAhLeRH58aOxxfjDIZJdBB20nuhRTmRERTUKWmeT+u8SCJ520mncV4zwWVPRnJ7fm95iakaSkrCj+HRH4WxidB5HUArrsGs2UpkFhd1ioTONaQBmHQyJ6atC7tzwSFQSu2zDoS3GdxDP02yvImkYf9652yoEsbuIt3XKwbZgzLlQ/BgxSmkLVnNP1k1LW4jTMuTgPo+1kPY8yj3lLVjetC+su4Zt2EHlrelVN885PE7vHwbX14xQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aLaTuVZChfzcoBY6BX5AGWUoC40fMoccLj2A6AQxBNc=; b=dmc/3sKoXCicSnuZL8pDy8AKSV7QtnCXZTK+HtWEt2xiGuSLKiuFHw3T1akUiICdB0c5ZVbDedT/buwomN/Pm2/7Q1Ntfv/xhVrldvBRYSlXAH/onwz+tnUVS3lElE/x5iDnrrA2OW9orQaGENQCdJM1htF0nbM7Svi31w421+U= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB3165.namprd18.prod.outlook.com (10.255.236.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Wed, 6 Nov 2019 09:33:09 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6%6]) with mapi id 15.20.2430.020; Wed, 6 Nov 2019 09:33:09 +0000 From: Robert Richter To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck CC: James Morse , Robert Richter , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Mauro Carvalho Chehab" Subject: [PATCH v2 04/20] EDAC, mc: Do not BUG_ON() in edac_mc_alloc() Thread-Topic: [PATCH v2 04/20] EDAC, mc: Do not BUG_ON() in edac_mc_alloc() Thread-Index: AQHVlIUz7boQWMifeEOuGHD4/0UIaQ== Date: Wed, 6 Nov 2019 09:33:09 +0000 Message-ID: <20191106093239.25517-5-rrichter@marvell.com> References: <20191106093239.25517-1-rrichter@marvell.com> In-Reply-To: <20191106093239.25517-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0287.eurprd05.prod.outlook.com (2603:10a6:7:93::18) To MN2PR18MB3408.namprd18.prod.outlook.com (2603:10b6:208:165::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [31.208.96.227] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f1438922-e2cb-4ad7-3426-08d7629c55ee x-ms-traffictypediagnostic: MN2PR18MB3165: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4502; x-forefront-prvs: 02135EB356 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(396003)(376002)(39860400002)(346002)(136003)(199004)(189003)(52116002)(305945005)(6486002)(4744005)(76176011)(71190400001)(71200400001)(256004)(11346002)(446003)(7736002)(14444005)(6436002)(4326008)(6512007)(66446008)(66556008)(66476007)(66946007)(64756008)(5660300002)(1076003)(476003)(6116002)(3846002)(110136005)(54906003)(36756003)(2906002)(8676002)(99286004)(81166006)(81156014)(316002)(8936002)(50226002)(486006)(6506007)(386003)(102836004)(66066001)(2616005)(86362001)(478600001)(25786009)(186003)(14454004)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR18MB3165;H:MN2PR18MB3408.namprd18.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: xuVTvOqnYvzCV+XioAJ+xN+YDGUvTYwZC+R+c/3Ar8oCl6B/A/roJV0xeqgqpV3aZ9kZutTy/QCCg3UTbbJm1q0zubA0Oh2NyGfCYEzj6Ma0dWnen65AZ6gF/s+YPVqZ/HFRBWjvIzEPlOU6YidfgUPCNuAxHaf0VQTMDQT9XR94RfTo+ymtH3e8ZCYK69nFEx1yFLWUBuKHNEaiEsVItBaciMGJ9wlVXJeChyBRA3KfguzbpR0QnviLfYFx7/Cbs1wfswN5li4ODIGlJEbVmIQp7yQHAHUXb4NIxAn2mt/Dc+PozE/vgZ+TZghgslVX7JYmdXYJ73d0FwQsDqc5eSS5XmiroNo+Al22P4Sbj+GFSSBFgxu3TUqWIZCBAqw6WfHVyD3AQ94l3CBEYwUABmN848OjvZ+LYxULkwcs2uDlNok1m13+2rgMUVzVN8cG MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: f1438922-e2cb-4ad7-3426-08d7629c55ee X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 09:33:09.5707 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: LXgYLU15vqg8A+yCjGZ/0YkaZxEVmOhtX/hChHOgcmg9nTYacAQhj1O9vGE7FcrhO2wKeovsjQEABfiH2C2bCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3165 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-06_02:2019-11-06,2019-11-06 signatures=0 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org No need to crash the system in case edac_mc_alloc() is called with invalid arguments, just warn and return. This would cause a checkpatch warning when touching the code later, so just fix it. Signed-off-by: Robert Richter Reviewed-by: Mauro Carvalho Chehab --- drivers/edac/edac_mc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index c5240bb4c6c0..f2cbca77bc50 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -323,7 +323,9 @@ struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num, int i, j, row, chn, n, len; bool per_rank = false; - BUG_ON(n_layers > EDAC_MAX_LAYERS || n_layers == 0); + if (WARN_ON(n_layers > EDAC_MAX_LAYERS || n_layers == 0)) + return NULL; + /* * Calculate the total amount of dimms and csrows/cschannels while * in the old API emulation mode From patchwork Wed Nov 6 09:33:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 11229805 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A1A1C15AB for ; Wed, 6 Nov 2019 09:34:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7F31E21848 for ; Wed, 6 Nov 2019 09:34:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="HHET2Mb9"; dkim=pass (1024-bit key) header.d=marvell.onmicrosoft.com header.i=@marvell.onmicrosoft.com header.b="PcieYLGX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730951AbfKFJdZ (ORCPT ); Wed, 6 Nov 2019 04:33:25 -0500 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:24478 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731154AbfKFJdY (ORCPT ); Wed, 6 Nov 2019 04:33:24 -0500 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA69VJ5D027210; Wed, 6 Nov 2019 01:33:15 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=rWDNtmMdklU6ahCZAyuCBWkr0fS+qTPeqOEUYDH+iEU=; b=HHET2Mb9iRbExRD3Kf6FuZJC7hsaid46YbHlHEFJb09FVBJNkEG6L1N82mRY5EN0ptzl oZrGhQp1IYdHz3KF3P/OyKcWkFiBPtTQqQhE2Fh3GJZrlk5Mt2y91w23S4+JDI3sgw84 ynTsdPqD1L7fu0ezL5ifI0wpAVFKA0YS7mE4fukW0SgaZt8ovsS7lrTiATz89w/atyz8 5euVpUlVyOXN1GkL4nI21RnJQM7jg9sDD2nF2lmQFQ6kemHYQW3AswwJgpa66+rCw1KE S3ZFlk89NuYrMT+Q+2xc24YB5tCQ5HNu05iFIPq0h+hs109Cc+3bDO574lG92J7xnREq qQ== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2w19amyajp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2019 01:33:15 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Nov 2019 01:33:13 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.53) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 6 Nov 2019 01:33:13 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GhP5upTJQc80XXhfSWoyWJ/Vkg+YkeYD8irBE48aEHUI6c1MvJo6vHk4Hj58aIxNGeutdFNn1sD8Z4QoRs6efPn2TGxiW7TnDxWeRuwApFuLkitbAW145ABg89hChCg0mqsqzeN3Asq0i5Fs8YCPw9fIzsuz7BD6lVY4EcVRFXw5Lwbg30kO/E12uO3UkHxQShGBC85TUR4O/J9Zxdrb5+bTC+S/voyIobUhQW70t4fHeLpIhjYiTznd/TYTqROrrHydXqFTgcLRggVuVQ5fHnzxEUN2JKQPLAncN5Y7Oaw9WCLTuXdlBQbrgAqh58ybhBaoLAHAzed1N05ILzoFMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rWDNtmMdklU6ahCZAyuCBWkr0fS+qTPeqOEUYDH+iEU=; b=UrHYBG0p2ZuGegRkjmNGoGvQ3tCRO9CP2rCL8mjjXtcAHX0a1+VDazfLE4L30F2h6fiZMbjGMpCoPsO6Lbbkr6wQ0GPGpHKsFHH71brJdy0/FBww3wPLIeHUg2V4bB3MmvDgqaWEwKYPR86/mIH/R/KnlOH97eZ2jf3CP61X9oodvJXmCvEildUUcumyEPb54TpwtO7EiUWe7pONWNYLEPTkpunIv0FDRRA1Tr1nf0hRD47TsLCuxrGhG/kSJkJbo+Q/FiiVt1odEmShnv5Jlt5MzZ3MLuRYaXwj5CNAMMxZKM9Tpl4GpdVKo6+CLNW6/ICtGmpCSy+t8um4nQxHiw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rWDNtmMdklU6ahCZAyuCBWkr0fS+qTPeqOEUYDH+iEU=; b=PcieYLGXZx8QJZDfURqVBHu6SCxKrjRB3b74zI73IeNL09LdxBlNC5v/H/rerch3GxK5tp4j0Dal84oKqQO5XoS4hIwuRJnTZKm6tuCkl56gSfzVZz+x/F8/Z6CTNXDvc2t2/Kwv92WKVET58C6LPln0PW6P2E0vHwD72xx0c6g= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB3165.namprd18.prod.outlook.com (10.255.236.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Wed, 6 Nov 2019 09:33:12 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6%6]) with mapi id 15.20.2430.020; Wed, 6 Nov 2019 09:33:11 +0000 From: Robert Richter To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck CC: James Morse , Robert Richter , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Joe Perches Subject: [PATCH v2 05/20] EDAC, mc: Remove needless zero string termination Thread-Topic: [PATCH v2 05/20] EDAC, mc: Remove needless zero string termination Thread-Index: AQHVlIU0JPYgrRN4PUabZYpzEbCP9Q== Date: Wed, 6 Nov 2019 09:33:11 +0000 Message-ID: <20191106093239.25517-6-rrichter@marvell.com> References: <20191106093239.25517-1-rrichter@marvell.com> In-Reply-To: <20191106093239.25517-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0287.eurprd05.prod.outlook.com (2603:10a6:7:93::18) To MN2PR18MB3408.namprd18.prod.outlook.com (2603:10b6:208:165::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [31.208.96.227] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a68bd89a-4dd1-4f50-022b-08d7629c573e x-ms-traffictypediagnostic: MN2PR18MB3165: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5797; x-forefront-prvs: 02135EB356 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(396003)(376002)(39860400002)(346002)(136003)(199004)(189003)(52116002)(305945005)(6486002)(4744005)(76176011)(71190400001)(71200400001)(256004)(11346002)(446003)(7736002)(14444005)(6436002)(4326008)(6512007)(66446008)(66556008)(66476007)(66946007)(64756008)(5660300002)(1076003)(476003)(6116002)(3846002)(110136005)(54906003)(36756003)(2906002)(8676002)(99286004)(81166006)(81156014)(316002)(8936002)(50226002)(486006)(6506007)(386003)(102836004)(66066001)(2616005)(86362001)(478600001)(25786009)(186003)(14454004)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR18MB3165;H:MN2PR18MB3408.namprd18.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: BqkMX2APnI8EuNmTE2Jj7bw8WoVzcKyBWLyVjwNOJ6Y2ZgvJZXRnZNfyz8OrzIzdJ8aPqAIid3xrvNGU2mFnl/uuwt803uBkLjP/3qZsJ4cOU/w8Z1nSrBzBSpjPqbvaq/S06eO54Q0Ck4BLoKix8zF6sPMxau/6FUKZPgzxW0HkeuI7+3jRawtTFEmzFyh7D9OABSMe3f2iDQjzUcSVpUAMFgyA9sgQUipXAkYK3Lg2B+/9bBA60C5MWw1fP912l1wvXpznHTGU/mh9DRNX1w31ZVmonfdLfd7FbRhGZhitTwxR2nM2j7l4D/jk3LgyL18b1YKX72ijD0GozgM47MV/LUvexgeIcyFFrPwyuRO+FeBDrz2BvZgLCCBpI+p0kNg2U8xdKYjBf0YGiG7j9dMhKQHvpiuXRLIc0gwB8MhtkJL61uThGHBG0t5WIPvI MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: a68bd89a-4dd1-4f50-022b-08d7629c573e X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 09:33:11.8174 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: oa59cp5ACBPTJsweWoQsY0ROCM0S65qIE3V2Nd/ZEwUKxVWCqGeV8wFchjeg0aVeluikZWSrLJmCgL7aCZQyLA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3165 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-06_02:2019-11-06,2019-11-06 signatures=0 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org Since this is a string already and strlen() has been used to advance the pointer, the end of the buffer is already zero terminated. Remove the needless zero string termination. Suggested-by: Joe Perches Signed-off-by: Robert Richter Reviewed-by: Mauro Carvalho Chehab --- drivers/edac/edac_mc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index f2cbca77bc50..8bfe76d1bdf1 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -1183,7 +1183,6 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, } strcpy(p, dimm->label); p += strlen(p); - *p = '\0'; /* * get csrow/channel of the DIMM, in order to allow From patchwork Wed Nov 6 09:33:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 11229803 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BE1671864 for ; Wed, 6 Nov 2019 09:34:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 92A3A21848 for ; Wed, 6 Nov 2019 09:34:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="SmUpqJx4"; dkim=pass (1024-bit key) header.d=marvell.onmicrosoft.com header.i=@marvell.onmicrosoft.com header.b="l1zBMdNp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731639AbfKFJdZ (ORCPT ); Wed, 6 Nov 2019 04:33:25 -0500 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:4120 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731188AbfKFJdY (ORCPT ); Wed, 6 Nov 2019 04:33:24 -0500 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA69VKLR027217; Wed, 6 Nov 2019 01:33:18 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=Z5k9njPJN2G7MTwpf0Lve8/g4Vg/fCzv3uCHtlJZ0Pk=; b=SmUpqJx4gQr1s6ISs1xn6mrDXELhGz/Gfw7hZS0788rX08Lrtu65UVyYhFPIJVGJt489 dQCVTIEABOM/8HeCQcLt3YLxRIPJWKtRZ1xlOLhjDd+BhC0yiWuTjFxDM4Z1MXnuJpre FOBmRJ3qgzukqh28Q9XWRpFfG0Q01VcM9ZvFKWO4XzU9iZo3KAqgXh7xsAeRQWCZzn8l Qgkm34q2YF8PSZ/yCNKD7gx7vyR64Bvzs6qyM4N5Njnz5acAFqUGPSh3bFhahzH4QlTc IYhEk2lFg/UcOYoxn0xrlAdRLRAyv+caKRl/RRs8+WwACiFDh3F0tW0afvloiWt56y11 mg== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2w19amyajv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2019 01:33:18 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Nov 2019 01:33:16 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.55) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 6 Nov 2019 01:33:16 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mK2ToIjJC3RD+MqME8TmXCbIpeJhIUXqdOxQck/Gc4oU7W6PkywGjBdqVXjkGGY/9SRCdFNRHTAQbQr67JHxgB5+5OLL6mIKEoIZQVdcnzyE+euQxFaDzTBB9sw8nB47/uH2ldy8yR/9WySDTeoH/ntYJ6wDCCoKj6KPv7Hafwesu//BnkhBDCwNbEo7UO1ZaUIAN6D9le+e0K9CixfNNpi6hkTZc8lNd1HuagQAvXz02K03x2BNkv1LWNxcPibA+VtfiyyDSRU1hITULnoF47b9U/7zR5ZcOMWhaHzcSMgovRfWIs6U+afQUkxIN7c4kq5wMV0xyvBWRMlCobZx/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Z5k9njPJN2G7MTwpf0Lve8/g4Vg/fCzv3uCHtlJZ0Pk=; b=dW7RN8mQ6m0bvHvFaTP3I5YTdg35hwA8Meuf3ArdpUfWTyGk37wuh2FA3xpQHTl4gvzVrwss3b1Js8RD0tTxlxSJcoE/gBreEmhVOPUeh2iCY5Iwl+QUjPUyNl0NijWi8YIh+9pIoQxRjVE50nzYU8rCw44yYJH9VuRecH/XxVHaSu/IHo+L6b7j5QzBjdEk2GqSRfNbKZ+B/lwWEmPeay+x487sztkZl2x6cdqt8BNRIfVCpOKOriAB0GBLAzfZ7zTOQ+ywd93nSUZn0P2Ar+CSDHJXRTysATjBYVJUvuF/cGKzKXzn7BXZP7XsP3EKWDYRz5hJuAWtoWcXdN23tA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Z5k9njPJN2G7MTwpf0Lve8/g4Vg/fCzv3uCHtlJZ0Pk=; b=l1zBMdNppwipu59nUJAsjilANUel4ffdZFpvLBFtYBNF8QHydoKxFyrC1UZBj5kjDHRiWwMpLz4+SrB15/S61g9G69ZNaTIuxF9WtMeIgzn6A7KByU7KfXnvsQnUtZzUByXRa1e0DOyNPm+mPi1jTyWEZaxshq2GrJLL/gAgJOs= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB3165.namprd18.prod.outlook.com (10.255.236.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Wed, 6 Nov 2019 09:33:14 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6%6]) with mapi id 15.20.2430.020; Wed, 6 Nov 2019 09:33:14 +0000 From: Robert Richter To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck CC: James Morse , Robert Richter , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Mauro Carvalho Chehab" Subject: [PATCH v2 06/20] EDAC, mc: Reduce indentation level in edac_mc_handle_error() Thread-Topic: [PATCH v2 06/20] EDAC, mc: Reduce indentation level in edac_mc_handle_error() Thread-Index: AQHVlIU2IWhkSqNolE63BniXo8A8zQ== Date: Wed, 6 Nov 2019 09:33:14 +0000 Message-ID: <20191106093239.25517-7-rrichter@marvell.com> References: <20191106093239.25517-1-rrichter@marvell.com> In-Reply-To: <20191106093239.25517-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0287.eurprd05.prod.outlook.com (2603:10a6:7:93::18) To MN2PR18MB3408.namprd18.prod.outlook.com (2603:10b6:208:165::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [31.208.96.227] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 8cb39542-b3e9-44ab-2a70-08d7629c589a x-ms-traffictypediagnostic: MN2PR18MB3165: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:873; x-forefront-prvs: 02135EB356 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(396003)(376002)(39860400002)(346002)(136003)(199004)(189003)(52116002)(305945005)(6486002)(76176011)(71190400001)(71200400001)(256004)(11346002)(446003)(7736002)(14444005)(6436002)(4326008)(6512007)(66446008)(66556008)(66476007)(66946007)(64756008)(5660300002)(1076003)(476003)(6116002)(3846002)(110136005)(54906003)(36756003)(2906002)(8676002)(99286004)(81166006)(81156014)(316002)(8936002)(50226002)(486006)(6506007)(386003)(102836004)(66066001)(2616005)(86362001)(478600001)(25786009)(186003)(14454004)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR18MB3165;H:MN2PR18MB3408.namprd18.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: N1C9Yr1O5+DdgABuMFM7SCv2w967JkoGmCnnJtQgUShwVOSJiVUNCKc4t6hTr5Tb8C5Rs5HgLG5PyDPTj+wgDXiwX+0HYiO6kAlaXXRgZ1fAvM1jgKE0OvPphGnX1iMFP7zdx9kcjVVkWHGUZ4saM3qpyhyrPM/EVwOdA8W1QV2SC7NDWNYI0VWZcIGy99k0J7vB+jgmtydoNo5AzhLPpuc7TbKkV241raCaLbZyO+c2uD//znK33YNpgWoyXbtKC0B+AQ9PrduVEcD+gakCkJjqAfICJgpMafBvhZOlLG7ijK0I5r0qyB1YUZX/XskIRWDZAYidUlNWiwYnjBdrD0BJuucJEhic1mZ5vhQCYiZwoPtSgl3PsqbSV7DV1y/6RkGGPM3/DP/8i0TXxlwRH/8YnA39AnKHTlwkYnv5t7bJciGVjllvNHgcX1NpAeN3 MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 8cb39542-b3e9-44ab-2a70-08d7629c589a X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 09:33:14.0521 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: n5u6D0JgnMACcghZjGC8aNSI3WZyvsxR7uOJRw1TRIXC4njpTPhLiOs5agzlQ3OKm8WJVG+UORQbhCELfQzatw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3165 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-06_02:2019-11-06,2019-11-06 signatures=0 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org Reduce the indentation level in edac_mc_handle_error() a bit by using continue. No functional changes. Signed-off-by: Robert Richter Reviewed-by: Mauro Carvalho Chehab --- drivers/edac/edac_mc.c | 57 +++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index 8bfe76d1bdf1..3dc1c5afabce 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -1171,36 +1171,37 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, * channel/memory controller/... may be affected. * Also, don't show errors for empty DIMM slots. */ - if (e->enable_per_layer_report && dimm->nr_pages) { - if (n_labels >= EDAC_MAX_LABELS) { - e->enable_per_layer_report = false; - break; - } - n_labels++; - if (p != e->label) { - strcpy(p, OTHER_LABEL); - p += strlen(OTHER_LABEL); - } - strcpy(p, dimm->label); - p += strlen(p); + if (!e->enable_per_layer_report || !dimm->nr_pages) + continue; - /* - * get csrow/channel of the DIMM, in order to allow - * incrementing the compat API counters - */ - edac_dbg(4, "%s csrows map: (%d,%d)\n", - mci->csbased ? "rank" : "dimm", - dimm->csrow, dimm->cschannel); - if (row == -1) - row = dimm->csrow; - else if (row >= 0 && row != dimm->csrow) - row = -2; - - if (chan == -1) - chan = dimm->cschannel; - else if (chan >= 0 && chan != dimm->cschannel) - chan = -2; + if (n_labels >= EDAC_MAX_LABELS) { + e->enable_per_layer_report = false; + break; + } + n_labels++; + if (p != e->label) { + strcpy(p, OTHER_LABEL); + p += strlen(OTHER_LABEL); } + strcpy(p, dimm->label); + p += strlen(p); + + /* + * get csrow/channel of the DIMM, in order to allow + * incrementing the compat API counters + */ + edac_dbg(4, "%s csrows map: (%d,%d)\n", + mci->csbased ? "rank" : "dimm", + dimm->csrow, dimm->cschannel); + if (row == -1) + row = dimm->csrow; + else if (row >= 0 && row != dimm->csrow) + row = -2; + + if (chan == -1) + chan = dimm->cschannel; + else if (chan >= 0 && chan != dimm->cschannel) + chan = -2; } if (!e->enable_per_layer_report) { From patchwork Wed Nov 6 09:33:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 11229799 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EEC7C15AB for ; Wed, 6 Nov 2019 09:34:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BFA32217F4 for ; Wed, 6 Nov 2019 09:34:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="vRHIGQLi"; dkim=pass (1024-bit key) header.d=marvell.onmicrosoft.com header.i=@marvell.onmicrosoft.com header.b="Aa9WaJcN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731678AbfKFJda (ORCPT ); Wed, 6 Nov 2019 04:33:30 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:39408 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731188AbfKFJd3 (ORCPT ); Wed, 6 Nov 2019 04:33:29 -0500 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA69UVbe002968; Wed, 6 Nov 2019 01:33:19 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=xOZqgtBcg3LLHkIs2/DBb8m5Zq5RxLsNLKG8Sk18sZ4=; b=vRHIGQLiebjF7mTfb0KTcQgspgUA1Wzt3rn41uz4KEzDTH2G/NSX6dyvh/NDgXkHaMAk +3L+ZBXM55ObPATDnQi5UfFYP5Vc+sCgMIECJGUWZxdc/vv0Aj+waWJK6u814M6SYbOE 7mr1EiKK3/Y7azHxViBrerg2s6/tz+ypXufii4kmbqD6uJM6UYnAtWfhT2mqAFnZJA7/ 04LAnzpbJdMLGnfaMAv6r9FejfTjNfJ1sp+n/hIgVeNn3MjfHa9MjELgmVsexAIP1ua+ 1k3TZmILmEvyNaQswMa22cqHd28u2FulFUuVjS6yh2pQlKMRLLVWr8M5MJ7c3XbKQWsZ dw== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2w3eud3c6y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2019 01:33:19 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Nov 2019 01:33:18 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.55) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 6 Nov 2019 01:33:18 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PM0cPOVDXiv06V0vwyJjfKuS+pJIrcu0gUewnHAq09hFziq2NxJ9bLtE+dNupHFaNcvLY7mRTkGW6ntqu54Yz07Ziw4+S6Bz81zjKb/G7Hm6w1TOJEgsDWVQspvwy+4VdxQvMGofyRzyF1h/fiGTi/A6h1RDuThFK3CmYOb3I1MG7Rqowsk3aIuQcYbLPlyTL5xISdQgRITVbj0x5LjgnJKqIIWn4+I9xTB7w/Cf1ArTMZjoTwYfclL8kJjnsiXiBczmCyKTxk+F7R8bJA13Tc84t78R0D6P38SwBspPkdn2SZ9XSmsNS9gUdT/uYDD3btfq+RU1mvWo1eWnCB1Hzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xOZqgtBcg3LLHkIs2/DBb8m5Zq5RxLsNLKG8Sk18sZ4=; b=bb4nM2hBFneRdl2/re6SO1ZIyMn5eiYJaEt3WOKbSCEPBiI+3B3AVNdHJliRgj0jrEZ2HNbHhjskoKNbnB+SoQc1cRdDIqj7ZZgKEC9exr2t8NYwEDpZQ71Bdj8oJ1aDiorA1r+I27bJmbz6bPC1zIa0H8Pw9ntJwE0f0LCoVC076h2xP7wO1w8YC6DVbfDfoUYx3ms6UywJqNZTVjIaV+ANWYL0q2/gxluHvzHyfQBtOqadtkmBzFXLWTTQ6G9pyd746rtgvncfHT4r0yBb4q53Djy5IQ0er1smjla2mwiMJP6HhkorHlDp6T+01Ulvn8bwE1idbT5MHwwoQHZSoA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xOZqgtBcg3LLHkIs2/DBb8m5Zq5RxLsNLKG8Sk18sZ4=; b=Aa9WaJcNYCwneSI4wc1H/Ps4qoqp2TS7bviCYS9sJ5gvb+nd3UXbScHi5WXSxvLEYwIZeirJDG1HN+orekMEun6WRd1RfbUAwXUdxW986tHf9D6l8m6ID7S5tz2Y0Twaqkn58NwKTqITA+nB35dfmj5HaAG2HzAa2GXTVb6Pcg0= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB3165.namprd18.prod.outlook.com (10.255.236.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Wed, 6 Nov 2019 09:33:16 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6%6]) with mapi id 15.20.2430.020; Wed, 6 Nov 2019 09:33:16 +0000 From: Robert Richter To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck CC: James Morse , Robert Richter , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Mauro Carvalho Chehab" Subject: [PATCH v2 07/20] EDAC, mc: Rename iterator variable to idx Thread-Topic: [PATCH v2 07/20] EDAC, mc: Rename iterator variable to idx Thread-Index: AQHVlIU3+vlvqIYzsUKSv/A0AIxuNg== Date: Wed, 6 Nov 2019 09:33:16 +0000 Message-ID: <20191106093239.25517-8-rrichter@marvell.com> References: <20191106093239.25517-1-rrichter@marvell.com> In-Reply-To: <20191106093239.25517-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0287.eurprd05.prod.outlook.com (2603:10a6:7:93::18) To MN2PR18MB3408.namprd18.prod.outlook.com (2603:10b6:208:165::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [31.208.96.227] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a8604ed4-d044-4760-3029-08d7629c59f4 x-ms-traffictypediagnostic: MN2PR18MB3165: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4941; x-forefront-prvs: 02135EB356 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(396003)(376002)(39860400002)(346002)(136003)(199004)(189003)(52116002)(305945005)(6486002)(76176011)(71190400001)(71200400001)(256004)(11346002)(446003)(7736002)(6436002)(4326008)(6512007)(66446008)(66556008)(66476007)(66946007)(64756008)(5660300002)(1076003)(476003)(6116002)(3846002)(110136005)(54906003)(36756003)(2906002)(8676002)(99286004)(81166006)(81156014)(316002)(8936002)(50226002)(486006)(6506007)(386003)(102836004)(66066001)(2616005)(86362001)(478600001)(25786009)(186003)(14454004)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR18MB3165;H:MN2PR18MB3408.namprd18.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: nBzpw7wRjCN8t4x+8f5bPVm1Fpvjooq/QhjosKdNf6A/oLRsAwQpM0lPGpuEsO6DqdB5ksWzkR43ChiqfhHdS6u/AIGti0x5cXDlcGJYBqHrme8xsOpYahqCvg39QuTW6HmzZEyLAX1eGwyyFHogwE+5xLdO5U5J1243gIrOx3MkTFASQliZiu80WDnqwangHFIVkFlN/kSEqtU0p6Tp7zxGFXJbM5sy9e8dk04mPFBE7HoNap7x88eFo0xu3kPjvlNGVD+Q+V3TsvoiQebq0b7XahRzY4j5QZWy8H3GNbm9J7wdA93Z9Pn3BPlUpWnNiHt7AQIaq6XQmI7GcLmBjfIcnA+ipzcwBGxKx7X7v8GW9Ilmb3yZxGA1bgStIBEuuYdIsgANXm3DRK6Ex3Ky5AwjQctwq+WDzNbwM6bXRtoLW8r91Eb2iLDWV3o3d6bH MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: a8604ed4-d044-4760-3029-08d7629c59f4 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 09:33:16.4097 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: KoeNa76vt2K83LytVNVmyJ3b453g1CdcuxFYtmrKh5ekM4kTOoB5xMwVnVbct3hwbMGdTClkJdfhjVIdJSnNrA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3165 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-06_02:2019-11-06,2019-11-06 signatures=0 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org Rename iterator variable to idx. The name is more handy, esp. when searching it in the code. Signed-off-by: Robert Richter Reviewed-by: Mauro Carvalho Chehab --- drivers/edac/edac_mc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index 3dc1c5afabce..f76252b7a787 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -330,14 +330,14 @@ struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num, * Calculate the total amount of dimms and csrows/cschannels while * in the old API emulation mode */ - for (i = 0; i < n_layers; i++) { - tot_dimms *= layers[i].size; - if (layers[i].is_virt_csrow) - tot_csrows *= layers[i].size; + for (idx = 0; idx < n_layers; idx++) { + tot_dimms *= layers[idx].size; + if (layers[idx].is_virt_csrow) + tot_csrows *= layers[idx].size; else - tot_channels *= layers[i].size; + tot_channels *= layers[idx].size; - if (layers[i].type == EDAC_MC_LAYER_CHIP_SELECT) + if (layers[idx].type == EDAC_MC_LAYER_CHIP_SELECT) per_rank = true; } From patchwork Wed Nov 6 09:33:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 11229801 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C73621864 for ; Wed, 6 Nov 2019 09:34:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9A652217F4 for ; Wed, 6 Nov 2019 09:34:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="EvlZt1mJ"; dkim=pass (1024-bit key) header.d=marvell.onmicrosoft.com header.i=@marvell.onmicrosoft.com header.b="XFeOBuiA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731676AbfKFJda (ORCPT ); Wed, 6 Nov 2019 04:33:30 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:27414 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731673AbfKFJd3 (ORCPT ); Wed, 6 Nov 2019 04:33:29 -0500 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA69UNGM002538; Wed, 6 Nov 2019 01:33:22 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=BwXLj6insvqCGInDaPqtbbjZNtDoe7WJv9A9oT07o3Q=; b=EvlZt1mJ7KMKnZDRQjCnFJjPDJRtFCUpHGUWJCnoGLkFBWf5my2cGzxicguqbtwFS3Zq yWJy4r6PhYZzMVaSJcUZArQ+9dU3GqsldnKrf2paABJXOslbuP/PxZOwF80zjHapmAS8 cQe3uyvkpbTrymf8Vk9R4yXuEoYyorTp8J7of7eQznOvubkIvg9EUwz8egRQp79D5gEV qxQZAgjL/68xlay8ztOs6C1MBYDp03Gsodu8VaBwWY8GTA0+KBYgMmhlP6Khusym2z9l gPW/i1cAMevyZIdL7rQChvUXNLWvZGhcZbBT8HwRGkzmCxioNtqMXQh2PMDdV/czVNjD pQ== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2w3eud3c7a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2019 01:33:22 -0800 Received: from SC-EXCH02.marvell.com (10.93.176.82) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Nov 2019 01:33:21 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.57) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 6 Nov 2019 01:33:21 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z60i9NsFh/VO76d6YU+K2f75/D/U5jXzvElhSFwssp+EL+AokFUgtlPYb6CC8RyJYv0i7jWmADfG6hICfbpfDBWS7SEpX9oWN0toG/D/RC0+ZuSwMlQHP0TdgETkCO+G9bAAhGSxyQduaMZwkNzGrd1U7NBQFq1626fdBtNAKZW/6RkabS+/H42hWiFccoArypSNsalqkrZ23iJdctXR4cWegJ5lmheRkTaBC2VJl/XJer4egvnoVrv+XExVBkC0MG6Ex+CLQzCOWJFIlzDY+X34/JEaXX8fkH29dyxks6CwglueoPZQqN18LCef7wwdQuqJ7RJm6LMN/MiFURixEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BwXLj6insvqCGInDaPqtbbjZNtDoe7WJv9A9oT07o3Q=; b=Qdgs2ffJY6YYqYR+k0nXXsY/eIsSCl8FX9EWkY2neO4YooTBdPI1YJoHP5j/Za0PRCsbedhNmGOcvpGpNu6jdFPKgJcED1RyAzf8w7R+KlNGedpwXFByjSdmYp1DYDDulyxpckh4gTQ/N3D8Fn0+uezOL4FrB8K5JprxeQDc8VbaXZq9scfSTgJtn2bgYLSFsTPp/22WfAUjRcJBr5FpHkESMOAvrF83427J/4SB/8ghxp/dMbZ1PfMKFTn5C0eM1toF3el6IoelB3idiYQcJdT/qxZju/4RDXpxoMV5yu6MUqd4noKvmCKxRLTTi8F+Fo0iWFyN4KjIjIFFy7RJcg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BwXLj6insvqCGInDaPqtbbjZNtDoe7WJv9A9oT07o3Q=; b=XFeOBuiAmi0GqX5RT3iD3/xGFLI1FfpDLb8AXmaVtfSXhXJap0In/KZzP0QJOeNaDZg1G08kaDmWhzi+4Wjvxcc6RQ6l7rC2J9EtOHuTKNvGXUm35PMmGW3mJnId7Iwh8LtzwoMRRm6mrm3tY/g2ZvaEuAlL7rCEP2w+piMbPRM= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB3165.namprd18.prod.outlook.com (10.255.236.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Wed, 6 Nov 2019 09:33:18 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6%6]) with mapi id 15.20.2430.020; Wed, 6 Nov 2019 09:33:18 +0000 From: Robert Richter To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck CC: James Morse , Robert Richter , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Mauro Carvalho Chehab" Subject: [PATCH v2 08/20] EDAC: Remove misleading comment in struct edac_raw_error_desc Thread-Topic: [PATCH v2 08/20] EDAC: Remove misleading comment in struct edac_raw_error_desc Thread-Index: AQHVlIU55TRYGs3MD0igG2O9hLwARw== Date: Wed, 6 Nov 2019 09:33:18 +0000 Message-ID: <20191106093239.25517-9-rrichter@marvell.com> References: <20191106093239.25517-1-rrichter@marvell.com> In-Reply-To: <20191106093239.25517-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0287.eurprd05.prod.outlook.com (2603:10a6:7:93::18) To MN2PR18MB3408.namprd18.prod.outlook.com (2603:10b6:208:165::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [31.208.96.227] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 6571ed93-312f-46e7-601c-08d7629c5b5e x-ms-traffictypediagnostic: MN2PR18MB3165: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5236; x-forefront-prvs: 02135EB356 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(396003)(376002)(39860400002)(346002)(136003)(199004)(189003)(52116002)(305945005)(6486002)(4744005)(76176011)(71190400001)(71200400001)(256004)(11346002)(446003)(7736002)(6436002)(4326008)(6512007)(66446008)(66556008)(66476007)(66946007)(64756008)(5660300002)(1076003)(476003)(6116002)(3846002)(110136005)(54906003)(36756003)(2906002)(8676002)(99286004)(81166006)(81156014)(316002)(8936002)(50226002)(486006)(6506007)(386003)(102836004)(66066001)(2616005)(86362001)(478600001)(25786009)(186003)(14454004)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR18MB3165;H:MN2PR18MB3408.namprd18.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ndQPSKuDFhrYlqtjnLfr9f9fyiXGqqSDh1If3A5dSj4oh0RBtY6XezktrvwW7C7UMq+PFkE+zv5DWomSb4ws6gv/wqc4gfc8wJGx7ZhPdgqi7EILeI351raUr5xgQ94BDM0QKJ0aTqN0a9YvWOaFm1rT7WKNB7TPm22FSF/ZilZ7IRhWV3FlH+FnKw3/KF2g2lw/J+xHcaCSzimjgD9MvYrx2zJibPpdwhFC6h3U8CSLeTqleqgDQXjco/vMptFOZOvTefw+3ECRPBbCM97G4agj+TCxJygqBPUGNwvQIHSreuPdn/1GaRvUKC1UhHx7iFKgW+5IsdrDbsRwr06oQ0Y8zEu8PXrsQCEPddq7r14SmqQ7xHYgYrMgqTql7Kby4OjYfADxns8KxLlA9G3atOYzGFti6LnljeCFuPzdLCbqB2+qKAMRCJTymLMu+FGI MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 6571ed93-312f-46e7-601c-08d7629c5b5e X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 09:33:18.7244 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 23tGE03uKb7dc6iQ33DhwTH0rbLVUVLVFI4RcFUrF19zxPehAVBJZyCXOHmcgpSd9WfZ3jiNIdl/OGu+J5S0tw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3165 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-06_02:2019-11-06,2019-11-06 signatures=0 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org There never has been such function edac_raw_error_desc_clean() and in function ghes_edac_report_mem_error() the whole struct is zero'ed including the string arrays. Remove that comment. Signed-off-by: Robert Richter Reviewed-by: Mauro Carvalho Chehab --- include/linux/edac.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/include/linux/edac.h b/include/linux/edac.h index 8beb6e834be9..67be279abd11 100644 --- a/include/linux/edac.h +++ b/include/linux/edac.h @@ -457,15 +457,10 @@ struct errcount_attribute_data { * (typically, a memory controller error) */ struct edac_raw_error_desc { - /* - * NOTE: everything before grain won't be cleaned by - * edac_raw_error_desc_clean() - */ char location[LOCATION_SIZE]; char label[(EDAC_MC_LABEL_LEN + 1 + sizeof(OTHER_LABEL)) * EDAC_MAX_LABELS]; long grain; - /* the vars below and grain will be cleaned on every new error report */ u16 error_count; int top_layer; int mid_layer; From patchwork Wed Nov 6 09:33:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 11229797 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 155CB15AB for ; Wed, 6 Nov 2019 09:34:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DB57E2087E for ; Wed, 6 Nov 2019 09:34:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="Ccy53EIp"; dkim=pass (1024-bit key) header.d=marvell.onmicrosoft.com header.i=@marvell.onmicrosoft.com header.b="MZOsWiBn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729802AbfKFJdf (ORCPT ); Wed, 6 Nov 2019 04:33:35 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:8628 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730806AbfKFJde (ORCPT ); Wed, 6 Nov 2019 04:33:34 -0500 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA69Utdm003181; Wed, 6 Nov 2019 01:33:24 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=zd2Cfzw5lVu0bfmracEsDWMtt5AAZVQPJvcJyi1o1UE=; b=Ccy53EIpDo6kVm0xvzsbLYhszZ6aoquAIhbMcC8khKkyNKAX43OWWReU0QtqbeoGapOr KPZcKWxiYaB/ZgIyG7l6GTiaYdiEoSeqtVDNjdezNZfASczMoSZHm/9JkRlBIM57GmtN xNqPHS464/JWgTQpflOlsQdET0L2UbIxz43ANK1DvdMZ+Sho+qH2ogNuFE+6iv0wuwaf a8EFBkTaY6HdLjf6lFshNxbosGZ/AzSOrinok+hRVayn2fz2w/81+UcPuSs0Ou9q/MWz omo4spUpCShh0QWMR0T5u8SfdhRbqdxeIUwxXHXZbHeKRoemWnXqARXfbFMA/9vOOm8f 8A== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2w3eud3c7n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2019 01:33:24 -0800 Received: from SC-EXCH02.marvell.com (10.93.176.82) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Nov 2019 01:33:23 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.57) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 6 Nov 2019 01:33:23 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VLVH0uJFT+t7aeSMRmpos+PGC8FjwrrqvohSxvydFeFneS9QR2RtHbpC94XKLbGVsQnvxIMJTQTKdI/DuPDh29nScGilsUYj9NFsnFb9zvRJ7jlMa7UEGlW5/efQIWd5BcydbNoWzAOgPMYTjj3Nbd2MVC1WyhGRWqnuUwDZ5I649b8VKN9v+uaiq6LUIXjFPcM74BJBvhz1L5u7Ihm2FSfdzgQfe6QfG7n0zFLUpRpGykLr1xiV65AX0/UBpsBB9Sz6gzRUG4p0OwVes5TNh/0oMRWEs+WEJDKl1sPemZmlajvGCqzEDrofMZv3HLrhEAH11xacLl3nO36PxSC+Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zd2Cfzw5lVu0bfmracEsDWMtt5AAZVQPJvcJyi1o1UE=; b=ADnCe9cfPntuhx3oi6HQotsKdD2dgzzTOzU3Y+nicJYyRJWhwFSBQBIn7OTuisFec58uEcevSyNryN4Ktwy7ZxfnBlHm5BRpbcdD5Bh09DSYyhZ+ZrHlDnPCzCfzUL6mNIjYDmbcXzxE6PsYvKj1UG/f4LhySfHOflxmfLvlfDAlgO8qHMMhqDOw4SNRTazhRajI3iE3ZVXv9L/Y74yL4hya2360WePensONaCWoS88Eo47K0K6eep851/BHX+brLfRqaOrHX7rDix8VDkVTRjHDigVIr1ZIwgRLTPN2Glmpx7b2L0mn/D5q9PoOwg1WLVqoVekFiTCtxfztzzZWlA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zd2Cfzw5lVu0bfmracEsDWMtt5AAZVQPJvcJyi1o1UE=; b=MZOsWiBnspdccokr+4jKQKOCO/tiFqmxS7vJ71LYccw3SzuixdW9X0CkazaK6xtXvd9+DRE6izWIpv2hk1CVyWh38RBkJsfrHm3ILlDrtyUfKo+Y10mB85DHEkX9k0x4u3oZ3XJENv2PVjRepe/VM0aYATW998t1AsDZlNWOSCA= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB3165.namprd18.prod.outlook.com (10.255.236.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Wed, 6 Nov 2019 09:33:21 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6%6]) with mapi id 15.20.2430.020; Wed, 6 Nov 2019 09:33:21 +0000 From: Robert Richter To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck CC: James Morse , Robert Richter , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Mauro Carvalho Chehab" Subject: [PATCH v2 09/20] EDAC, ghes: Use standard kernel macros for page calculations Thread-Topic: [PATCH v2 09/20] EDAC, ghes: Use standard kernel macros for page calculations Thread-Index: AQHVlIU6hXDtOVRZN0C/PhW6zmjwvw== Date: Wed, 6 Nov 2019 09:33:20 +0000 Message-ID: <20191106093239.25517-10-rrichter@marvell.com> References: <20191106093239.25517-1-rrichter@marvell.com> In-Reply-To: <20191106093239.25517-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0287.eurprd05.prod.outlook.com (2603:10a6:7:93::18) To MN2PR18MB3408.namprd18.prod.outlook.com (2603:10b6:208:165::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [31.208.96.227] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b55b76c9-0ea0-4ba8-771a-08d7629c5cb9 x-ms-traffictypediagnostic: MN2PR18MB3165: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1775; x-forefront-prvs: 02135EB356 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(396003)(376002)(39860400002)(346002)(136003)(199004)(189003)(52116002)(305945005)(6486002)(4744005)(76176011)(71190400001)(71200400001)(256004)(11346002)(446003)(7736002)(6436002)(4326008)(6512007)(66446008)(66556008)(66476007)(66946007)(64756008)(5660300002)(1076003)(476003)(6116002)(3846002)(110136005)(54906003)(36756003)(2906002)(8676002)(99286004)(81166006)(81156014)(316002)(8936002)(50226002)(486006)(6506007)(386003)(102836004)(66066001)(2616005)(86362001)(478600001)(25786009)(186003)(14454004)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR18MB3165;H:MN2PR18MB3408.namprd18.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: yXm8CC95/lk4aLQ8T7P+3lnohaC+Gd3I1dL5I21WK0+Wl/KQWhWansIsouN/4DwOO/ofkT7Y39Ipx8e5so06GA0Zthg7V8dDzVtKY0Zn0AL1XtePG/rgRQAwhn1Hdq7UuKAlLvAYwpwxHVeVztXLTBgMVFYgTVXVjNbpZUEbDy/LiiWj4f60qoQlmcLAfmpknCGlqF+Bvdr4Ap95d/Zw3xWxx/HQMHIJwTdWYy/dL0rCOg/523oPC1OBUfn3thbfk6TkBNJsnGyCmxjgSFNbhW4YGjVyhUke4+OCY4F9ZuawMnRPjH7Wp7VdF57w1iAKLePRb96sb/HGl/CfhxzlEUZhjMRVRuyu9lHDXxGT/lcUIGyrdDHRoClcxBxKXr3rFB8VWiTtRgsO/l9yxo2TyVJxSM7Cc26PjqtCZ8Lu/YvlaWNV7rzmQX8iVeb+X3AG MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: b55b76c9-0ea0-4ba8-771a-08d7629c5cb9 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 09:33:20.9801 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ZQ3vtC/bHa85Jh5MHWsgn38Rv7/+pyRdcro+CalmxYW7k/gRtP8iFsHKvSgonRf8Ot2MzZJRd5OiOTu59cA/VA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3165 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-06_02:2019-11-06,2019-11-06 signatures=0 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org Use standard macros for page calculations. Signed-off-by: Robert Richter Reviewed-by: James Morse Reviewed-by: Mauro Carvalho Chehab --- drivers/edac/ghes_edac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c index af27f8063891..944c9d2f0eef 100644 --- a/drivers/edac/ghes_edac.c +++ b/drivers/edac/ghes_edac.c @@ -319,8 +319,8 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) /* Error address */ if (mem_err->validation_bits & CPER_MEM_VALID_PA) { - e->page_frame_number = mem_err->physical_addr >> PAGE_SHIFT; - e->offset_in_page = mem_err->physical_addr & ~PAGE_MASK; + e->page_frame_number = PHYS_PFN(mem_err->physical_addr); + e->offset_in_page = offset_in_page(mem_err->physical_addr); } /* Error grain */ From patchwork Wed Nov 6 09:33:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 11229775 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B562015AB for ; Wed, 6 Nov 2019 09:33:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7E8A321A49 for ; Wed, 6 Nov 2019 09:33:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="I83jqS5i"; dkim=pass (1024-bit key) header.d=marvell.onmicrosoft.com header.i=@marvell.onmicrosoft.com header.b="FjVEtf4w" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731724AbfKFJdi (ORCPT ); Wed, 6 Nov 2019 04:33:38 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:14734 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731712AbfKFJdi (ORCPT ); Wed, 6 Nov 2019 04:33:38 -0500 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA69UNGN002538; Wed, 6 Nov 2019 01:33:25 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=NMz8HKNPT5n+l5k0+GACBMBQDogCHu2Sf6ZMz11U42c=; b=I83jqS5i0j6nbdKl2t0RALqPfwO+RAtXG21xVOJSkLr2CJrvdojNi9LPCuxbl2ZUr+9S L7aLPTP9kCXER6FigmMsSy2ngyy9IFVVGnxxa1LBDfmwi/YwVUO7QcGLuCpBXksv760v qDEycAnwsuSTWBT3HR+QdVNJqcsCE02n7Hyy/eG3SNl/7LULBNkJzaoDgDE/wbCz4gyh dkPhARRqVhv6tET4MbVD6zA532ZvRrVN2EhhLNI0q898fN3oUVNmd6yNQvuqI6svtGlo 6Hi+uBCnVU7BEwdaWOp19Y60bTJ7MU9ugAeS3h1nhQX2vPEL7i4OouwIcBdia9LfmxHD 6g== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2w3eud3c7t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2019 01:33:25 -0800 Received: from SC-EXCH02.marvell.com (10.93.176.82) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Nov 2019 01:33:24 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.57) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 6 Nov 2019 01:33:24 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dFe9kepT0I8qxeKcZLoW8VrB+qoC+wP13YZhme0imBXTAFQdkyGanIC3+6odH0/KNY5+YQaR9BXOY1KmxB1f8Ld0glVyvFVDyX2GVx+pLJtuOxucwddwSEV9D2sOudQdWOECAoA8rrO9lbzA5jkqqW1Pmgx/Ekyz6EN9HfppBa6Q342lOU2eozzW0wVCyEi0g/T1ym+qREHFI8HnVpdGLnvEGPLLUT7faaEFqWU00x5HKXRk0GGt8NGnwr8buIgD2pjg7bBwcByP3n37EjllDvKlztGI1ojThGFxvsUeDojkrfYHsQDHRBohQEbq+19NFB3D5lCXbMwjuNq1YHiPUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NMz8HKNPT5n+l5k0+GACBMBQDogCHu2Sf6ZMz11U42c=; b=C+L9pxpoR04ij6qaNkguuh/EzavlOCKdaEehUr5rx5NmoozgB64ytQRpDIauYRohfiYmvCc6HsyLKaNNGlPwsau93ba4lptJzC5Vj8I+cJDZNdQr8201I3faRIXvIFC6fu4NGdflAVt7xpWUDkKh1XuM+TZLvp2FVLRIs1BuV7g4MUBC7NcNi85WPmXadyncOONRdVvb2mUmLlTvRkptEoZmACQOS68hVswjGvKqIgmpgYV6tJCnU8QFG0JZyAUjieqXtad1d1xkFCdmJ8P0+IdyZLc6hrIZo3oZkccRi4IYQMfWFVTUlkPh1JD/lJCB4rDXSgl+6WGw0nWEys2oww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NMz8HKNPT5n+l5k0+GACBMBQDogCHu2Sf6ZMz11U42c=; b=FjVEtf4wcRq9q1wlNUO0sMqXK/8sWDLWRhJO8Lla4W+UEVOpzLJdYzf6sItJdvlUKN9V9kU9EvaqgRLcrcLrFfUWFYGwMfYmDV/sF/FAMEw96aV1LK8P6OqLwhi7mQ0NgJu+tvCOsH3p3VEOy2qtSI3cuAN21L+3qcCxjVxcYWA= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB3165.namprd18.prod.outlook.com (10.255.236.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Wed, 6 Nov 2019 09:33:23 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6%6]) with mapi id 15.20.2430.020; Wed, 6 Nov 2019 09:33:23 +0000 From: Robert Richter To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck CC: James Morse , Robert Richter , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Mauro Carvalho Chehab" Subject: [PATCH v2 10/20] EDAC, ghes: Fix grain calculation Thread-Topic: [PATCH v2 10/20] EDAC, ghes: Fix grain calculation Thread-Index: AQHVlIU7o+YOpjBkNEWoXqVKFSptpA== Date: Wed, 6 Nov 2019 09:33:23 +0000 Message-ID: <20191106093239.25517-11-rrichter@marvell.com> References: <20191106093239.25517-1-rrichter@marvell.com> In-Reply-To: <20191106093239.25517-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0287.eurprd05.prod.outlook.com (2603:10a6:7:93::18) To MN2PR18MB3408.namprd18.prod.outlook.com (2603:10b6:208:165::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [31.208.96.227] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 23536f82-a3a2-427f-5eb6-08d7629c5e0f x-ms-traffictypediagnostic: MN2PR18MB3165: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-forefront-prvs: 02135EB356 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(396003)(376002)(39860400002)(346002)(136003)(199004)(189003)(52116002)(305945005)(6486002)(76176011)(71190400001)(71200400001)(256004)(11346002)(446003)(7736002)(14444005)(6436002)(4326008)(6512007)(66446008)(66556008)(66476007)(66946007)(64756008)(5660300002)(1076003)(476003)(6116002)(3846002)(110136005)(54906003)(36756003)(2906002)(8676002)(99286004)(81166006)(81156014)(316002)(8936002)(50226002)(486006)(6506007)(386003)(102836004)(66066001)(2616005)(86362001)(478600001)(25786009)(186003)(14454004)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR18MB3165;H:MN2PR18MB3408.namprd18.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 2uxxCzhad9EezHB1UNLwr6tbLPmM2AEomQrGKRK9htTJDCL+eihaNTViO6BzSPNjGS4DNXJivYEh5o+sxDvQHy92zO3GDZ80ZNsG7/3qNqIcc5EPrF1SNTsJRnuqLZId2Gj2ZahGrUyF0NdmZzl/aToKDRaF/fvHHvj7G32UeQmPP1zPjSt+/Pni7gonqzfc1wlN3vxHilpmCi+ST7sMYOGZWOnVQWt1jCgkooSjM3NgZXh7F4h38v3hPstge8AB+JqKO/0gnUw/U1cYitXiKhqs5Q6a+sjnxZQdVnfZbG+6Kq19w4hzZJDMHWURXUcsVQABKmG557lItjAvy7c2qrlNzl23H4Q4dKfLaB4ufohDPoYkpojhTOBreCVOd7udL0GPB5d0wf09TJwwRXktRDcSq+dlhlqOg0BEzWVHyzLeoBxw8qPeVmBMsShWty/B MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 23536f82-a3a2-427f-5eb6-08d7629c5e0f X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 09:33:23.2458 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: rj70I2Ckb3CdrS6FF5/FpbMCMwVs89+mJJ+QWNVzKCgEvpTXKNKAfmqbR0MvEXJH4ppxwgITB6j9DN2dcgVkAw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3165 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-06_02:2019-11-06,2019-11-06 signatures=0 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org The current code to convert a physical address mask to a grain (defined as granularity in bytes) is: e->grain = ~(mem_err->physical_addr_mask & ~PAGE_MASK); This is broken in several ways: 1) It calculates to wrong grain values. E.g., a physical address mask of ~0xfff should give a grain of 0x1000. Without considering PAGE_MASK, there is an off-by-one. Things are worse when also filtering it with ~PAGE_MASK. This will calculate to a grain with the upper bits set. In the example it even calculates to ~0. 2) The grain does not depend on and is unrelated to the kernel's page-size. The page-size only matters when unmapping memory in memory_failure(). Smaller grains are wrongly rounded up to the page-size, on architectures with a configurable page-size (e.g. arm64) this could round up to the even bigger page-size of the hypervisor. Fix this with: e->grain = ~mem_err->physical_addr_mask + 1; The grain_bits are defined as: grain = 1 << grain_bits; Change also the grain_bits calculation accordingly, it is the same formula as in edac_mc.c now and the code can be unified. The value in ->physical_addr_mask coming from firmware is assumed to be contiguous, but this is not sanity-checked. However, in case the mask is non-contiguous, a conversion to grain_bits effectively converts the grain bit mask to a power of 2 by rounding up. Suggested-by: James Morse Signed-off-by: Robert Richter Reviewed-by: Mauro Carvalho Chehab --- drivers/edac/ghes_edac.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c index 944c9d2f0eef..4acb456c20f7 100644 --- a/drivers/edac/ghes_edac.c +++ b/drivers/edac/ghes_edac.c @@ -230,6 +230,7 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) /* Cleans the error report buffer */ memset(e, 0, sizeof (*e)); e->error_count = 1; + e->grain = 1; strcpy(e->label, "unknown label"); e->msg = pvt->msg; e->other_detail = pvt->other_detail; @@ -325,7 +326,7 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) /* Error grain */ if (mem_err->validation_bits & CPER_MEM_VALID_PA_MASK) - e->grain = ~(mem_err->physical_addr_mask & ~PAGE_MASK); + e->grain = ~mem_err->physical_addr_mask + 1; /* Memory error location, mapped on e->location */ p = e->location; @@ -441,8 +442,13 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) if (p > pvt->other_detail) *(p - 1) = '\0'; + /* Sanity-check driver-supplied grain value. */ + if (WARN_ON_ONCE(!e->grain)) + e->grain = 1; + + grain_bits = fls_long(e->grain - 1); + /* Generate the trace event */ - grain_bits = fls_long(e->grain); snprintf(pvt->detail_location, sizeof(pvt->detail_location), "APEI location: %s %s", e->location, e->other_detail); trace_mc_event(type, e->msg, e->label, e->error_count, From patchwork Wed Nov 6 09:33:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 11229795 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4773F1864 for ; Wed, 6 Nov 2019 09:34:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1AB212087E for ; Wed, 6 Nov 2019 09:34:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="FgEXFthC"; dkim=pass (1024-bit key) header.d=marvell.onmicrosoft.com header.i=@marvell.onmicrosoft.com header.b="ws75bOz6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731327AbfKFJdh (ORCPT ); Wed, 6 Nov 2019 04:33:37 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:16304 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731153AbfKFJdg (ORCPT ); Wed, 6 Nov 2019 04:33:36 -0500 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA69UVbg002968; Wed, 6 Nov 2019 01:33:28 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=XNb2IwKFs7xqhsbp0NuXTpSpc68SXycHhJlp2ERbujo=; b=FgEXFthCexwHIIp1scTCVAha+c3yBAV5nyC5zEX6kB289l6OE0drPC3EW5+8gslYaHyx fzQQF2ZzC79dSuub8Y+bygsaJDitpowWkHegCGjGS8dAHgb8tgzbm1I4887sqFK2/xJE rQYzj2Pk/9W/yQ8knJhHwR1sAXsyjSYxb8pIbOn0IKv/xq3RDey4mvzRLLZ0O51RBwJ6 J/+j/spnyZjYsg6yRirUoMsuSGUuuyOpW3QrBj663PZKDiml+qppvy/6OI0r1nw92uR5 D+LsqVi0/OK8xKvDvwk4DB5c06g6mpfcCe/lqv+qKHmd50tff0oy7LATj4MYRtLiVJ7f cA== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2w3eud3c81-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2019 01:33:27 -0800 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Nov 2019 01:33:27 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.51) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 6 Nov 2019 01:33:26 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F5sK0Df+xaYfZcf4FhqatRIgRX2jSSDWs6E/K2BR4Xw4hfZwUpoDsbfxo76VJOj4dz2EbH1cyM8Pla6EO8Lp/FD6iRO1ojmteBbw0qXIRX50U+NjosLi7bE67CU5zR6d1BhGiaNzc7eW0cG977qOOQeZfjigg+B/3/qfWUUOTSqDIUI2RYZBF822Vmi0WM1jAZ+UM0jvHDot1fZv3RSyW6I470WPXOkLzipLsobIYrgt76Zpc6YCVrqAcrcOY+CB+d9ij5uc+NIphy251mKqAlATO1WMrweMm46sSYggcc6i531C07laWzWIvrABMMw9f/rc4bVfJTFY6MZvIu8pLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XNb2IwKFs7xqhsbp0NuXTpSpc68SXycHhJlp2ERbujo=; b=IK5VRB8iyfE6X8yQfGI1H0QcljGu8rHviLTJ3wFzauk6xouW3FUYkiFmZTfC96UY+JDF7O2cY+LmB/GB9a0z2QFFfvzthwxQU/0O+bULuI5Gl5H5oBQcyBVwBdwk44xBluHk1QyHo0o6a4rwMivUhTqsJtlZuY6u3lAeZUkTT5mgTo98oyXlaw+pxY0myYl3AOebPqujyo92zgLyil3r8JyPq8KI7LzChlIqDvUC8RUaTfKrMxDBtP/gHV+fGAhB0iQ+rEEoRCJ8uzKYg+BPp4FBZ4pvvBIa0ZLOILtpnez/TzE7kE/P9wHizsillHPLUCv27dubWajoY5sTe/6PJw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XNb2IwKFs7xqhsbp0NuXTpSpc68SXycHhJlp2ERbujo=; b=ws75bOz6aPGKQUC5XV0TJuNc4yXC88iMOMF8IgAnaW2rFEUGJaIRhKbhYuXUuYwcXnDT87Y7kjw1V+J3G6ZCPwDaTyhYoyVIoLxcHbXM4+EG0YeZApCGhkUX5tK9eURNc2YRNiFwxJBa8D7C/gpKXxQxbGhsTjUx3ubLpQncTTc= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB3165.namprd18.prod.outlook.com (10.255.236.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Wed, 6 Nov 2019 09:33:25 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6%6]) with mapi id 15.20.2430.020; Wed, 6 Nov 2019 09:33:25 +0000 From: Robert Richter To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck CC: James Morse , Robert Richter , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Mauro Carvalho Chehab" Subject: [PATCH v2 11/20] EDAC, ghes: Remove intermediate buffer pvt->detail_location Thread-Topic: [PATCH v2 11/20] EDAC, ghes: Remove intermediate buffer pvt->detail_location Thread-Index: AQHVlIU9Dt1I/qDcNkGuWwAY2UMBUw== Date: Wed, 6 Nov 2019 09:33:25 +0000 Message-ID: <20191106093239.25517-12-rrichter@marvell.com> References: <20191106093239.25517-1-rrichter@marvell.com> In-Reply-To: <20191106093239.25517-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0287.eurprd05.prod.outlook.com (2603:10a6:7:93::18) To MN2PR18MB3408.namprd18.prod.outlook.com (2603:10b6:208:165::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [31.208.96.227] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4fb5ccb7-e30d-4777-11e1-08d7629c5f6b x-ms-traffictypediagnostic: MN2PR18MB3165: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1824; x-forefront-prvs: 02135EB356 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(396003)(376002)(39860400002)(346002)(136003)(199004)(189003)(52116002)(305945005)(6486002)(76176011)(71190400001)(71200400001)(256004)(11346002)(446003)(7736002)(6436002)(4326008)(6512007)(66446008)(66556008)(66476007)(66946007)(64756008)(5660300002)(1076003)(476003)(6116002)(3846002)(110136005)(54906003)(36756003)(2906002)(8676002)(99286004)(81166006)(81156014)(316002)(8936002)(50226002)(486006)(6506007)(386003)(102836004)(66066001)(2616005)(86362001)(478600001)(25786009)(186003)(14454004)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR18MB3165;H:MN2PR18MB3408.namprd18.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: EXz61B048kBzJpbX/gqMXeC6U5nRjX+HeojLds+uM0I2fuJsfE0CDKhbT8xl1RShJRvoCy6C541HAyB+0iHPDmittef6mbQanpWAsQfsw1pDZEF1QzSlzyQvmnNnxkfaPNqwClNl9rIS177EcflvPuS58rZ0IFRIx8MOm2tOyWAOVdqtXqfvM/09YLSfRS1fGFP8DDkrZFBDLTeEubHGwDhvzgyF/KAHdhA0L5lIQgaTmxPJiPrenSE2CVA7vqM8Hbpng9Iis+AFtbeLluXmbdTsbLdjQ9Bgac0SDhzOVvgQjxh7Oi5algqdU//6G3z4hz4EhK1ViaJE5mFzzviMbs3HOq0LeACtmfSnTNNaJsK5DZ+r/aJ2f3cc2s0L+8gt7KvZSvkL3g02bo/cZxtw/lEzrW2hUCwTfUQOH+q6oovD/w4TqwtLXCpWvaIebzSj MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 4fb5ccb7-e30d-4777-11e1-08d7629c5f6b X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 09:33:25.4235 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: QsHobY5MBmoy7INThQGl505VAgLlaBia/LBRguQh4cyae0A4hWnvdjUqnHRLjr+yKBEMlIMoX9crZdhVG9QKxQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3165 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-06_02:2019-11-06,2019-11-06 signatures=0 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org detail_location[] is used to collect two location strings so they can be passed as one to trace_mc_event(). Instead of having an extra copy step, assemble the location string in other_detail[] from the beginning. Using other_detail[] to call trace_mc_event() is now the same as in edac_mc.c and code can be unified. Signed-off-by: Robert Richter Reviewed-by: James Morse Reviewed-by: Mauro Carvalho Chehab --- drivers/edac/ghes_edac.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c index 4acb456c20f7..cb1ab44361f0 100644 --- a/drivers/edac/ghes_edac.c +++ b/drivers/edac/ghes_edac.c @@ -21,8 +21,7 @@ struct ghes_edac_pvt { struct mem_ctl_info *mci; /* Buffers for the error handling routine */ - char detail_location[240]; - char other_detail[160]; + char other_detail[400]; char msg[80]; }; @@ -369,6 +368,8 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) /* All other fields are mapped on e->other_detail */ p = pvt->other_detail; + p += snprintf(p, sizeof(pvt->other_detail), + "APEI location: %s ", e->location); if (mem_err->validation_bits & CPER_MEM_VALID_ERROR_STATUS) { u64 status = mem_err->error_status; @@ -449,12 +450,10 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) grain_bits = fls_long(e->grain - 1); /* Generate the trace event */ - snprintf(pvt->detail_location, sizeof(pvt->detail_location), - "APEI location: %s %s", e->location, e->other_detail); trace_mc_event(type, e->msg, e->label, e->error_count, mci->mc_idx, e->top_layer, e->mid_layer, e->low_layer, (e->page_frame_number << PAGE_SHIFT) | e->offset_in_page, - grain_bits, e->syndrome, pvt->detail_location); + grain_bits, e->syndrome, e->other_detail); edac_raw_mc_handle_error(type, mci, e); unlock: From patchwork Wed Nov 6 09:33:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 11229777 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 168C415AB for ; Wed, 6 Nov 2019 09:33:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D56DC21D6C for ; Wed, 6 Nov 2019 09:33:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="rXl9YJAY"; dkim=pass (1024-bit key) header.d=marvell.onmicrosoft.com header.i=@marvell.onmicrosoft.com header.b="ofBWLLhW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731749AbfKFJdo (ORCPT ); Wed, 6 Nov 2019 04:33:44 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:47866 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730806AbfKFJdh (ORCPT ); Wed, 6 Nov 2019 04:33:37 -0500 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA69UI3s002504; Wed, 6 Nov 2019 01:33:31 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=28ko0/C+71KwI1IFv1fLLYYIQVTMncihhaWc6VOSZ7k=; b=rXl9YJAYgTs1t3cos3qXbpOx8M+D7oJ9nXrNC3lbl8QUmQciC31eUqiK2+neTUR9eURE W3pJNPrVvdjH7dKqtYcmnazMKlrWd751LfqiQTqyR8fRiCfo3iMCNMnw231iy5d/pe14 96ftrMPrGRPAQVmDxCJUDMEsrvngMDoI+7C5unP2whe6Zt2y0mZXpgmrLv25NmQRRonO TnttKgbPRiCd3PojUs19ygLInwHScR4AH3c/a4ugIGZ9CKPE4F82ENAP3EoAZSVA9GHL PvZf+8DKJGflQ52bIshIcUHnU7OOpyd/jDNIiTu7yCcQUo5gqwwqoIH8g6Gp9bgYYlk7 kw== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2w3eud3c88-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2019 01:33:30 -0800 Received: from SC-EXCH02.marvell.com (10.93.176.82) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Nov 2019 01:33:29 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.55) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 6 Nov 2019 01:33:29 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a1I0GRpESFKtgjtApa44PgsVcuvTOCynaVCOASxPj9sapmemZ80aYUJpbEk4oW516K/grL3uPidN1S2nAV4S2LTAbBFtnh52jED5FJS+nHm1hcXW5CUwqaXKxtgZ6qDe/iNSLiHY47cpMjyrvUBsBe9jE83iqni9tNHRvGUrOY3fVzKfQdCt/cWoL7hdY9XXH5ocivT+BAp5aKfrAxgYxEKfHjHHSBbO4U+E955+Pe1N4W/D0x9Ufi1+tX2TiLDBUZoEsIjD6BHcJ5fkvPMMytMmp7UHWb/Harr8+XBOS0kpHJnYwt1rmx4Su9q3gPRRjFyyylPbPJHZJrW7ky4q7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=28ko0/C+71KwI1IFv1fLLYYIQVTMncihhaWc6VOSZ7k=; b=FaiacnNxpvA/2HgEaOzqGE8qx+TzYEj+Ah7RoSWm9OdRjCVuXfkkeX9R0CIQfYoNIwBKj8pgGfVl3s4e+QDUD2Zb1MvLEc2xkGFj+1JxE7Wnw07DFBFxWP0E5JtRdoII/rKV0fnvL/SrjHzUa126+8Kg5079v+lFj+iG3ckOisTrBXjXTWySkryIrSOZ9M8LATN40d6MQBs9KqDUK+MW8r8/3SWYkugxTjdQnaiyYzj8yG7EoLdXIDOMzpaLsZKx0qWtUe0XKBVm+VHw5JTMunjSscE3jHGraNe1RFLVzTkVnsZPJuhluiGg+tneuy6b9NHQG6I1XxFP8HFkoXRQNw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=28ko0/C+71KwI1IFv1fLLYYIQVTMncihhaWc6VOSZ7k=; b=ofBWLLhWO7mmAbg1oKiZwEHmgOhcFMLfYMI18Z6KOroNDke1MQR0YuAvCUK/eO604JEypmo9fudIANW5jDkxnwlnytS11HJAi/wGXsNJ54gAhEUKaJ+RBw7oVkBIzXOE0ZLd8b//FLfiCp6Y8DdGwvlpO9QHAUUwvaJZu+vfZvM= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB3165.namprd18.prod.outlook.com (10.255.236.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Wed, 6 Nov 2019 09:33:27 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6%6]) with mapi id 15.20.2430.020; Wed, 6 Nov 2019 09:33:27 +0000 From: Robert Richter To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck CC: James Morse , Robert Richter , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Mauro Carvalho Chehab" Subject: [PATCH v2 12/20] EDAC, ghes: Unify trace_mc_event() code with edac_mc driver Thread-Topic: [PATCH v2 12/20] EDAC, ghes: Unify trace_mc_event() code with edac_mc driver Thread-Index: AQHVlIU+HDuE1rmeak2rq0BZPausfA== Date: Wed, 6 Nov 2019 09:33:27 +0000 Message-ID: <20191106093239.25517-13-rrichter@marvell.com> References: <20191106093239.25517-1-rrichter@marvell.com> In-Reply-To: <20191106093239.25517-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0287.eurprd05.prod.outlook.com (2603:10a6:7:93::18) To MN2PR18MB3408.namprd18.prod.outlook.com (2603:10b6:208:165::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [31.208.96.227] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b89a4bef-3b57-4150-c509-08d7629c60c6 x-ms-traffictypediagnostic: MN2PR18MB3165: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5236; x-forefront-prvs: 02135EB356 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(396003)(376002)(39860400002)(346002)(136003)(199004)(189003)(52116002)(305945005)(6486002)(76176011)(71190400001)(71200400001)(256004)(11346002)(446003)(7736002)(14444005)(6436002)(4326008)(6512007)(66446008)(66556008)(66476007)(66946007)(64756008)(5660300002)(1076003)(476003)(6116002)(3846002)(110136005)(54906003)(36756003)(2906002)(8676002)(99286004)(81166006)(81156014)(316002)(8936002)(50226002)(486006)(6506007)(386003)(102836004)(66066001)(2616005)(86362001)(478600001)(25786009)(186003)(14454004)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR18MB3165;H:MN2PR18MB3408.namprd18.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: GR1/2v6SXD09vtuaYSaWto9rQNB9SwZl2/giajI4ir0CCx1ilRXxFxaSAdhsXDdDsYMu6njrCSwczZ8kev2lVzmPOvnRW4hcA6zI+LZyfZPvSkwGaLX2IwmO0WKgRY+qA3WMB/irZeqpngiVp+239f5VMVKVyHk70ufobICIbAiVmzL+G5Y9yhcSfGgQYESL8zKbt02kW4HqiCcbZJ3KVJrnLKfWw3xjYpHx10zWcVFDRA2f6ByNZ5pFtXU4o4Gn41LFDfd4Rv6yaiybSR8rpV/RXJgBXuUocAETpQltGT7H8gZWqgqo+zdvsfKl6S58IfPRePjKCJDmbLQ2+QUanyB6dBiS1TA2JOyxGgzbWjYulmLfE9tFI/E9zcq4eUI+fOgy5Jggp5q5lRDz+gOUmx9R3N2nv7Q+wlhbAJQe6nC5+7sP6/MzRQmmeDKq0vLD MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: b89a4bef-3b57-4150-c509-08d7629c60c6 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 09:33:27.6662 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: fAZ3Kamb4MGn1C5JsJpmXfD94d/c9v9C2VizUEwykmolpoG0R8uoNIntb5DOJtrNI5qNXb23bACtN+8FhwGZvw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3165 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-06_02:2019-11-06,2019-11-06 signatures=0 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org The code in ghes_edac.c and edac_mc.c for grain_bits calculation and calling trace_mc_event() is now the same. Move it to a single location in edac_raw_mc_handle_error(). The only difference is the missing IS_ENABLED(CONFIG_RAS) switch, but this is needed for ghes too. Signed-off-by: Robert Richter Reviewed-by: Mauro Carvalho Chehab --- drivers/edac/edac_mc.c | 30 +++++++++++++++--------------- drivers/edac/ghes_edac.c | 13 ------------- 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index f76252b7a787..b6032f51338e 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -1057,6 +1057,21 @@ void edac_raw_mc_handle_error(const enum hw_event_mc_err_type type, { char detail[80]; int pos[EDAC_MAX_LAYERS] = { e->top_layer, e->mid_layer, e->low_layer }; + u8 grain_bits; + + /* Sanity-check driver-supplied grain value. */ + if (WARN_ON_ONCE(!e->grain)) + e->grain = 1; + + grain_bits = fls_long(e->grain - 1); + + /* Report the error via the trace interface */ + if (IS_ENABLED(CONFIG_RAS)) + trace_mc_event(type, e->msg, e->label, e->error_count, + mci->mc_idx, e->top_layer, e->mid_layer, + e->low_layer, + (e->page_frame_number << PAGE_SHIFT) | e->offset_in_page, + grain_bits, e->syndrome, e->other_detail); /* Memory type dependent details about the error */ if (type == HW_EVENT_ERR_CORRECTED) { @@ -1097,7 +1112,6 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, int row = -1, chan = -1; int pos[EDAC_MAX_LAYERS] = { top_layer, mid_layer, low_layer }; int i, n_labels = 0; - u8 grain_bits; struct edac_raw_error_desc *e = &mci->error_desc; edac_dbg(3, "MC%d\n", mci->mc_idx); @@ -1235,20 +1249,6 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, if (p > e->location) *(p - 1) = '\0'; - /* Sanity-check driver-supplied grain value. */ - if (WARN_ON_ONCE(!e->grain)) - e->grain = 1; - - grain_bits = fls_long(e->grain - 1); - - /* Report the error via the trace interface */ - if (IS_ENABLED(CONFIG_RAS)) - trace_mc_event(type, e->msg, e->label, e->error_count, - mci->mc_idx, e->top_layer, e->mid_layer, - e->low_layer, - (e->page_frame_number << PAGE_SHIFT) | e->offset_in_page, - grain_bits, e->syndrome, e->other_detail); - edac_raw_mc_handle_error(type, mci, e); } EXPORT_SYMBOL_GPL(edac_mc_handle_error); diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c index cb1ab44361f0..725b9c58c028 100644 --- a/drivers/edac/ghes_edac.c +++ b/drivers/edac/ghes_edac.c @@ -207,7 +207,6 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) struct ghes_edac_pvt *pvt; unsigned long flags; char *p; - u8 grain_bits; /* * We can do the locking below because GHES defers error processing @@ -443,18 +442,6 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) if (p > pvt->other_detail) *(p - 1) = '\0'; - /* Sanity-check driver-supplied grain value. */ - if (WARN_ON_ONCE(!e->grain)) - e->grain = 1; - - grain_bits = fls_long(e->grain - 1); - - /* Generate the trace event */ - trace_mc_event(type, e->msg, e->label, e->error_count, - mci->mc_idx, e->top_layer, e->mid_layer, e->low_layer, - (e->page_frame_number << PAGE_SHIFT) | e->offset_in_page, - grain_bits, e->syndrome, e->other_detail); - edac_raw_mc_handle_error(type, mci, e); unlock: spin_unlock_irqrestore(&ghes_lock, flags); From patchwork Wed Nov 6 09:33:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 11229793 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B90BC15AB for ; Wed, 6 Nov 2019 09:34:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8C83121D7E for ; Wed, 6 Nov 2019 09:34:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="ZRPo+CIZ"; dkim=pass (1024-bit key) header.d=marvell.onmicrosoft.com header.i=@marvell.onmicrosoft.com header.b="WFe6L8/g" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731743AbfKFJdn (ORCPT ); Wed, 6 Nov 2019 04:33:43 -0500 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:12762 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731712AbfKFJdm (ORCPT ); Wed, 6 Nov 2019 04:33:42 -0500 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA69VKLT027217; Wed, 6 Nov 2019 01:33:35 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=1TFVM5ORM0P3zV7f/gRuhjY4rmk0XP4KnO4NIoEQzaY=; b=ZRPo+CIZ27YeUmJ/Ouuy5CeYGwxoGBPYNmP940FhSnsm0BA2TDANfIP2uIbmn3h3EpWH 0idcnf2+WG0qo0IdVMKvmu6oQtmvJCEmL2DMYPf84wj6bzw2jhqnParwQFOuFzsLod2a kC/uTyDZtTN0x/Q9d2R8riXStNo50lvsDXYxQbfZg86gskqV26z2JBn4hT1a3lAMBAOT sOWoRxcRNYW+Iiqi+NK6SBIJznp50LMLjC6ar6hSjcdCaL6SYpL477IhroFRBy7Tj09h VFkLG7qV5LdDcAzRBe1Di1+l98BiVEn/JgykKm+OktinURV1VrXdNUSMMz6ZdtpyuXft IA== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2w19amyakg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2019 01:33:35 -0800 Received: from SC-EXCH02.marvell.com (10.93.176.82) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Nov 2019 01:33:33 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.59) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 6 Nov 2019 01:33:32 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AyNsS/MbNjE6/a+e1PMw+9rspZSx/ASi5mq8+0tlnbFwwbbpfJgMbpfXoZvgep2yWYW6CgMJBmCWC4PQfgvYwYJvqafFD0YoVhSD27kXh4jU4bZf+hFb55YNaQC2YMI1cZlvU0oQKoanmEZsPFq6fccb0U5ktsA1UFUvxCHiDxMwnSKlGj5gSC5KCsqlYk3qjcBclRY8Z4HInk/lyf5pWjKM+9bKKPeAvhFyOjC+GFD+oVQL9Bnqch9Z/gRfqkRX76KkAlX+s9fEPmbCFwQJpDqLTCPdKNe4HQDGVV2ObOdkzMFex66m2arRMl6jde6u9VoaPuz+dGBzk7QrBfxkNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1TFVM5ORM0P3zV7f/gRuhjY4rmk0XP4KnO4NIoEQzaY=; b=SsR7dGYN6XPG2pfbh8NDZVhhhGvikAyqlVCMv2IsYiuParLjunXmcea6rCIMiphQ/CfWQ1037Sl+tkCtO4MNQi4v4mPsG115QcnJnENzZfuUQ/UgnrrX4ihviyg/C50mWXNfeI2O2A38a0DMoPsThqC1Q4KB6o/J5KTujamTHoNUhUgBEu26+E1KKZ8J7V+pnQq2pQy7cQn0Mzex6kyRqmjFt+czuTUCWlc/eqW0/IoIpNMTn0wvqbg3otQHYSfu2uBVdKyDzheza1nLn8Yhlwf7RIy29J/3olbNvkSYinbeoXorr8cg9zUSC73XEdA3SP/jShNnm/fKP1PoDkpxbQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1TFVM5ORM0P3zV7f/gRuhjY4rmk0XP4KnO4NIoEQzaY=; b=WFe6L8/gYGyGOqseUvvSeMePrMQFHhpcAhJPc8XLoQpqGqKW1Y/dN+6e1h7XgNE0Kk6eyi8+VSJ/FQSAiAkqVnxcG8UJL7XahYB4gEvXZFnfukEKj3fez0uQ9ZkubmzGDGUhvOShZ8yqTcfHCdaDOvLfxXGecpfuoiG/290mo2k= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB3165.namprd18.prod.outlook.com (10.255.236.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Wed, 6 Nov 2019 09:33:30 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6%6]) with mapi id 15.20.2430.020; Wed, 6 Nov 2019 09:33:30 +0000 From: Robert Richter To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck , Jonathan Corbet CC: James Morse , Robert Richter , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Mauro Carvalho Chehab" , "linux-doc@vger.kernel.org" Subject: [PATCH v2 13/20] EDAC, Documentation: Describe CPER module definition and DIMM ranks Thread-Topic: [PATCH v2 13/20] EDAC, Documentation: Describe CPER module definition and DIMM ranks Thread-Index: AQHVlIU/GtvaA83eREuXj+Z4hz4EIg== Date: Wed, 6 Nov 2019 09:33:30 +0000 Message-ID: <20191106093239.25517-14-rrichter@marvell.com> References: <20191106093239.25517-1-rrichter@marvell.com> In-Reply-To: <20191106093239.25517-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0287.eurprd05.prod.outlook.com (2603:10a6:7:93::18) To MN2PR18MB3408.namprd18.prod.outlook.com (2603:10b6:208:165::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [31.208.96.227] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2a1a2d69-357c-4a73-1fe3-08d7629c6238 x-ms-traffictypediagnostic: MN2PR18MB3165: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 02135EB356 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(396003)(376002)(39860400002)(346002)(136003)(199004)(189003)(52116002)(305945005)(6486002)(76176011)(71190400001)(71200400001)(256004)(11346002)(446003)(7736002)(14444005)(6436002)(4326008)(6512007)(66446008)(66556008)(66476007)(66946007)(64756008)(5660300002)(1076003)(476003)(6116002)(3846002)(110136005)(54906003)(36756003)(2906002)(8676002)(99286004)(81166006)(81156014)(316002)(8936002)(50226002)(486006)(6506007)(386003)(102836004)(66066001)(2616005)(86362001)(478600001)(25786009)(186003)(14454004)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR18MB3165;H:MN2PR18MB3408.namprd18.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: BWEK9AYir7LdYl68B+5lxnEX0CZ2KWdV2Nr8JpI3QQoLXxTT2QZZPZClVwb6K+anG3W07PrvMjKlmVP/Usyyf1TfZf+ggQ40a+PeYR5aZMDhfAs0FMkZfaBaLggFTYtjhJWMkoEtZD3QASzPn/AWhIMGtCsfrdGg63HB+E1cLEKa+ck+jdeG393yZRkeRubD1z3uvdzEH5MjfqLDXvu/XzdMoHgDN2Um8ClvQkgbAlIAj/b03S87H5XL2GEmb19htuY7RDPtCnXRTSH2X4nXP2jobwpuHG3p0xlGpplF427KDJXB83vGDz+H5nNSpoASQUYJ04rzLvl6tO6x4LkWGqOXvM1Zoe10rgNLUwvo40TjXW0CnztpZDvuySfOx/Gv8+f2hE4g0qm4JYI/F08QaxRnP4IN1JX7q4Yl253QXvXLXnqjegVnyRCTyzeVvzbu MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 2a1a2d69-357c-4a73-1fe3-08d7629c6238 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 09:33:30.1788 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: jG5x9JpgnoT9WcWC8A9H04R3i0oXAxJAyP4NEZB62EzTrOB/zwfw6DGHm+H6mqjS34+KESnVVlkTsY2Pbh6sqQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3165 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-06_02:2019-11-06,2019-11-06 signatures=0 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org Update on CPER DIMM naming convention and DIMM ranks. Signed-off-by: Robert Richter Reviewed-by: Mauro Carvalho Chehab --- Documentation/admin-guide/ras.rst | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/Documentation/admin-guide/ras.rst b/Documentation/admin-guide/ras.rst index 2b20f5f7380d..26e02a59f0f4 100644 --- a/Documentation/admin-guide/ras.rst +++ b/Documentation/admin-guide/ras.rst @@ -330,9 +330,12 @@ There can be multiple csrows and multiple channels. .. [#f4] Nowadays, the term DIMM (Dual In-line Memory Module) is widely used to refer to a memory module, although there are other memory - packaging alternatives, like SO-DIMM, SIMM, etc. Along this document, - and inside the EDAC system, the term "dimm" is used for all memory - modules, even when they use a different kind of packaging. + packaging alternatives, like SO-DIMM, SIMM, etc. The UEFI + specification (Version 2.7) defines a memory module in the Common + Platform Error Record (CPER) section to be an SMBIOS Memory Device + (Type 17). Along this document, and inside the EDAC system, the term + "dimm" is used for all memory modules, even when they use a + different kind of packaging. Memory controllers allow for several csrows, with 8 csrows being a typical value. Yet, the actual number of csrows depends on the layout of @@ -349,12 +352,14 @@ controllers. The following example will assume 2 channels: | | ``ch0`` | ``ch1`` | +============+===========+===========+ | ``csrow0`` | DIMM_A0 | DIMM_B0 | - +------------+ | | - | ``csrow1`` | | | + | | rank0 | rank0 | + +------------+ - | - | + | ``csrow1`` | rank1 | rank1 | +------------+-----------+-----------+ | ``csrow2`` | DIMM_A1 | DIMM_B1 | - +------------+ | | - | ``csrow3`` | | | + | | rank0 | rank0 | + +------------+ - | - | + | ``csrow3`` | rank1 | rank1 | +------------+-----------+-----------+ In the above example, there are 4 physical slots on the motherboard @@ -374,11 +379,13 @@ which the memory DIMM is placed. Thus, when 1 DIMM is placed in each Channel, the csrows cross both DIMMs. Memory DIMMs come single or dual "ranked". A rank is a populated csrow. -Thus, 2 single ranked DIMMs, placed in slots DIMM_A0 and DIMM_B0 above -will have just one csrow (csrow0). csrow1 will be empty. On the other -hand, when 2 dual ranked DIMMs are similarly placed, then both csrow0 -and csrow1 will be populated. The pattern repeats itself for csrow2 and -csrow3. +In the example above 2 dual ranked DIMMs are similarly placed. Thus, +both csrow0 and csrow1 are populated. On the other hand, when 2 single +ranked DIMMs are placed in slots DIMM_A0 and DIMM_B0, then they will +have just one csrow (csrow0) and csrow1 will be empty. The pattern +repeats itself for csrow2 and csrow3. Also note that some memory +controller doesn't have any logic to identify the memory module, see +``rankX`` directories below. The representation of the above is reflected in the directory tree in EDAC's sysfs interface. Starting in directory From patchwork Wed Nov 6 09:33:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 11229789 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2234C15AB for ; Wed, 6 Nov 2019 09:34:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D6A2421A49 for ; Wed, 6 Nov 2019 09:34:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="nZ1dCOU0"; dkim=pass (1024-bit key) header.d=marvell.onmicrosoft.com header.i=@marvell.onmicrosoft.com header.b="fRneUP0R" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731508AbfKFJeR (ORCPT ); Wed, 6 Nov 2019 04:34:17 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:7676 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731754AbfKFJdq (ORCPT ); Wed, 6 Nov 2019 04:33:46 -0500 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA69UIxN002503; Wed, 6 Nov 2019 01:33:35 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=nDutiY8c+N9qGVATOtNYzKTUxT2171TdIFMTe9gi/88=; b=nZ1dCOU07UdnLuN2PIrS3e5JvsMsPIrUjm2NDRWmJB0Ls80uvdUBPdfOOxqg4aYLD7xE 2siNA/AJC3SiJw/8SNhlpYVVctkoQinBkNo0SxtVjm0CCZeUcMny7LFv+nWeo2UFCDhN jgKLGoYFCApZUmQv6uiNDw9pi1IUOLxSX1xI9FzLcMq8zm574pLKV5Hj6W2J5nmE5CxA vgeM3XHUm+3pJ5x3oTtl9wi53DM8xiIUxf/Cbs8SfRxHOkaCZD9fmXA1L1tEbfVwE3GC PvhOiQUt987jE5TeY75Hc2NtnsSiR5sJw4NgHv2c7nrRMlw3bxmCLIyAa7IhNBTxmh9F 2w== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2w3eud3c8b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2019 01:33:34 -0800 Received: from SC-EXCH02.marvell.com (10.93.176.82) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Nov 2019 01:33:33 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.59) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 6 Nov 2019 01:33:33 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DZgNadBay0MQfaFkg9WdwnRae++v39VyV3jGmYXWzo26JnPMAWOnqYf8741oTVC7e8fRU6dAFcbVDlwixLgSoRjaq6okxMZPjrgNYPOICo1mzlBpRAjvywq+ygW4a/eHPRNRUqL9Cr6O8qWVFOoP5z/LBl4Q4udVFSDldux+7Gorf94AM9x+3dXKxgxC02vePo+VREBbfd2jTfBB8rVr4bEX6dYBi0FPww8O1bfgTIcXkCOe82uGA89roDONQXZI0/x0GZOEBqD+4D2xJiDZEANRiKvq7AoooXMdEmsbDrcY/BfFBTi7TYiX7vXbf0NtBljMuPE4l5RfTSoat0SFiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nDutiY8c+N9qGVATOtNYzKTUxT2171TdIFMTe9gi/88=; b=hr/9jTm/l50pFOqJ867Z1v81IZ7lB3Wb1sM5xG8vQjU9XLnmp4hNPCdk17V/C0/P3Lg7Y5Ojhx3OJ6as9VKvLZDRIjDF29Zqwl+8Peg+1UKMEUfnxOmpr4BxnxJNXAHTm7jOrMy4KL6w4VGm26MSANlLOd8Zj609tpbBsMvoh/ghe7Zjz4MnUJQMNxv1LlrQr7ILBNNl75ikBBGX2lzyL3RmjeYrCNseYbViPCjLmTQdZj3Dq/3CBpnqWAwGPLPlhl0yMfnYykRsWRZupOxsemRerABrFkS2eQgjmP4yrQhYuC/kx7HcYrYk7iHU6qJP4OUxP4sE5RDBLe+eJeJ67A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nDutiY8c+N9qGVATOtNYzKTUxT2171TdIFMTe9gi/88=; b=fRneUP0Ru4Z4Ag6n9Kx6bZ96aoouiSO1+tytjFRffHcjCpyFLzwE83WZ080/USOL2/UbJtenttS9JsP15sEP7yjoPT2rbsGFAlUBevTONxKCyU3mrXLHnPs0zKba4pgiDkFU2Mb1gae38TqbmLJgAZ2b27E8ZrYppvPG7KH36Xc= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB3165.namprd18.prod.outlook.com (10.255.236.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Wed, 6 Nov 2019 09:33:32 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6%6]) with mapi id 15.20.2430.020; Wed, 6 Nov 2019 09:33:32 +0000 From: Robert Richter To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck CC: James Morse , Robert Richter , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH v2 14/20] EDAC, mc: Remove per layer counters Thread-Topic: [PATCH v2 14/20] EDAC, mc: Remove per layer counters Thread-Index: AQHVlIVBBrxvjhXd+UiTNn0fviO3ow== Date: Wed, 6 Nov 2019 09:33:32 +0000 Message-ID: <20191106093239.25517-15-rrichter@marvell.com> References: <20191106093239.25517-1-rrichter@marvell.com> In-Reply-To: <20191106093239.25517-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0287.eurprd05.prod.outlook.com (2603:10a6:7:93::18) To MN2PR18MB3408.namprd18.prod.outlook.com (2603:10b6:208:165::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [31.208.96.227] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9c47f5de-b017-4b69-2301-08d7629c63b6 x-ms-traffictypediagnostic: MN2PR18MB3165: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2582; x-forefront-prvs: 02135EB356 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(396003)(376002)(39860400002)(346002)(136003)(199004)(189003)(52116002)(305945005)(6486002)(76176011)(30864003)(71190400001)(71200400001)(256004)(11346002)(446003)(7736002)(6436002)(4326008)(6512007)(66446008)(66556008)(66476007)(66946007)(64756008)(5660300002)(1076003)(476003)(6116002)(3846002)(110136005)(54906003)(36756003)(2906002)(8676002)(99286004)(81166006)(81156014)(316002)(8936002)(50226002)(486006)(6506007)(386003)(102836004)(66066001)(2616005)(86362001)(478600001)(25786009)(186003)(14454004)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR18MB3165;H:MN2PR18MB3408.namprd18.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: zHqCYjeDEB1ElwukySQ//Om1lcXE0mT0qmA8GpMw1BCj2jMtybFjEG678Mqv+YvzshR/Wg1x1qJRtDRZMpldlOEhEkn1mvNT0FdKqcJtSB1sp9EoGRHGlRKrYrRdh0PGjNzFWXQ9mrPKduRsx88VtXk+a8UPtwE8UM/DORzL/hbnQveoSDjW0iwOd6cgrmop0AL6h0L5pUbhYFvgO0eRtY7mRRWA97b3Zxfbz63b790kqdK0xlCswOEeIy+1H6tNmcfBPwzLiKRo2YHvx0WQnd9K1t1TDuWw8EqvK6B0OzdvlzISaL53fOu+ornXK//qA44zzhzI4k8TXRX5sYYvHucpoC1mMM/GnMG0bTlhOBog0kw/CpJclWZvgJbiLNhpuPWMvNHCcd+k0aJbwqdWaxX29SLss7QXpMx6VLhtv6R+fxqroVO3nHIt1P5I12AU MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 9c47f5de-b017-4b69-2301-08d7629c63b6 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 09:33:32.6913 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: y4uJDauwnKS4zhx22s20ShcjcdW0K+sn6lNWfZsJvWuix/M48Y2BunzZoDCWwqU+zUKXJM/1BP0Taec+uLwCuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3165 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-06_02:2019-11-06,2019-11-06 signatures=0 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org Looking at how mci->{ue,ce}_per_layer[EDAC_MAX_LAYERS] is used, it turns out that only the leaves in the memory hierarchy are consumed (in sysfs), but not the intermediate layers, e.g.: count = dimm->mci->ce_per_layer[dimm->mci->n_layers-1][dimm->idx]; These unused counters only add complexity, remove them. The error counter values are directly stored in struct dimm_info now. Signed-off-by: Robert Richter --- drivers/edac/edac_mc.c | 106 ++++++++++++----------------------- drivers/edac/edac_mc_sysfs.c | 20 +++---- drivers/edac/ghes_edac.c | 5 +- include/linux/edac.h | 7 +-- 4 files changed, 47 insertions(+), 91 deletions(-) diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index b6032f51338e..dfc17c565d8f 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -315,12 +315,11 @@ struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num, struct csrow_info *csr; struct rank_info *chan; struct dimm_info *dimm; - u32 *ce_per_layer[EDAC_MAX_LAYERS], *ue_per_layer[EDAC_MAX_LAYERS]; unsigned int pos[EDAC_MAX_LAYERS]; - unsigned int idx, size, tot_dimms = 1, count = 1; - unsigned int tot_csrows = 1, tot_channels = 1, tot_errcount = 0; + unsigned int idx, size, tot_dimms = 1; + unsigned int tot_csrows = 1, tot_channels = 1; void *pvt, *p, *ptr = NULL; - int i, j, row, chn, n, len; + int j, row, chn, n, len; bool per_rank = false; if (WARN_ON(n_layers > EDAC_MAX_LAYERS || n_layers == 0)) @@ -346,19 +345,10 @@ struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num, * stringent as what the compiler would provide if we could simply * hardcode everything into a single struct. */ - mci = edac_align_ptr(&ptr, sizeof(*mci), 1); - layer = edac_align_ptr(&ptr, sizeof(*layer), n_layers); - for (i = 0; i < n_layers; i++) { - count *= layers[i].size; - edac_dbg(4, "errcount layer %d size %d\n", i, count); - ce_per_layer[i] = edac_align_ptr(&ptr, sizeof(u32), count); - ue_per_layer[i] = edac_align_ptr(&ptr, sizeof(u32), count); - tot_errcount += 2 * count; - } - - edac_dbg(4, "allocating %d error counters\n", tot_errcount); - pvt = edac_align_ptr(&ptr, sz_pvt, 1); - size = ((unsigned long)pvt) + sz_pvt; + mci = edac_align_ptr(&ptr, sizeof(*mci), 1); + layer = edac_align_ptr(&ptr, sizeof(*layer), n_layers); + pvt = edac_align_ptr(&ptr, sz_pvt, 1); + size = ((unsigned long)pvt) + sz_pvt; edac_dbg(1, "allocating %u bytes for mci data (%d %s, %d csrows/channels)\n", size, @@ -374,10 +364,6 @@ struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num, * rather than an imaginary chunk of memory located at address 0. */ layer = (struct edac_mc_layer *)(((char *)mci) + ((unsigned long)layer)); - for (i = 0; i < n_layers; i++) { - mci->ce_per_layer[i] = (u32 *)((char *)mci + ((unsigned long)ce_per_layer[i])); - mci->ue_per_layer[i] = (u32 *)((char *)mci + ((unsigned long)ue_per_layer[i])); - } pvt = sz_pvt ? (((char *)mci) + ((unsigned long)pvt)) : NULL; /* setup index and various internal pointers */ @@ -908,53 +894,31 @@ const char *edac_layer_name[] = { EXPORT_SYMBOL_GPL(edac_layer_name); static void edac_inc_ce_error(struct mem_ctl_info *mci, - bool enable_per_layer_report, const int pos[EDAC_MAX_LAYERS], const u16 count) { - int i, index = 0; + struct dimm_info *dimm = edac_get_dimm(mci, pos[0], pos[1], pos[2]); mci->ce_mc += count; - if (!enable_per_layer_report) { + if (dimm) + dimm->ce_count += count; + else mci->ce_noinfo_count += count; - return; - } - - for (i = 0; i < mci->n_layers; i++) { - if (pos[i] < 0) - break; - index += pos[i]; - mci->ce_per_layer[i][index] += count; - - if (i < mci->n_layers - 1) - index *= mci->layers[i + 1].size; - } } static void edac_inc_ue_error(struct mem_ctl_info *mci, - bool enable_per_layer_report, const int pos[EDAC_MAX_LAYERS], const u16 count) { - int i, index = 0; + struct dimm_info *dimm = edac_get_dimm(mci, pos[0], pos[1], pos[2]); mci->ue_mc += count; - if (!enable_per_layer_report) { + if (dimm) + dimm->ue_count += count; + else mci->ue_noinfo_count += count; - return; - } - - for (i = 0; i < mci->n_layers; i++) { - if (pos[i] < 0) - break; - index += pos[i]; - mci->ue_per_layer[i][index] += count; - - if (i < mci->n_layers - 1) - index *= mci->layers[i + 1].size; - } } static void edac_ce_error(struct mem_ctl_info *mci, @@ -965,7 +929,6 @@ static void edac_ce_error(struct mem_ctl_info *mci, const char *label, const char *detail, const char *other_detail, - const bool enable_per_layer_report, const unsigned long page_frame_number, const unsigned long offset_in_page, long grain) @@ -988,7 +951,7 @@ static void edac_ce_error(struct mem_ctl_info *mci, error_count, msg, msg_aux, label, location, detail); } - edac_inc_ce_error(mci, enable_per_layer_report, pos, error_count); + edac_inc_ce_error(mci, pos, error_count); if (mci->scrub_mode == SCRUB_SW_SRC) { /* @@ -1018,8 +981,7 @@ static void edac_ue_error(struct mem_ctl_info *mci, const char *location, const char *label, const char *detail, - const char *other_detail, - const bool enable_per_layer_report) + const char *other_detail) { char *msg_aux = ""; @@ -1048,7 +1010,7 @@ static void edac_ue_error(struct mem_ctl_info *mci, msg, msg_aux, label, location, detail); } - edac_inc_ue_error(mci, enable_per_layer_report, pos, error_count); + edac_inc_ue_error(mci, pos, error_count); } void edac_raw_mc_handle_error(const enum hw_event_mc_err_type type, @@ -1079,16 +1041,16 @@ void edac_raw_mc_handle_error(const enum hw_event_mc_err_type type, "page:0x%lx offset:0x%lx grain:%ld syndrome:0x%lx", e->page_frame_number, e->offset_in_page, e->grain, e->syndrome); - edac_ce_error(mci, e->error_count, pos, e->msg, e->location, e->label, - detail, e->other_detail, e->enable_per_layer_report, + edac_ce_error(mci, e->error_count, pos, e->msg, e->location, + e->label, detail, e->other_detail, e->page_frame_number, e->offset_in_page, e->grain); } else { snprintf(detail, sizeof(detail), "page:0x%lx offset:0x%lx grain:%ld", e->page_frame_number, e->offset_in_page, e->grain); - edac_ue_error(mci, e->error_count, pos, e->msg, e->location, e->label, - detail, e->other_detail, e->enable_per_layer_report); + edac_ue_error(mci, e->error_count, pos, e->msg, e->location, + e->label, detail, e->other_detail); } @@ -1113,6 +1075,7 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, int pos[EDAC_MAX_LAYERS] = { top_layer, mid_layer, low_layer }; int i, n_labels = 0; struct edac_raw_error_desc *e = &mci->error_desc; + bool any_memory = true; edac_dbg(3, "MC%d\n", mci->mc_idx); @@ -1130,9 +1093,9 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, /* * Check if the event report is consistent and if the memory - * location is known. If it is known, enable_per_layer_report will be - * true, the DIMM(s) label info will be filled and the per-layer - * error counters will be incremented. + * location is known. If it is known, the DIMM(s) label info + * will be filled and the DIMM's error counters will be + * incremented. */ for (i = 0; i < mci->n_layers; i++) { if (pos[i] >= (int)mci->layers[i].size) { @@ -1150,7 +1113,7 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, pos[i] = -1; } if (pos[i] >= 0) - e->enable_per_layer_report = true; + any_memory = false; } /* @@ -1180,16 +1143,17 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, e->grain = dimm->grain; /* - * If the error is memory-controller wide, there's no need to - * seek for the affected DIMMs because the whole - * channel/memory controller/... may be affected. - * Also, don't show errors for empty DIMM slots. + * If the error is memory-controller wide, there's no + * need to seek for the affected DIMMs because the + * whole channel/memory controller/... may be + * affected. Also, don't show errors for empty DIMM + * slots. */ - if (!e->enable_per_layer_report || !dimm->nr_pages) + if (any_memory || !dimm->nr_pages) continue; if (n_labels >= EDAC_MAX_LABELS) { - e->enable_per_layer_report = false; + any_memory = true; break; } n_labels++; @@ -1218,7 +1182,7 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, chan = -2; } - if (!e->enable_per_layer_report) { + if (any_memory) { strcpy(e->label, "any memory"); } else { edac_dbg(4, "csrow/channel to increment: (%d,%d)\n", row, chan); diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c index 0367554e7437..8682df2f7f4f 100644 --- a/drivers/edac/edac_mc_sysfs.c +++ b/drivers/edac/edac_mc_sysfs.c @@ -556,10 +556,8 @@ static ssize_t dimmdev_ce_count_show(struct device *dev, char *data) { struct dimm_info *dimm = to_dimm(dev); - u32 count; - count = dimm->mci->ce_per_layer[dimm->mci->n_layers-1][dimm->idx]; - return sprintf(data, "%u\n", count); + return sprintf(data, "%u\n", dimm->ce_count); } static ssize_t dimmdev_ue_count_show(struct device *dev, @@ -567,10 +565,8 @@ static ssize_t dimmdev_ue_count_show(struct device *dev, char *data) { struct dimm_info *dimm = to_dimm(dev); - u32 count; - count = dimm->mci->ue_per_layer[dimm->mci->n_layers-1][dimm->idx]; - return sprintf(data, "%u\n", count); + return sprintf(data, "%u\n", dimm->ue_count); } /* dimm/rank attribute files */ @@ -666,7 +662,9 @@ static ssize_t mci_reset_counters_store(struct device *dev, const char *data, size_t count) { struct mem_ctl_info *mci = to_mci(dev); - int cnt, row, chan, i; + struct dimm_info *dimm; + int row, chan; + mci->ue_mc = 0; mci->ce_mc = 0; mci->ue_noinfo_count = 0; @@ -682,11 +680,9 @@ static ssize_t mci_reset_counters_store(struct device *dev, ri->channels[chan]->ce_count = 0; } - cnt = 1; - for (i = 0; i < mci->n_layers; i++) { - cnt *= mci->layers[i].size; - memset(mci->ce_per_layer[i], 0, cnt * sizeof(u32)); - memset(mci->ue_per_layer[i], 0, cnt * sizeof(u32)); + mci_for_each_dimm(mci, dimm) { + dimm->ue_count = 0; + dimm->ce_count = 0; } mci->start_time = jiffies; diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c index 725b9c58c028..74017da1f72c 100644 --- a/drivers/edac/ghes_edac.c +++ b/drivers/edac/ghes_edac.c @@ -356,11 +356,8 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) mem_err->mem_dev_handle); index = get_dimm_smbios_index(mci, mem_err->mem_dev_handle); - if (index >= 0) { + if (index >= 0) e->top_layer = index; - e->enable_per_layer_report = true; - } - } if (p > e->location) *(p - 1) = '\0'; diff --git a/include/linux/edac.h b/include/linux/edac.h index 67be279abd11..4d9673954856 100644 --- a/include/linux/edac.h +++ b/include/linux/edac.h @@ -383,6 +383,9 @@ struct dimm_info { unsigned int csrow, cschannel; /* Points to the old API data */ u16 smbios_handle; /* Handle for SMBIOS type 17 */ + + u32 ce_count; + u32 ue_count; }; /** @@ -453,8 +456,6 @@ struct errcount_attribute_data { * @location: location of the error * @label: label of the affected DIMM(s) * @other_detail: other driver-specific detail about the error - * @enable_per_layer_report: if false, the error affects all layers - * (typically, a memory controller error) */ struct edac_raw_error_desc { char location[LOCATION_SIZE]; @@ -470,7 +471,6 @@ struct edac_raw_error_desc { unsigned long syndrome; const char *msg; const char *other_detail; - bool enable_per_layer_report; }; /* MEMORY controller information structure @@ -560,7 +560,6 @@ struct mem_ctl_info { */ u32 ce_noinfo_count, ue_noinfo_count; u32 ue_mc, ce_mc; - u32 *ce_per_layer[EDAC_MAX_LAYERS], *ue_per_layer[EDAC_MAX_LAYERS]; struct completion complete; From patchwork Wed Nov 6 09:33:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 11229791 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EBDFF1986 for ; Wed, 6 Nov 2019 09:34:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B4AF12087E for ; Wed, 6 Nov 2019 09:34:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="DIoenD+f"; dkim=pass (1024-bit key) header.d=marvell.onmicrosoft.com header.i=@marvell.onmicrosoft.com header.b="nypiTJza" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731754AbfKFJeV (ORCPT ); Wed, 6 Nov 2019 04:34:21 -0500 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:13070 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731759AbfKFJdq (ORCPT ); Wed, 6 Nov 2019 04:33:46 -0500 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA69VFnL027198; Wed, 6 Nov 2019 01:33:38 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=pCo0iu+QeVIL291bbUxBVAKfEb45CT4fRBRt4sOB+L0=; b=DIoenD+f2SUOpmvszZTsI9b01wOeEaIYt52U9JdIdUmUvuLWkgXseoWxwW7K0/yfxCup BgSoIjMzd/eutLgRkTFWpzk4noCtfDqawXphvVF69Givrv2OG7gWW/6OvGS0JFdzJlHN WfXOX15VLy8YrXslIMnw3Fi0uBWp5lEo+nKjKDWV4fzBER95JzfVAYq+j4v7BybfXUdd Yf+vw1aw8flsKaNCp8yJiKCYTSpbRegUkI1mMVTAUMHKdpFzS+L+0GzUiBKOPyHK7LPz rgLPxWbJy2b0LFMp4jiYVoBIfyjyfuAwMt/G/g8TwTX88Sdt67x62901xIt1xu3dSoxe Ug== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2w19amyakw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2019 01:33:38 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Nov 2019 01:33:36 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.51) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 6 Nov 2019 01:33:36 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IpGg+1Tbws8EHzqJqq8kWDp5mnKMLpvsKaBKHvuquNcPQtQwiBr/LYbsbLLaaOG6tSNPv1YyycSvcJ1SEUjo+9nwRPcjTuZCvbsrzuwQbBBfUucpsE0gIewEHIQtCSFfyLc+oCo1FpwPAt5CafwlNDA+G0ViwZPCvKzwf7ocxFCvx1J5RkTWAqeCEEN/p/9pWIlj5LjYW0awIoOwrNrSjRLo+AgpxoQLo5k5fB0kRzwgMTSY90D3jwoVoYpUgCzUOaAW2pNAqMCKyXeRIyFT0saHyxLEsH7Eovmgc8tYWBzim1g2zHOjDR5/pSFk9Kw+12f5GZIDxS9Uuqz9NSLzZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pCo0iu+QeVIL291bbUxBVAKfEb45CT4fRBRt4sOB+L0=; b=eg7MkC+MneNULMgBvcDGM1jLn4qcrWIjevtZTNpChv8UAArMsh4DSWWo3Da+59D1klWGz8cfV6Oh/d/zst1VcpoCH28i7TgcMw4E4cJgZupXzBIElCd/baf/+vCZEBh8e9U1L60UHyHKj8hSu1/PAqnmAKLMGkWNqELc5nHQAzsc6ldQSBK+NWiLYqveDzC16y1KZvwaxy8l1/HVA8KZ1vjZK6WlcLdC7CRHROd5b6U5FWsR5AOfLcuXxUOhKaja5L427Yt2LMdUqqH9YSAD0aVLRR00ipyFuANsTzBdTcQdv45Z5QwI1iYMGSBDG4dK61Rt2oDkUXceYArY4tTfSg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pCo0iu+QeVIL291bbUxBVAKfEb45CT4fRBRt4sOB+L0=; b=nypiTJza4KrmzD9PVpaPCqkFVOJza1OUvY9U2dhfqrPHTofInRRSylyknMTeH6Rkc/S+FyHmslje81KlidLrustgqRmC+NQXyYBX5b4Kx6qX7SJ76uqvXgC3E/2pc6cyrLS5OmbktVEiR3WJ6IZ/+gW1aH1LSzUbYGcjJPK2szs= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB3165.namprd18.prod.outlook.com (10.255.236.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Wed, 6 Nov 2019 09:33:35 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6%6]) with mapi id 15.20.2430.020; Wed, 6 Nov 2019 09:33:35 +0000 From: Robert Richter To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck CC: James Morse , Robert Richter , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Mauro Carvalho Chehab" Subject: [PATCH v2 15/20] EDAC, mc: Split edac_mc_alloc() into smaller functions Thread-Topic: [PATCH v2 15/20] EDAC, mc: Split edac_mc_alloc() into smaller functions Thread-Index: AQHVlIVCjMQKpUaSAEWu8ODDUwPZTQ== Date: Wed, 6 Nov 2019 09:33:34 +0000 Message-ID: <20191106093239.25517-16-rrichter@marvell.com> References: <20191106093239.25517-1-rrichter@marvell.com> In-Reply-To: <20191106093239.25517-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0287.eurprd05.prod.outlook.com (2603:10a6:7:93::18) To MN2PR18MB3408.namprd18.prod.outlook.com (2603:10b6:208:165::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [31.208.96.227] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e3e18a5a-34b6-4d3f-4b4c-08d7629c6512 x-ms-traffictypediagnostic: MN2PR18MB3165: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2803; x-forefront-prvs: 02135EB356 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(396003)(376002)(39860400002)(346002)(136003)(199004)(189003)(52116002)(305945005)(6486002)(76176011)(71190400001)(71200400001)(256004)(11346002)(446003)(7736002)(6436002)(4326008)(6512007)(66446008)(66556008)(66476007)(66946007)(64756008)(5660300002)(1076003)(476003)(6116002)(3846002)(110136005)(54906003)(36756003)(2906002)(8676002)(99286004)(81166006)(81156014)(316002)(8936002)(50226002)(486006)(6506007)(386003)(102836004)(66066001)(2616005)(86362001)(478600001)(25786009)(186003)(14454004)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR18MB3165;H:MN2PR18MB3408.namprd18.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Rt3baEn3w+sefEPTFnKBnuf4xaZ1J+yWlCCoVLS6SqZbZs4ORlptdJGlyjpWWSIWH9WgTDTQxjPgfHyyDx6hzL+KWdkBfV+yadAotck4ehdxUm3ZpOYLtow1bv0RFa737STezcJJhfU2bFL5pGQCdCflqF7ZdgmOkQMkAYW+EIdPWicK+i0/tTQ1ZRHd9unxiUxjJgiotX8EQHfBOgcSPLRhVyWHtY2iQc9WAgC0ZhwaRrQ1B45R33+zz3UduafctxqvstHp2/B/daTdGnFLL4R5PvntD/ubcmtTDoCGk3AmgV8ueiKA/S4Zu5qTXJAtyNf3TeZfqfsgknM/D06RQ+03eFF3w7OMgscgGH8VUFaNkl4Y6BIBXPvbtxu6PlvXXteFxs2Kx4wQveb/MckJP4KC4B+XSq4QpTPIrxi2yURwHRyuoK1O47YdPbKiEgra MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: e3e18a5a-34b6-4d3f-4b4c-08d7629c6512 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 09:33:34.9250 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: wEVqB5Jc+fqOcH7FNTXqo6LukYo64xmW2C4LLeDT2+6CRoTULlHh43jPSgCtPUHslVJDOnob+L7PCjrZKdX6pA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3165 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-06_02:2019-11-06,2019-11-06 signatures=0 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org edac_mc_alloc() is huge. Factor out code by moving it to the two new functions edac_mc_alloc_csrows() and edac_mc_alloc_dimms(). Do not move code yet for better review. Signed-off-by: Robert Richter Reviewed-by: Mauro Carvalho Chehab --- drivers/edac/edac_mc.c | 104 +++++++++++++++++++++++++++-------------- 1 file changed, 69 insertions(+), 35 deletions(-) diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index dfc17c565d8f..042a4504bb7f 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -305,6 +305,9 @@ static void _edac_mc_free(struct mem_ctl_info *mci) kfree(mci); } +static int edac_mc_alloc_csrows(struct mem_ctl_info *mci); +static int edac_mc_alloc_dimms(struct mem_ctl_info *mci); + struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num, unsigned int n_layers, struct edac_mc_layer *layers, @@ -312,14 +315,9 @@ struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num, { struct mem_ctl_info *mci; struct edac_mc_layer *layer; - struct csrow_info *csr; - struct rank_info *chan; - struct dimm_info *dimm; - unsigned int pos[EDAC_MAX_LAYERS]; unsigned int idx, size, tot_dimms = 1; unsigned int tot_csrows = 1, tot_channels = 1; - void *pvt, *p, *ptr = NULL; - int j, row, chn, n, len; + void *pvt, *ptr = NULL; bool per_rank = false; if (WARN_ON(n_layers > EDAC_MAX_LAYERS || n_layers == 0)) @@ -377,16 +375,43 @@ struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num, mci->num_cschannel = tot_channels; mci->csbased = per_rank; + if (edac_mc_alloc_csrows(mci)) + goto error; + + if (edac_mc_alloc_dimms(mci)) + goto error; + + mci->op_state = OP_ALLOC; + + return mci; + +error: + _edac_mc_free(mci); + + return NULL; +} +EXPORT_SYMBOL_GPL(edac_mc_alloc); + +static int edac_mc_alloc_csrows(struct mem_ctl_info *mci) +{ + unsigned int tot_csrows = mci->nr_csrows; + unsigned int tot_channels = mci->num_cschannel; + unsigned int row, chn; + /* * Alocate and fill the csrow/channels structs */ mci->csrows = kcalloc(tot_csrows, sizeof(*mci->csrows), GFP_KERNEL); if (!mci->csrows) - goto error; + return -ENOMEM; + for (row = 0; row < tot_csrows; row++) { + struct csrow_info *csr; + csr = kzalloc(sizeof(**mci->csrows), GFP_KERNEL); if (!csr) - goto error; + return -ENOMEM; + mci->csrows[row] = csr; csr->csrow_idx = row; csr->mci = mci; @@ -394,34 +419,51 @@ struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num, csr->channels = kcalloc(tot_channels, sizeof(*csr->channels), GFP_KERNEL); if (!csr->channels) - goto error; + return -ENOMEM; for (chn = 0; chn < tot_channels; chn++) { + struct rank_info *chan; + chan = kzalloc(sizeof(**csr->channels), GFP_KERNEL); if (!chan) - goto error; + return -ENOMEM; + csr->channels[chn] = chan; chan->chan_idx = chn; chan->csrow = csr; } } + return 0; +} + +static int edac_mc_alloc_dimms(struct mem_ctl_info *mci) +{ + void *p; + unsigned int pos[EDAC_MAX_LAYERS]; + unsigned int row, chn, idx; + int layer; + /* * Allocate and fill the dimm structs */ - mci->dimms = kcalloc(tot_dimms, sizeof(*mci->dimms), GFP_KERNEL); + mci->dimms = kcalloc(mci->tot_dimms, sizeof(*mci->dimms), GFP_KERNEL); if (!mci->dimms) - goto error; + return -ENOMEM; memset(&pos, 0, sizeof(pos)); row = 0; chn = 0; - for (idx = 0; idx < tot_dimms; idx++) { + for (idx = 0; idx < mci->tot_dimms; idx++) { + struct dimm_info *dimm; + struct rank_info *chan; + int n, len; + chan = mci->csrows[row]->channels[chn]; dimm = kzalloc(sizeof(**mci->dimms), GFP_KERNEL); if (!dimm) - goto error; + return -ENOMEM; mci->dimms[idx] = dimm; dimm->mci = mci; dimm->idx = idx; @@ -431,16 +473,16 @@ struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num, */ len = sizeof(dimm->label); p = dimm->label; - n = snprintf(p, len, "mc#%u", mc_num); + n = snprintf(p, len, "mc#%u", mci->mc_idx); p += n; len -= n; - for (j = 0; j < n_layers; j++) { + for (layer = 0; layer < mci->n_layers; layer++) { n = snprintf(p, len, "%s#%u", - edac_layer_name[layers[j].type], - pos[j]); + edac_layer_name[mci->layers[layer].type], + pos[layer]); p += n; len -= n; - dimm->location[j] = pos[j]; + dimm->location[layer] = pos[layer]; if (len <= 0) break; @@ -452,39 +494,31 @@ struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num, dimm->cschannel = chn; /* Increment csrow location */ - if (layers[0].is_virt_csrow) { + if (mci->layers[0].is_virt_csrow) { chn++; - if (chn == tot_channels) { + if (chn == mci->num_cschannel) { chn = 0; row++; } } else { row++; - if (row == tot_csrows) { + if (row == mci->nr_csrows) { row = 0; chn++; } } /* Increment dimm location */ - for (j = n_layers - 1; j >= 0; j--) { - pos[j]++; - if (pos[j] < layers[j].size) + for (layer = mci->n_layers - 1; layer >= 0; layer--) { + pos[layer]++; + if (pos[layer] < mci->layers[layer].size) break; - pos[j] = 0; + pos[layer] = 0; } } - mci->op_state = OP_ALLOC; - - return mci; - -error: - _edac_mc_free(mci); - - return NULL; + return 0; } -EXPORT_SYMBOL_GPL(edac_mc_alloc); void edac_mc_free(struct mem_ctl_info *mci) { From patchwork Wed Nov 6 09:33:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 11229779 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BD88114E5 for ; Wed, 6 Nov 2019 09:33:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8711821D6C for ; Wed, 6 Nov 2019 09:33:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="CS5LhbNV"; dkim=pass (1024-bit key) header.d=marvell.onmicrosoft.com header.i=@marvell.onmicrosoft.com header.b="oe9hZaVg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730091AbfKFJdr (ORCPT ); Wed, 6 Nov 2019 04:33:47 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:35586 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731762AbfKFJdq (ORCPT ); Wed, 6 Nov 2019 04:33:46 -0500 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA69UIxP002503; Wed, 6 Nov 2019 01:33:39 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=oHO92d7KGndljACQeZ/Sx00cl4+R7rl70yEiWGIEkHM=; b=CS5LhbNVDn5asvEfA24l+JLZ6bLUsHn2iuJgfwLWa832zGUtUioy207hq/4I+dbwbbpM mR+S1Zw5Mwq2cX+tbD3oYEkjg6EM4SoNxmzOScP80bHU2JGcPhlA+uvtxUJvNDBuwnxK ORaulRFg2iQz9UAUqHgke3Ys2adqqHSZj3bsNoOiYDZXq/P4wFotfgg/nDgYW1TmcTti HZk7EFtRAy/Bp7HJkiX3FC3ss9lx0ERYgfytkXSNFPzf8EFr2GtFbgUznq2j9/NfJxY8 Rk8QKppqZbDnyd1yhvEk9tBpGuamtvAxl5+2WNzAhkMgFWWyWgUimAC+2oS6NY7dt74m LA== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2w3eud3c8v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2019 01:33:39 -0800 Received: from SC-EXCH02.marvell.com (10.93.176.82) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Nov 2019 01:33:38 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.52) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 6 Nov 2019 01:33:38 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T4/MWgCYIHv/iNEXytDcaShJfKF4W3vXfxctdZQ8YufaVUwLfC7/7A5vY0MLWB/0bqX4xLGLtEMtHliGbK/EKg8N/fj7ls2kdbkgm2LHkC3mJZkuEwzou3yxD2cxzI3O4sp7BPIVtFDUG2mqWsjJ+HBH8SHlt5BToAd99l+a0viQrMk0TLwrOpxfs247HUvHJVMEpTkyoa9wF6c+7bnq5Zw2p2MLDa1OwtVwlmgpDz3+4hray31JXf0U+7v9ACcIaUGTGnS8U0pNf4XguMMr9KJkIBJTD2OYyWXY3ufRSMzlHMinfbSMhB49aZH+JUyt+wtuu5E52zlaRUcWXArO8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oHO92d7KGndljACQeZ/Sx00cl4+R7rl70yEiWGIEkHM=; b=XtuMKRN3yUIWjZuUsJ+IiXDRpVTatZaZe8ZeaB13h1kWKHD5iTWc7Ki9ksfCdIPN0amNVxFqzgo6aiZvCEK7PRwBYgj3sr+ADsbFpWQWMRMZ35jO0bg1aQW19fV5dXQLIdjsMxQuBTfCRiaSNhMw4bOJ9CZmd5NCLCobltogWw90d1ZkRLUZ09FJnkaf8wCCc1mOw+kdT+rf8fpZzmEZ6t6b+/CFeZDogwtnbJTLBNqE9l4Ux8mdUJmCjxbSKt7cvUi+B1wA8/1D4bmkq5moF2Km3Veg8e9d4+txsCAAbkqA0PPuWDR+Xe51cYz1rg5l/guKb7hmfJbwehS1tN6G7w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oHO92d7KGndljACQeZ/Sx00cl4+R7rl70yEiWGIEkHM=; b=oe9hZaVgLiIbotatMOs3daDUW51d0jPteHZutTkMQVuVN1dfBxNAvY2nFfzSKKn/T/mRgujrLyfn2/Ala0jAfEUJ3U5us12s6csjW9yMRA/IZm5/esNPiWc3imFCL/5ekosEwJ3ufNfxeAHd9sAEWirMSqzDKvVHm5KpN/scBLc= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB3165.namprd18.prod.outlook.com (10.255.236.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Wed, 6 Nov 2019 09:33:37 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6%6]) with mapi id 15.20.2430.020; Wed, 6 Nov 2019 09:33:37 +0000 From: Robert Richter To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck CC: James Morse , Robert Richter , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Mauro Carvalho Chehab" Subject: [PATCH v2 16/20] EDAC, mc: Reorder functions edac_mc_alloc*() Thread-Topic: [PATCH v2 16/20] EDAC, mc: Reorder functions edac_mc_alloc*() Thread-Index: AQHVlIVEtGWzd75N5UyGMXXJHwKI3g== Date: Wed, 6 Nov 2019 09:33:37 +0000 Message-ID: <20191106093239.25517-17-rrichter@marvell.com> References: <20191106093239.25517-1-rrichter@marvell.com> In-Reply-To: <20191106093239.25517-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0287.eurprd05.prod.outlook.com (2603:10a6:7:93::18) To MN2PR18MB3408.namprd18.prod.outlook.com (2603:10b6:208:165::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [31.208.96.227] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 463f5088-f9a2-416d-bd2f-08d7629c6670 x-ms-traffictypediagnostic: MN2PR18MB3165: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2276; x-forefront-prvs: 02135EB356 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(396003)(376002)(39860400002)(346002)(136003)(199004)(189003)(52116002)(305945005)(6486002)(76176011)(71190400001)(71200400001)(256004)(11346002)(446003)(7736002)(6436002)(4326008)(6512007)(66446008)(66556008)(66476007)(66946007)(64756008)(5660300002)(1076003)(476003)(6116002)(3846002)(110136005)(54906003)(36756003)(2906002)(8676002)(99286004)(81166006)(81156014)(316002)(8936002)(50226002)(486006)(6506007)(386003)(102836004)(66066001)(2616005)(86362001)(478600001)(25786009)(186003)(14454004)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR18MB3165;H:MN2PR18MB3408.namprd18.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: WtJGPrew3L5TSGkTFMnq+FBzCTTe7/xIqqceEusermJf6T8m1WUgG75C+JRgnwjx5/l/CgTBpCZ7+X75DQhmcR14YApkbTbnSgT7+fhzwyQxpME/reFHLJe4eURH0HUyJtI+jSF4rB5T6kkoYLsGs0zA+EYKHoM6u/RT+BKQnNHllJml7gc+LJECLllCQ56+bwfeJCVAJTSBaRBCnAyqZaTRSIcWDyDeanE+b4cPYS1999yGGZsm8jrS/1jT8jqqm8qFYQjCB/RyowBK67e8O2FFvxhmla2t60L/HVW6Zf/fNJhWZ4wDoVjlMPns48saSjWo/mDCYvfgAmSOtSaLaUFABmCamCZ0AjNJstVSGETANOwOYP51nocKmYGN9WqVdPViqi27pOpgOX/EfdigWs7dc3At/4E60ZuvRs3Zpr84DORWZ/IeOJrYRemNwEDp MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 463f5088-f9a2-416d-bd2f-08d7629c6670 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 09:33:37.1627 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: uKHgLulGvfQjVYt6HLv8H+DCxEjzBbogtt8rfScv1II6Cd0dTAsw58+55CXllfEOMaS1f6gBOEk97Hddh+q0oQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3165 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-06_02:2019-11-06,2019-11-06 signatures=0 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org Reorder the new created functions edac_mc_alloc_csrows() and edac_mc_alloc_dimms() and move them before edac_mc_alloc(). No further code changes. Signed-off-by: Robert Richter Reviewed-by: Mauro Carvalho Chehab --- drivers/edac/edac_mc.c | 171 ++++++++++++++++++++--------------------- 1 file changed, 84 insertions(+), 87 deletions(-) diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index 042a4504bb7f..bbe37af487c3 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -305,93 +305,6 @@ static void _edac_mc_free(struct mem_ctl_info *mci) kfree(mci); } -static int edac_mc_alloc_csrows(struct mem_ctl_info *mci); -static int edac_mc_alloc_dimms(struct mem_ctl_info *mci); - -struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num, - unsigned int n_layers, - struct edac_mc_layer *layers, - unsigned int sz_pvt) -{ - struct mem_ctl_info *mci; - struct edac_mc_layer *layer; - unsigned int idx, size, tot_dimms = 1; - unsigned int tot_csrows = 1, tot_channels = 1; - void *pvt, *ptr = NULL; - bool per_rank = false; - - if (WARN_ON(n_layers > EDAC_MAX_LAYERS || n_layers == 0)) - return NULL; - - /* - * Calculate the total amount of dimms and csrows/cschannels while - * in the old API emulation mode - */ - for (idx = 0; idx < n_layers; idx++) { - tot_dimms *= layers[idx].size; - if (layers[idx].is_virt_csrow) - tot_csrows *= layers[idx].size; - else - tot_channels *= layers[idx].size; - - if (layers[idx].type == EDAC_MC_LAYER_CHIP_SELECT) - per_rank = true; - } - - /* Figure out the offsets of the various items from the start of an mc - * structure. We want the alignment of each item to be at least as - * stringent as what the compiler would provide if we could simply - * hardcode everything into a single struct. - */ - mci = edac_align_ptr(&ptr, sizeof(*mci), 1); - layer = edac_align_ptr(&ptr, sizeof(*layer), n_layers); - pvt = edac_align_ptr(&ptr, sz_pvt, 1); - size = ((unsigned long)pvt) + sz_pvt; - - edac_dbg(1, "allocating %u bytes for mci data (%d %s, %d csrows/channels)\n", - size, - tot_dimms, - per_rank ? "ranks" : "dimms", - tot_csrows * tot_channels); - - mci = kzalloc(size, GFP_KERNEL); - if (mci == NULL) - return NULL; - - /* Adjust pointers so they point within the memory we just allocated - * rather than an imaginary chunk of memory located at address 0. - */ - layer = (struct edac_mc_layer *)(((char *)mci) + ((unsigned long)layer)); - pvt = sz_pvt ? (((char *)mci) + ((unsigned long)pvt)) : NULL; - - /* setup index and various internal pointers */ - mci->mc_idx = mc_num; - mci->tot_dimms = tot_dimms; - mci->pvt_info = pvt; - mci->n_layers = n_layers; - mci->layers = layer; - memcpy(mci->layers, layers, sizeof(*layer) * n_layers); - mci->nr_csrows = tot_csrows; - mci->num_cschannel = tot_channels; - mci->csbased = per_rank; - - if (edac_mc_alloc_csrows(mci)) - goto error; - - if (edac_mc_alloc_dimms(mci)) - goto error; - - mci->op_state = OP_ALLOC; - - return mci; - -error: - _edac_mc_free(mci); - - return NULL; -} -EXPORT_SYMBOL_GPL(edac_mc_alloc); - static int edac_mc_alloc_csrows(struct mem_ctl_info *mci) { unsigned int tot_csrows = mci->nr_csrows; @@ -520,6 +433,90 @@ static int edac_mc_alloc_dimms(struct mem_ctl_info *mci) return 0; } +struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num, + unsigned int n_layers, + struct edac_mc_layer *layers, + unsigned int sz_pvt) +{ + struct mem_ctl_info *mci; + struct edac_mc_layer *layer; + unsigned int idx, size, tot_dimms = 1; + unsigned int tot_csrows = 1, tot_channels = 1; + void *pvt, *ptr = NULL; + bool per_rank = false; + + if (WARN_ON(n_layers > EDAC_MAX_LAYERS || n_layers == 0)) + return NULL; + + /* + * Calculate the total amount of dimms and csrows/cschannels while + * in the old API emulation mode + */ + for (idx = 0; idx < n_layers; idx++) { + tot_dimms *= layers[idx].size; + if (layers[idx].is_virt_csrow) + tot_csrows *= layers[idx].size; + else + tot_channels *= layers[idx].size; + + if (layers[idx].type == EDAC_MC_LAYER_CHIP_SELECT) + per_rank = true; + } + + /* Figure out the offsets of the various items from the start of an mc + * structure. We want the alignment of each item to be at least as + * stringent as what the compiler would provide if we could simply + * hardcode everything into a single struct. + */ + mci = edac_align_ptr(&ptr, sizeof(*mci), 1); + layer = edac_align_ptr(&ptr, sizeof(*layer), n_layers); + pvt = edac_align_ptr(&ptr, sz_pvt, 1); + size = ((unsigned long)pvt) + sz_pvt; + + edac_dbg(1, "allocating %u bytes for mci data (%d %s, %d csrows/channels)\n", + size, + tot_dimms, + per_rank ? "ranks" : "dimms", + tot_csrows * tot_channels); + + mci = kzalloc(size, GFP_KERNEL); + if (mci == NULL) + return NULL; + + /* Adjust pointers so they point within the memory we just allocated + * rather than an imaginary chunk of memory located at address 0. + */ + layer = (struct edac_mc_layer *)(((char *)mci) + ((unsigned long)layer)); + pvt = sz_pvt ? (((char *)mci) + ((unsigned long)pvt)) : NULL; + + /* setup index and various internal pointers */ + mci->mc_idx = mc_num; + mci->tot_dimms = tot_dimms; + mci->pvt_info = pvt; + mci->n_layers = n_layers; + mci->layers = layer; + memcpy(mci->layers, layers, sizeof(*layer) * n_layers); + mci->nr_csrows = tot_csrows; + mci->num_cschannel = tot_channels; + mci->csbased = per_rank; + + if (edac_mc_alloc_csrows(mci)) + goto error; + + if (edac_mc_alloc_dimms(mci)) + goto error; + + mci->op_state = OP_ALLOC; + + return mci; + +error: + _edac_mc_free(mci); + + return NULL; +} +EXPORT_SYMBOL_GPL(edac_mc_alloc); + void edac_mc_free(struct mem_ctl_info *mci) { edac_dbg(1, "\n"); From patchwork Wed Nov 6 09:33:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 11229781 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2B52315AB for ; Wed, 6 Nov 2019 09:33:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EA77021A49 for ; Wed, 6 Nov 2019 09:33:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="sajrBsUt"; dkim=pass (1024-bit key) header.d=marvell.onmicrosoft.com header.i=@marvell.onmicrosoft.com header.b="YXwbMRzr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731791AbfKFJdv (ORCPT ); Wed, 6 Nov 2019 04:33:51 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:31548 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731781AbfKFJdt (ORCPT ); Wed, 6 Nov 2019 04:33:49 -0500 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA69Unxp003167; Wed, 6 Nov 2019 01:33:42 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=EnnlijSZVZFcBCN9jTmdC6iA0abMw7/Kvv7wUG4SuxM=; b=sajrBsUtDagU4glmkITseJ74FyovzmmbvKst6b4pmbnuAHobda6Lu0RdSXKTqlWZIsh9 sf18ET2Ins3TcWY0cJ1PQn1JoLUoivfz8eUiabwsKY55cW0w0lwV4e228HvLSsLpH37q V4UH2f6VNtJRUeZL4mj6xMwdM0FNC2TfzWS1ItYNbW9cUYR4xmq/HUdXpNHiQ+IsmHAl vQm5Ix/QVgwGDmUHv+BPUFYOmHRmnyzIzMTPTKRKnzLbmbj5FQKhpsWUlkuwlgB3Ms1C geYGMBjI5Xht49e/efB/SAxdr+OjtWRPxoPiNwJBncm+J7cD8NpttMD+Lc72bAUXmArK 1g== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2w3eud3c9c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2019 01:33:42 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Nov 2019 01:33:41 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.54) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 6 Nov 2019 01:33:41 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DawAk2rno0prts1qRwkMEaeQzIWSAoJGP0+hwlAtsAv5zW7OXt+rKB0yJA54SCSUyQYjxTJaPAKrJ5R4AbbYiTV2sLfnzSEH1FjFsGJYWSLvcAEhNSVEW8cHTp8DMsldB6k3CwW1O1uCbrUUfkcjQCHthjTWuyrjknueJR9V147z+aYIKWK+d/SmqS4ZbFuzBDUjq+0lNVZ7Mka4/ONttgYFKHU7+HJZvhISeMuL1pCMoLDVs66s1+smhfKCg3o0nWB5Y7UFsD6MJj7qBsxjLiK0DqXIybRtsatFJjz18URam/no6xilW0AoBY0IUFJAIp4F2kjYusVA8HD59TH13A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EnnlijSZVZFcBCN9jTmdC6iA0abMw7/Kvv7wUG4SuxM=; b=Clx3OBRBUIB2jsQa9eSYfU+ScMWlFUDwGoHvap35LwiT/XzYjJ4w1F0iwNIrHFhKvcSgisHgEVBDwZ/O83NB4dRWEymokdIAlqf5vdn0sK+K6roK7q/nzgbaGqxxAHIlQgoWwlOK8avZFFWBBZw9Xgo/3nH/+zWCfKnaCZo8q38PA55AIMBoMyPmEkMMUKDao9CkZ1iYdYiMEsQKUK6FWqwfi0cgdlIbUrOiQ5eGRRYv1ARNEC4o7CPfLVeOq766EWGBYmqBrPwQr0/5DHYv/8BLhs7KP6+X3RN4KadfHyRMuJdw3/Xgcg7p5ljocB2uUQx9sqE+fWHGkKBdxn9WWA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EnnlijSZVZFcBCN9jTmdC6iA0abMw7/Kvv7wUG4SuxM=; b=YXwbMRzrgzTENScrB9nheJ6ghWZgDKTSrkICtcGYxWQ9sQF1/IsthLSXxKmVrbzMoPcDCQk/hqSTpkUCRfE+yaAmmjuRwwFNWmwZuMfyUXUQjqgD2Nbr6AZAJHTU2DEM2mUVmPiLbwEuDkLeDiq25BlW+hmbzvCchMalrMbC2FA= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB3165.namprd18.prod.outlook.com (10.255.236.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Wed, 6 Nov 2019 09:33:39 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6%6]) with mapi id 15.20.2430.020; Wed, 6 Nov 2019 09:33:39 +0000 From: Robert Richter To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck CC: James Morse , Robert Richter , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Mauro Carvalho Chehab" Subject: [PATCH v2 17/20] EDAC, mc: Rework edac_raw_mc_handle_error() to use struct dimm_info Thread-Topic: [PATCH v2 17/20] EDAC, mc: Rework edac_raw_mc_handle_error() to use struct dimm_info Thread-Index: AQHVlIVFwb2aXU0xH0qyG8z+r78p5w== Date: Wed, 6 Nov 2019 09:33:39 +0000 Message-ID: <20191106093239.25517-18-rrichter@marvell.com> References: <20191106093239.25517-1-rrichter@marvell.com> In-Reply-To: <20191106093239.25517-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0287.eurprd05.prod.outlook.com (2603:10a6:7:93::18) To MN2PR18MB3408.namprd18.prod.outlook.com (2603:10b6:208:165::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [31.208.96.227] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 049bfead-8f4b-4850-3b3c-08d7629c67db x-ms-traffictypediagnostic: MN2PR18MB3165: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-forefront-prvs: 02135EB356 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(1496009)(4636009)(366004)(396003)(376002)(39860400002)(346002)(136003)(199004)(189003)(52116002)(305945005)(6486002)(76176011)(71190400001)(71200400001)(256004)(11346002)(446003)(7736002)(14444005)(6436002)(4326008)(6512007)(66446008)(66556008)(66476007)(66946007)(64756008)(5660300002)(1076003)(476003)(6116002)(3846002)(110136005)(54906003)(36756003)(2906002)(8676002)(99286004)(81166006)(81156014)(316002)(8936002)(50226002)(486006)(6506007)(386003)(102836004)(66066001)(2616005)(86362001)(478600001)(25786009)(186003)(14454004)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR18MB3165;H:MN2PR18MB3408.namprd18.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: JTD6XD9BvPWk8Hb2P+HMCTXFCer41accr/1O3VUMwJuYwThjk7W7aLON9MgWv4Wlt/2nxUyUqJsH5DEs3Em+tGjy2vh1Ost2hp2HIEl5FFx6DXZ/Ce2/4PvLu6uUfY7MNnE6pRk6UtXYa+t5bkVwO+8OOzDzyNKhwso0MJHFZluhTMafizR6Ms5VttDXNQ1GPNM20kLunC4jinIHzyTxKHlJvpBkn2P7U3ZBGlpoTjCjAimLciVOYkLG7HOOnihcx3YR995XMR9Qfu+3EUTm/nMXcoNzuzaOpESp7uDsz0F5v6NiM2/v0RJDEhBXh50vq2DjGQAweesF0QK+JheLmHGaL4xPZGZ51YPNZF57ZQmBqLY2sVJYNrPSSej/KZMCWyGRVYBmzYgv+6c2mjXYr7s8S0bUchQWbyUFKR9ndcU6689kSB3JhYjFy9+wzkI8 MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 049bfead-8f4b-4850-3b3c-08d7629c67db X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 09:33:39.4994 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: hz/+YDEyuGa6ZnQxkPo48K1wP5HKnt4OCnkvRPKtbmJPBo/u4R76amNxGhUlydBQxpBnW1gQACLOBcCxgMiTfQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3165 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-06_02:2019-11-06,2019-11-06 signatures=0 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org The error handling functions have the pos[] array argument for determing the dimm handle. Rework those functions to use the dimm handle directly. Signed-off-by: Robert Richter Reviewed-by: Mauro Carvalho Chehab --- drivers/edac/edac_mc.c | 28 +++++++++++++--------------- drivers/edac/edac_mc.h | 2 ++ drivers/edac/ghes_edac.c | 6 +++++- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index bbe37af487c3..e4a11218009b 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -925,11 +925,9 @@ const char *edac_layer_name[] = { EXPORT_SYMBOL_GPL(edac_layer_name); static void edac_inc_ce_error(struct mem_ctl_info *mci, - const int pos[EDAC_MAX_LAYERS], + struct dimm_info *dimm, const u16 count) { - struct dimm_info *dimm = edac_get_dimm(mci, pos[0], pos[1], pos[2]); - mci->ce_mc += count; if (dimm) @@ -939,11 +937,9 @@ static void edac_inc_ce_error(struct mem_ctl_info *mci, } static void edac_inc_ue_error(struct mem_ctl_info *mci, - const int pos[EDAC_MAX_LAYERS], - const u16 count) + struct dimm_info *dimm, + const u16 count) { - struct dimm_info *dimm = edac_get_dimm(mci, pos[0], pos[1], pos[2]); - mci->ue_mc += count; if (dimm) @@ -953,8 +949,8 @@ static void edac_inc_ue_error(struct mem_ctl_info *mci, } static void edac_ce_error(struct mem_ctl_info *mci, + struct dimm_info *dimm, const u16 error_count, - const int pos[EDAC_MAX_LAYERS], const char *msg, const char *location, const char *label, @@ -982,7 +978,7 @@ static void edac_ce_error(struct mem_ctl_info *mci, error_count, msg, msg_aux, label, location, detail); } - edac_inc_ce_error(mci, pos, error_count); + edac_inc_ce_error(mci, dimm, error_count); if (mci->scrub_mode == SCRUB_SW_SRC) { /* @@ -1006,8 +1002,8 @@ static void edac_ce_error(struct mem_ctl_info *mci, } static void edac_ue_error(struct mem_ctl_info *mci, + struct dimm_info *dimm, const u16 error_count, - const int pos[EDAC_MAX_LAYERS], const char *msg, const char *location, const char *label, @@ -1041,15 +1037,15 @@ static void edac_ue_error(struct mem_ctl_info *mci, msg, msg_aux, label, location, detail); } - edac_inc_ue_error(mci, pos, error_count); + edac_inc_ue_error(mci, dimm, error_count); } void edac_raw_mc_handle_error(const enum hw_event_mc_err_type type, struct mem_ctl_info *mci, + struct dimm_info *dimm, struct edac_raw_error_desc *e) { char detail[80]; - int pos[EDAC_MAX_LAYERS] = { e->top_layer, e->mid_layer, e->low_layer }; u8 grain_bits; /* Sanity-check driver-supplied grain value. */ @@ -1072,7 +1068,7 @@ void edac_raw_mc_handle_error(const enum hw_event_mc_err_type type, "page:0x%lx offset:0x%lx grain:%ld syndrome:0x%lx", e->page_frame_number, e->offset_in_page, e->grain, e->syndrome); - edac_ce_error(mci, e->error_count, pos, e->msg, e->location, + edac_ce_error(mci, dimm, e->error_count, e->msg, e->location, e->label, detail, e->other_detail, e->page_frame_number, e->offset_in_page, e->grain); } else { @@ -1080,7 +1076,7 @@ void edac_raw_mc_handle_error(const enum hw_event_mc_err_type type, "page:0x%lx offset:0x%lx grain:%ld", e->page_frame_number, e->offset_in_page, e->grain); - edac_ue_error(mci, e->error_count, pos, e->msg, e->location, + edac_ue_error(mci, dimm, e->error_count, e->msg, e->location, e->label, detail, e->other_detail); } @@ -1244,6 +1240,8 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, if (p > e->location) *(p - 1) = '\0'; - edac_raw_mc_handle_error(type, mci, e); + dimm = edac_get_dimm(mci, top_layer, mid_layer, low_layer); + + edac_raw_mc_handle_error(type, mci, dimm, e); } EXPORT_SYMBOL_GPL(edac_mc_handle_error); diff --git a/drivers/edac/edac_mc.h b/drivers/edac/edac_mc.h index 02aac5c61d00..2c3e2fbcedc4 100644 --- a/drivers/edac/edac_mc.h +++ b/drivers/edac/edac_mc.h @@ -214,6 +214,7 @@ extern int edac_mc_find_csrow_by_page(struct mem_ctl_info *mci, * * @type: severity of the error (CE/UE/Fatal) * @mci: a struct mem_ctl_info pointer + * @dimm: a struct dimm_info pointer * @e: error description * * This raw function is used internally by edac_mc_handle_error(). It should @@ -222,6 +223,7 @@ extern int edac_mc_find_csrow_by_page(struct mem_ctl_info *mci, */ void edac_raw_mc_handle_error(const enum hw_event_mc_err_type type, struct mem_ctl_info *mci, + struct dimm_info *dimm, struct edac_raw_error_desc *e); /** diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c index 74017da1f72c..6eebaf28e31c 100644 --- a/drivers/edac/ghes_edac.c +++ b/drivers/edac/ghes_edac.c @@ -201,6 +201,7 @@ static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg) void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) { + struct dimm_info *dimm; enum hw_event_mc_err_type type; struct edac_raw_error_desc *e; struct mem_ctl_info *mci; @@ -439,7 +440,10 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) if (p > pvt->other_detail) *(p - 1) = '\0'; - edac_raw_mc_handle_error(type, mci, e); + dimm = edac_get_dimm_by_index(mci, e->top_layer); + + edac_raw_mc_handle_error(type, mci, dimm, e); + unlock: spin_unlock_irqrestore(&ghes_lock, flags); } From patchwork Wed Nov 6 09:33:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 11229783 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 26BA115AB for ; Wed, 6 Nov 2019 09:34:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E5325218AE for ; Wed, 6 Nov 2019 09:34:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="HgXBrmd1"; dkim=pass (1024-bit key) header.d=marvell.onmicrosoft.com header.i=@marvell.onmicrosoft.com header.b="GXeccZ3Q" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731826AbfKFJd7 (ORCPT ); Wed, 6 Nov 2019 04:33:59 -0500 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:34498 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731810AbfKFJd7 (ORCPT ); Wed, 6 Nov 2019 04:33:59 -0500 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA69VFnN027198; Wed, 6 Nov 2019 01:33:46 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=T0K/P1k0RnHk2WGAsEbJojKAoqWQ5kxuwGXoqt/OUuw=; b=HgXBrmd17NCpppk7txBmnOLAVWzNBp+LKrv2NTMSBhPfXbVYs3lXFkHYuOIJ13borkJA sry1knUZeaGkIM5wmO5YlJeUOwIpk3vw2VgDP3LoIsW9ueELzmoqoURZnREOtxJD6lAk 7ACwb2sWfVN6WBXERZn7rlRGKt98Xwt3ZJIVTeLeab+/w/zirVbrIZT1qmBNEcbZ6COK InYu3jhpBImsO3njUyWjnBRTNo8Hbi/PtZZ4zgqtfsZtuIH2uVc9FDGon1ZvtK9QxBtn HT9J69ZnMVpb7ZgorpcYli6aylLcbeK265Pp7rZ2WJbDE3oWPjnkgrHKpWanfLVkIXdX vQ== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2w19amyam6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2019 01:33:46 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Nov 2019 01:33:44 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.50) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 6 Nov 2019 01:33:44 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jceqQsDsfhtLDMVazrO/oB8H0LbOMax0JkntdZZg9Gmp8nlFWiqB+h9bWZDgx36hxCIYOwfko62XVDWU/oJf2qxrrh6I++l5pZ4VgPiEymgDNLd6B6DomScT7wvDL7PlmtqSg/6ZEoEWj39+7/1wMiBFEA0Can94D7xmoYe6lSFgAqZ3lgZeUi1U9S1kP9tlsfmEH7XFpYUePeAVhIbknswtP6VwSrvQS1XTDaQO8xGceJBdKRoBFsld/GDIZYvAhaC84PUbYGg5wLrLx5VnYtzc0yK8fUEp0q37VXcM3ddxe/qNpl677sEUoZPOGv9y2mOEUUeV4HP068/8EROOBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=T0K/P1k0RnHk2WGAsEbJojKAoqWQ5kxuwGXoqt/OUuw=; b=cRt1S8vNnJzufz7sOJUsaV4iI/LT1KCAmqLTBHpX7nbPwtrJcPpTADgiz3iUFCmQdRrC3gwDrYS56Sn8T4Z5752E+tbGBVF+RrnuOvWZL2WlQhzBWB+RA/Siv1bZMhH2Wiu+hIvg4TAVk1pjbVw+8iwjn+6//YoBQd8V1K0vofJmxH46n2jzB+/D1jAoJehbshFJx4feW0my7QGYPzio6gARQ/tYObQKUgdUlevijuU8GbRavJMRoFzHx3sUmvGflZnqCL+fvP/HRmNW0RWJJMlxFq1JGLx+oIqsasq+0PZ+kH/mfo+5eFlI+1XSfzfDvPQjbOA39LFn78JT1ivHtg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=T0K/P1k0RnHk2WGAsEbJojKAoqWQ5kxuwGXoqt/OUuw=; b=GXeccZ3Q5+tqOysZV6iuvRHo+eEndEhryvTStYZp0e/ykwqdXsrKqJpWFj3d7eFwzbihkjsdte7rFyGCP3hursXrYtjzhi6YxOwroXZlSd7+KL0HCjB8OmhPWF/b5L17CUxor7i2mEhZDdnWJMvbzDnraqr/b4JIdIO7OW0OjUM= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB3165.namprd18.prod.outlook.com (10.255.236.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Wed, 6 Nov 2019 09:33:42 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6%6]) with mapi id 15.20.2430.020; Wed, 6 Nov 2019 09:33:42 +0000 From: Robert Richter To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck CC: James Morse , Robert Richter , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH v2 18/20] EDAC: Store error type in struct edac_raw_error_desc Thread-Topic: [PATCH v2 18/20] EDAC: Store error type in struct edac_raw_error_desc Thread-Index: AQHVlIVG4kntlIthJ0iEna0CMb2/Dg== Date: Wed, 6 Nov 2019 09:33:41 +0000 Message-ID: <20191106093239.25517-19-rrichter@marvell.com> References: <20191106093239.25517-1-rrichter@marvell.com> In-Reply-To: <20191106093239.25517-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0287.eurprd05.prod.outlook.com (2603:10a6:7:93::18) To MN2PR18MB3408.namprd18.prod.outlook.com (2603:10b6:208:165::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [31.208.96.227] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4d2fde45-5090-4ed7-3801-08d7629c6939 x-ms-traffictypediagnostic: MN2PR18MB3165: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 02135EB356 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(1496009)(4636009)(366004)(396003)(376002)(39860400002)(346002)(136003)(199004)(189003)(52116002)(305945005)(6486002)(76176011)(71190400001)(71200400001)(256004)(11346002)(446003)(7736002)(14444005)(6436002)(4326008)(6512007)(66446008)(66556008)(66476007)(66946007)(64756008)(5660300002)(1076003)(476003)(6116002)(3846002)(110136005)(54906003)(36756003)(2906002)(8676002)(99286004)(81166006)(81156014)(316002)(8936002)(50226002)(486006)(6506007)(386003)(102836004)(66066001)(2616005)(86362001)(478600001)(25786009)(186003)(14454004)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR18MB3165;H:MN2PR18MB3408.namprd18.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: FGQXzpo4kofIk6LW+dPvAMkaTyMUZZiZzmrFNjXTMCMUYJHrSArNTGaE/I1K9yYGtkmDQNUaw05sefeEqdzhH4noVDiWUMVMTjDqMc8nDwsOC1lWHU2pASXtmhl2YBuLHcCVbmw69D66gWHDdbw6MrxbOtqfcK6Du1VMtEEPPFlEi1CKMlRUfrNEmQ2G0/IFw88DlDTseAyl8hic0QP8KPO6zyeKJgiDPEugzWad1EJ6INfIe4Eak8PWarP25dcABhjGAqksKttPiowm48GPcnfU9kPOGZYqxQuIrOYxedPQFVGhSfZp2maYC2NVhh9iFtvnPgesc2sV6GAw4kAZYH46fxXaTl7Rw9o3NUURq9jt9HV3ST2Mn1BUWo4AcATPQqM5PnlKDDQm/CHjXoIdbovK5q1TntN/bA3MhCvXXkpR0/WB65+ZwmARVcGn8GFV MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 4d2fde45-5090-4ed7-3801-08d7629c6939 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 09:33:41.8580 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: tWOz7mghJ1S7ChdUZBQYdetMpKxe2/k+FemrVymKEsRJqN76/FkaI7xtmyiKB8kg4popj4FFqmYNZmJ+eokP3Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3165 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-06_02:2019-11-06,2019-11-06 signatures=0 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org Store the error type in struct edac_raw_error_desc. This makes the type parameter of edac_raw_mc_handle_error() obsolete. Signed-off-by: Robert Richter Reviewed-by: Mauro Carvalho Chehab --- drivers/edac/edac_mc.c | 10 +++++----- drivers/edac/edac_mc.h | 4 +--- drivers/edac/ghes_edac.c | 11 +++++------ include/linux/edac.h | 1 + 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index e4a11218009b..7b4f5e98dfe8 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -1040,8 +1040,7 @@ static void edac_ue_error(struct mem_ctl_info *mci, edac_inc_ue_error(mci, dimm, error_count); } -void edac_raw_mc_handle_error(const enum hw_event_mc_err_type type, - struct mem_ctl_info *mci, +void edac_raw_mc_handle_error(struct mem_ctl_info *mci, struct dimm_info *dimm, struct edac_raw_error_desc *e) { @@ -1056,14 +1055,14 @@ void edac_raw_mc_handle_error(const enum hw_event_mc_err_type type, /* Report the error via the trace interface */ if (IS_ENABLED(CONFIG_RAS)) - trace_mc_event(type, e->msg, e->label, e->error_count, + trace_mc_event(e->type, e->msg, e->label, e->error_count, mci->mc_idx, e->top_layer, e->mid_layer, e->low_layer, (e->page_frame_number << PAGE_SHIFT) | e->offset_in_page, grain_bits, e->syndrome, e->other_detail); /* Memory type dependent details about the error */ - if (type == HW_EVENT_ERR_CORRECTED) { + if (e->type == HW_EVENT_ERR_CORRECTED) { snprintf(detail, sizeof(detail), "page:0x%lx offset:0x%lx grain:%ld syndrome:0x%lx", e->page_frame_number, e->offset_in_page, @@ -1109,6 +1108,7 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, /* Fills the error report buffer */ memset(e, 0, sizeof (*e)); e->error_count = error_count; + e->type = type; e->top_layer = top_layer; e->mid_layer = mid_layer; e->low_layer = low_layer; @@ -1242,6 +1242,6 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, dimm = edac_get_dimm(mci, top_layer, mid_layer, low_layer); - edac_raw_mc_handle_error(type, mci, dimm, e); + edac_raw_mc_handle_error(mci, dimm, e); } EXPORT_SYMBOL_GPL(edac_mc_handle_error); diff --git a/drivers/edac/edac_mc.h b/drivers/edac/edac_mc.h index 2c3e2fbcedc4..a8f1b5b5e873 100644 --- a/drivers/edac/edac_mc.h +++ b/drivers/edac/edac_mc.h @@ -212,7 +212,6 @@ extern int edac_mc_find_csrow_by_page(struct mem_ctl_info *mci, * edac_raw_mc_handle_error() - Reports a memory event to userspace without * doing anything to discover the error location. * - * @type: severity of the error (CE/UE/Fatal) * @mci: a struct mem_ctl_info pointer * @dimm: a struct dimm_info pointer * @e: error description @@ -221,8 +220,7 @@ extern int edac_mc_find_csrow_by_page(struct mem_ctl_info *mci, * only be called directly when the hardware error come directly from BIOS, * like in the case of APEI GHES driver. */ -void edac_raw_mc_handle_error(const enum hw_event_mc_err_type type, - struct mem_ctl_info *mci, +void edac_raw_mc_handle_error(struct mem_ctl_info *mci, struct dimm_info *dimm, struct edac_raw_error_desc *e); diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c index 6eebaf28e31c..7d325d70d6d3 100644 --- a/drivers/edac/ghes_edac.c +++ b/drivers/edac/ghes_edac.c @@ -202,7 +202,6 @@ static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg) void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) { struct dimm_info *dimm; - enum hw_event_mc_err_type type; struct edac_raw_error_desc *e; struct mem_ctl_info *mci; struct ghes_edac_pvt *pvt; @@ -241,17 +240,17 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) switch (sev) { case GHES_SEV_CORRECTED: - type = HW_EVENT_ERR_CORRECTED; + e->type = HW_EVENT_ERR_CORRECTED; break; case GHES_SEV_RECOVERABLE: - type = HW_EVENT_ERR_UNCORRECTED; + e->type = HW_EVENT_ERR_UNCORRECTED; break; case GHES_SEV_PANIC: - type = HW_EVENT_ERR_FATAL; + e->type = HW_EVENT_ERR_FATAL; break; default: case GHES_SEV_NO: - type = HW_EVENT_ERR_INFO; + e->type = HW_EVENT_ERR_INFO; } edac_dbg(1, "error validation_bits: 0x%08llx\n", @@ -442,7 +441,7 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) dimm = edac_get_dimm_by_index(mci, e->top_layer); - edac_raw_mc_handle_error(type, mci, dimm, e); + edac_raw_mc_handle_error(mci, dimm, e); unlock: spin_unlock_irqrestore(&ghes_lock, flags); diff --git a/include/linux/edac.h b/include/linux/edac.h index 4d9673954856..587c53b87fdf 100644 --- a/include/linux/edac.h +++ b/include/linux/edac.h @@ -463,6 +463,7 @@ struct edac_raw_error_desc { long grain; u16 error_count; + enum hw_event_mc_err_type type; int top_layer; int mid_layer; int low_layer; From patchwork Wed Nov 6 09:33:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 11229787 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 935961986 for ; Wed, 6 Nov 2019 09:34:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5DB8C2187F for ; Wed, 6 Nov 2019 09:34:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="a940HRsa"; dkim=pass (1024-bit key) header.d=marvell.onmicrosoft.com header.i=@marvell.onmicrosoft.com header.b="aaCY9Uj0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731815AbfKFJd6 (ORCPT ); Wed, 6 Nov 2019 04:33:58 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:15288 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731781AbfKFJd6 (ORCPT ); Wed, 6 Nov 2019 04:33:58 -0500 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA69UNGQ002538; Wed, 6 Nov 2019 01:33:47 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=5QeX3Rdt6ruhgoEmEwVn/yWzxBrV5AGE2eQJUWIO6xQ=; b=a940HRsaITUZZXTgEg+PBVUsnWBtMKFa22sLBIhPkBhsZSITeKR7dR06wBXOEOe28n5U AIiy0K6pGau+/+h17/Rvt7hmhbAxJ0Em3Yz7A0STxP/oedRMLkGbaJIucl/fbDKCEuun P+at6J60MNGcL1NuWbD5g2hi9smcTG95VlLdJjirOSAiwbGbDCsAWaqh4zgdTifueYsq s59viAx6ZfvQe2V4PqWoeqf409/Zkz+PFRoNfBJREUgsJJvhZExcakxwXZfLf0f1gHIe FrDK/1xz1m7CSR0zLS50dip8q5CV3yHOoE907iZ6bOKlj42C/h7IX+AzWtCjyvXT8IPs FQ== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2w3eud3c9y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2019 01:33:47 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Nov 2019 01:33:46 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.50) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 6 Nov 2019 01:33:46 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=idlUvfqliinElw++C2/0NZm/jDJtVnIo+rcNwBVstQn/Ne6Habm7pEon+nr52SnN9vhD09Z1ILLkwkJZd3SQWfgMwkPrlrY7awFHUwRrgNJTMOckLXAvGfnBMPfoH5U/0RUE2XtCZy6Zqi+ofNVlqHZoO9b/aDTo3Brd/dYSZUpFbZFtUeugNYoiRyMbvWtZwWbJGh6vaqAznuU5Bt8nAQeNkskDZtrckE0fAlDp5IEkThWQRGaKGsZVgIjkp43p7m+mV458KfTdLV6jBy30Z9A/DxOw8gttaz/ilU/fsJtZQXkofZg4XzHaICMWGtgia+EHjrB/3r7aEe22R0GM8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5QeX3Rdt6ruhgoEmEwVn/yWzxBrV5AGE2eQJUWIO6xQ=; b=SCTtuUhC+w7kc8tpTZDJysHQVaP5DW2ED64O4CsQE6BLvSmjYwIO9Vp4nEJq1Z/q+wlyrbnvJtJ211pZ+YfNRC78hQRcJF+Bmb/oNWtsdZb0/59fGHa9v5UlxC2dTCbfhN7Mrg3rXuy/XVzYOBwCqRGba7rRTHk2B675yw+3soMKzvT6FR+mzlxhBmv4rkzEWbWRJztIgGX7jl11EinA9hqEHAvBMAb9frPo3BycktQBlFcGb1HrOXVRVo0z7tXwP87nrhDx8F6nnx8VafkmkI9qMhCq2NMeFBwnEON3w56Hq74F6+wA5BAiTncN6oPsyeM+PYHBnFugBpZGkMgUpg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5QeX3Rdt6ruhgoEmEwVn/yWzxBrV5AGE2eQJUWIO6xQ=; b=aaCY9Uj0LO6Ni4AzhovcKwHQG0t0RNJrOhOnN7Zos02PxU+bz42MpHVLlTkV2ys8wEtQCWmnB1Hzr7lrXxU0X25FtH8suM5fbBS6xAM6yQlN5mvLMHGN5U2L1QrXH9+cOagAjTH4uwbt39Xf6e1yf2aAS7rtZfNFm82QI2QbnG0= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB3165.namprd18.prod.outlook.com (10.255.236.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Wed, 6 Nov 2019 09:33:44 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6%6]) with mapi id 15.20.2430.020; Wed, 6 Nov 2019 09:33:44 +0000 From: Robert Richter To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck CC: James Morse , Robert Richter , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Mauro Carvalho Chehab" Subject: [PATCH v2 19/20] EDAC, mc: Determine mci pointer from the error descriptor Thread-Topic: [PATCH v2 19/20] EDAC, mc: Determine mci pointer from the error descriptor Thread-Index: AQHVlIVIaSdKYalyGUal0TUjscbV+w== Date: Wed, 6 Nov 2019 09:33:44 +0000 Message-ID: <20191106093239.25517-20-rrichter@marvell.com> References: <20191106093239.25517-1-rrichter@marvell.com> In-Reply-To: <20191106093239.25517-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0287.eurprd05.prod.outlook.com (2603:10a6:7:93::18) To MN2PR18MB3408.namprd18.prod.outlook.com (2603:10b6:208:165::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [31.208.96.227] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: cb5b72cb-acbc-4e6c-e9e5-08d7629c6aa6 x-ms-traffictypediagnostic: MN2PR18MB3165: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 02135EB356 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(1496009)(4636009)(366004)(396003)(376002)(39860400002)(346002)(136003)(199004)(189003)(52116002)(305945005)(6486002)(76176011)(71190400001)(71200400001)(256004)(11346002)(446003)(7736002)(14444005)(6436002)(4326008)(6512007)(66446008)(66556008)(66476007)(66946007)(64756008)(5660300002)(1076003)(476003)(6116002)(3846002)(110136005)(54906003)(36756003)(2906002)(8676002)(99286004)(81166006)(81156014)(316002)(8936002)(50226002)(486006)(6506007)(386003)(102836004)(66066001)(2616005)(86362001)(478600001)(25786009)(186003)(14454004)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR18MB3165;H:MN2PR18MB3408.namprd18.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: u48+29DWKIireniFFVw49LG7kn4AMBYjjlcOK9OjKGhK28D8KCPexVI2g5I6mrT1fn++WxRpHaLYSFQma4RPrAiRvTNBIkflyb9dSVVtD8hSKiedgJeCc3LIXAh7upRJdSDE4x1EnpCosdxSe3YUXtJBtpWUR9Aap5xnU4TANBnoc8//yzE8CPMTd6/XjpIpPeg+705VAtg0iDZluN/yGvbacNDLmj/+m4nH8vXV85UgxEgZXgOxjVuTxsr+AE3j7rsRfTMv0cUFsDdq+CztmLjbKO5A1DGCImFXLsRXY/hVjC7OR5NmSZyL50LPUcToS/DGGkKRGiY8vxbMm21xi+2dYHCPkZlLQLFw0gOJ5ebd3gNTCt4xwzM7zpcqfV28sxrQhYn6rcxnhYBpTBR+Yz7MybqFvvtIs4HxAIwNV7wOQ2BQ6zN0pWRWLlie8OY4 MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: cb5b72cb-acbc-4e6c-e9e5-08d7629c6aa6 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 09:33:44.2367 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: BTeS3RzU1oyWBjgEYq3Kwgtz/wGyhHhXMFlKd80PqHLrxF8FhexmBGd7czf13NaLoNFo9I5vJpRL9ejJ1Irf4g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3165 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-06_02:2019-11-06,2019-11-06 signatures=0 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org Each struct mci has its own error descriptor. Create a function error_desc_to_mci() to determine the corresponding mci from an error descriptor. This eases the parameter list of edac_raw_mc_handle_ error() as the mci pointer do not need to be passed any longer. While at it, reorder parameters of edac_raw_mc_handle_error(). Signed-off-by: Robert Richter Reviewed-by: Mauro Carvalho Chehab --- drivers/edac/edac_mc.c | 13 +++++++++---- drivers/edac/edac_mc.h | 8 +++----- drivers/edac/ghes_edac.c | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index 7b4f5e98dfe8..93eac968678e 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -1040,10 +1040,15 @@ static void edac_ue_error(struct mem_ctl_info *mci, edac_inc_ue_error(mci, dimm, error_count); } -void edac_raw_mc_handle_error(struct mem_ctl_info *mci, - struct dimm_info *dimm, - struct edac_raw_error_desc *e) +static struct mem_ctl_info *error_desc_to_mci(struct edac_raw_error_desc *e) +{ + return container_of(e, struct mem_ctl_info, error_desc); +} + +void edac_raw_mc_handle_error(struct edac_raw_error_desc *e, + struct dimm_info *dimm) { + struct mem_ctl_info *mci = error_desc_to_mci(e); char detail[80]; u8 grain_bits; @@ -1242,6 +1247,6 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, dimm = edac_get_dimm(mci, top_layer, mid_layer, low_layer); - edac_raw_mc_handle_error(mci, dimm, e); + edac_raw_mc_handle_error(e, dimm); } EXPORT_SYMBOL_GPL(edac_mc_handle_error); diff --git a/drivers/edac/edac_mc.h b/drivers/edac/edac_mc.h index a8f1b5b5e873..3b01d5d9d7bc 100644 --- a/drivers/edac/edac_mc.h +++ b/drivers/edac/edac_mc.h @@ -212,17 +212,15 @@ extern int edac_mc_find_csrow_by_page(struct mem_ctl_info *mci, * edac_raw_mc_handle_error() - Reports a memory event to userspace without * doing anything to discover the error location. * - * @mci: a struct mem_ctl_info pointer - * @dimm: a struct dimm_info pointer * @e: error description + * @dimm: a struct dimm_info pointer * * This raw function is used internally by edac_mc_handle_error(). It should * only be called directly when the hardware error come directly from BIOS, * like in the case of APEI GHES driver. */ -void edac_raw_mc_handle_error(struct mem_ctl_info *mci, - struct dimm_info *dimm, - struct edac_raw_error_desc *e); +void edac_raw_mc_handle_error(struct edac_raw_error_desc *e, + struct dimm_info *dimm); /** * edac_mc_handle_error() - Reports a memory event to userspace. diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c index 7d325d70d6d3..c1bcfdbd6f82 100644 --- a/drivers/edac/ghes_edac.c +++ b/drivers/edac/ghes_edac.c @@ -441,7 +441,7 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) dimm = edac_get_dimm_by_index(mci, e->top_layer); - edac_raw_mc_handle_error(mci, dimm, e); + edac_raw_mc_handle_error(e, dimm); unlock: spin_unlock_irqrestore(&ghes_lock, flags); From patchwork Wed Nov 6 09:33:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 11229785 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F50D15AB for ; Wed, 6 Nov 2019 09:34:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 13E9F2187F for ; Wed, 6 Nov 2019 09:34:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="iLTFBOSU"; dkim=pass (1024-bit key) header.d=marvell.onmicrosoft.com header.i=@marvell.onmicrosoft.com header.b="Bd+U0sNc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731376AbfKFJeC (ORCPT ); Wed, 6 Nov 2019 04:34:02 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:26518 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731828AbfKFJeB (ORCPT ); Wed, 6 Nov 2019 04:34:01 -0500 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA69UNGS002538; Wed, 6 Nov 2019 01:33:50 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=9QP7d/lmwnUxc7oeYSJ5iMXeE5CRY3AYoKh3V02Cfrc=; b=iLTFBOSUeQK/hUhVMwxm7f1fnhWya7i1g+7yKelx0JA7SdgSEFjbXisr27aBpsir2K3F zbdVUAErt1jaVHs8XV4Wf190JL0JEQo62hntf0s7KzGFzXYzBYobIswRImWBtahvlfBn M7fwJPqRKwh93KbRODdB2rrUOMRITn3PYMPIfQfxdxKlCqjMxmUdz9xyi0q/cFrPADIt NdSt8GqjsutR5YoefQzdIVqicMCZfQWcRAo+R76njFMy7KSDotX7FOMtqgtQft1VUt3Q DhgS+gNW8nbR+Q1VLv90b6N7Thsif68aOE1IUmAOQ3ET/L9guaSw+CQiZ1kpAmiOStX+ tQ== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2w3eud3ca9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2019 01:33:49 -0800 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Nov 2019 01:33:49 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.52) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 6 Nov 2019 01:33:48 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JSoYEj+YW1nA7SAFHmMTE32/S2E0AeYO8Da9PJb6gtaxogAhTLMcLRaqziMmBviBlr5PDO+lcbjR4gLt+uB/RwubiC0fhHyelCt0NJkbMqzn1qnH7XjOBA2ulUYWHn1+VzFJxgLux/ZuWS89DU++fgZtV06rgzJz4CRiSPepOoGMgKnNADgTpJFwkuNW7cWgMk9aYTn73iYYWkn2vxCk1QPsd3w7WRLm6RGQMI3nnPHrDoth5TXCfHRsces/Q60sA/XojD06pWvw1NxMDc5eZXMW3Cd08qY5eIKqZ0ZyUw92a8ObF7QABSZpbxjgqeiIQ/mvZGdxxzZ2c/s2GA1aLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9QP7d/lmwnUxc7oeYSJ5iMXeE5CRY3AYoKh3V02Cfrc=; b=dSYwmUOjam2+Y19kDSQFuX6yl4eU3kyHJ/AIsj982W39hsgPyiYqx/plhu6VgwDt3Ro1/ph01EuwsINtzQ6RXHFLwMGtW3/Bvovj8yeY6rZkv/LZP9h9Nn5RnY97XroVipC4NH62FZAXIqf5wCDfniNcxno3Loz00o8pZD5tuvfB+Nj2GXZedffqzQp1FmZHG3AL0fIrNUyPX/gvxCnwm8DJJq4fmxzbUXmgrCFYuFualgflAtOzktE5s4boogDquLDgNyuoXsMKzRr4vhe1qccXII4lDnnmNN7C+PZ0ZD6yMYm8bseV6IM4bcKuJKv8esLQpSsusZ5PUbjDXhAgbg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9QP7d/lmwnUxc7oeYSJ5iMXeE5CRY3AYoKh3V02Cfrc=; b=Bd+U0sNcsm5GNoLMg1pYTeMqXMqPVAHb2TH6hteJQYX3GzJ9rxyPg6VKPiwmFIysK3Y6BmiMP/fQxDIF2MzzjuGNCI2gbiLzVx8/lllJPvc2AkVOVa2JShTOpCGw1IVbte4Rto3AX025Dp9Y8x6ltFXBso1vABiK5lJjEqHuAok= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB3165.namprd18.prod.outlook.com (10.255.236.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Wed, 6 Nov 2019 09:33:46 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::c4a:cf3c:f530:fba6%6]) with mapi id 15.20.2430.020; Wed, 6 Nov 2019 09:33:46 +0000 From: Robert Richter To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck CC: James Morse , Robert Richter , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH v2 20/20] EDAC, mc: Create new function edac_inc_csrow() Thread-Topic: [PATCH v2 20/20] EDAC, mc: Create new function edac_inc_csrow() Thread-Index: AQHVlIVJ7cGmjRflEUeKcnOp2bmQgA== Date: Wed, 6 Nov 2019 09:33:46 +0000 Message-ID: <20191106093239.25517-21-rrichter@marvell.com> References: <20191106093239.25517-1-rrichter@marvell.com> In-Reply-To: <20191106093239.25517-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0287.eurprd05.prod.outlook.com (2603:10a6:7:93::18) To MN2PR18MB3408.namprd18.prod.outlook.com (2603:10b6:208:165::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [31.208.96.227] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b3e277f8-9c27-4fcb-fa82-08d7629c6be1 x-ms-traffictypediagnostic: MN2PR18MB3165: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5797; x-forefront-prvs: 02135EB356 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(1496009)(4636009)(366004)(396003)(376002)(39860400002)(346002)(136003)(199004)(189003)(52116002)(305945005)(6486002)(76176011)(71190400001)(71200400001)(256004)(11346002)(446003)(7736002)(6436002)(4326008)(6512007)(66446008)(66556008)(66476007)(66946007)(64756008)(5660300002)(1076003)(476003)(6116002)(3846002)(110136005)(54906003)(36756003)(2906002)(8676002)(99286004)(81166006)(81156014)(316002)(8936002)(50226002)(486006)(6506007)(386003)(102836004)(66066001)(2616005)(86362001)(478600001)(25786009)(186003)(14454004)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR18MB3165;H:MN2PR18MB3408.namprd18.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: uE/ylMZt225LVrp6R7ymR2kZBRArqXUlSRPnsKcdaXYNBE/MyNy0GfzhaweTr69IovJ80+ya6RdT5dZUJTMoGckrZIwazqX3gUTySsqiger8J1Bq+fFgSrkp+4P7fv7V3TmH5qN/U2yyR5TPwoUepnmrgvKH2pNT4k8phCQ4Xd29sAflBpDhDZu07ed0T2gEerUGC3QrD2KS9E9YvIVwLKvCpzmIWt4HySK1AJElL8qWV12cpCaWqSHSsegPC0SaLak8WwEOPZGcoyAiYcABHGFuulyrqrTBckrO5flrq+VFTDsnNLdLcMWZ91BFf7Cs4Jet74baderz8BEqk/BBdWuS9oQ4TKHm1NbY0MhuFEB0NH01mOun31uVhxj1F0ujoOmBB3kXqYA1fii+oJaSB724ELmjCKkwZbNeyetogqQPSByAnDeW375231aQoFZ9 MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: b3e277f8-9c27-4fcb-fa82-08d7629c6be1 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2019 09:33:46.2545 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 1EzV1tVNnMZaR6Xy7odCv0jy7i9XU9xEAa+aFPk5O2fY5lX15oSuI914xFdUQd3GnArPEI27FC+Um+ruvUingA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3165 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-06_02:2019-11-06,2019-11-06 signatures=0 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org Have a separate function to count errors in csrow/channel. This better separates code and reduces the indentation level. No functional changes. Signed-off-by: Robert Richter Reviewed-by: Mauro Carvalho Chehab --- drivers/edac/edac_mc.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index 93eac968678e..34b740036ffc 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -1045,6 +1045,26 @@ static struct mem_ctl_info *error_desc_to_mci(struct edac_raw_error_desc *e) return container_of(e, struct mem_ctl_info, error_desc); } +static void edac_inc_csrow(struct edac_raw_error_desc *e, int row, int chan) +{ + struct mem_ctl_info *mci = error_desc_to_mci(e); + u16 count = e->error_count; + enum hw_event_mc_err_type type = e->type; + + if (row < 0) + return; + + edac_dbg(4, "csrow/channel to increment: (%d,%d)\n", row, chan); + + if (type == HW_EVENT_ERR_CORRECTED) { + mci->csrows[row]->ce_count += count; + if (chan >= 0) + mci->csrows[row]->channels[chan]->ce_count += count; + } else { + mci->csrows[row]->ue_count += count; + } +} + void edac_raw_mc_handle_error(struct edac_raw_error_desc *e, struct dimm_info *dimm) { @@ -1214,22 +1234,12 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, chan = -2; } - if (any_memory) { + if (any_memory) strcpy(e->label, "any memory"); - } else { - edac_dbg(4, "csrow/channel to increment: (%d,%d)\n", row, chan); - if (p == e->label) - strcpy(e->label, "unknown memory"); - if (type == HW_EVENT_ERR_CORRECTED) { - if (row >= 0) { - mci->csrows[row]->ce_count += error_count; - if (chan >= 0) - mci->csrows[row]->channels[chan]->ce_count += error_count; - } - } else - if (row >= 0) - mci->csrows[row]->ue_count += error_count; - } + else if (!*e->label) + strcpy(e->label, "unknown memory"); + + edac_inc_csrow(e, row, chan); /* Fill the RAM location data */ p = e->location;