From patchwork Thu Dec 5 09:37:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 180864 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1727908ile; Thu, 5 Dec 2019 01:38:14 -0800 (PST) X-Google-Smtp-Source: APXvYqxdsI4Xkxb1O+nbKDnLI1tmLAam1yZdj4EBypnFCBVaQYbRpo32C4KrlWjrVROgVM210o/5 X-Received: by 2002:a9d:1425:: with SMTP id h34mr5842376oth.166.1575538693987; Thu, 05 Dec 2019 01:38:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1575538693; cv=pass; d=google.com; s=arc-20160816; b=FjgTX5DQzq9DUnx74f8G4F+gi/xuQSjM2izLPFuvY4Aps18Y5OQ4PeY8apB1Yb8c7d bvK5ktZ6GHX6qrK5A4psdWaUGe+caZ0iHgLraUOpOK5HDAuIHtFBrIpNGVKFzR8PZ5tX YE2PzFm3YCM2dZcaUFKpGNLfYKdSuxoMYMZiDZFT0h+qq7fy/swHQwlXW2zdTB4sTKkp WIyzCXfXH7xH3fRL2ev5DBw8f6qz4uZ20V4OoWB37aL23cfgiYc09lqRfjJIcmP1x5sa yOh3YStDDxvDEV4Egscd63X04NCnZfDzO0jj7/yr4NrOIaTZM1LvAnA644o91COM8REb p7wA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature :dkim-signature; bh=GeftYgWYZz4kPHpEAIl+McoT1pguf2PIpRTnugslLh8=; b=R5g+i2cUq112ni1ZSeNDgQnqmeUeRnipSFdyAlchcQhbWJEfrua2OHppC6XF/sv5E3 ViPGxzrMCpU+GRcJDM1HQsfFSL8eB7e/EvLCwZ4Y8IGduUIzIOSYJ45L0vHikZlsRJ3p BjkPmoOZWNcEMdtBMi09CTbBAD2Q9KLejddt4rMTSH2cNNDdVXMcpaeB+dOO62HKwlgQ ogIhngP/3GflAk4OkiQ/YtqLWxE8YsfP6JDcPd5kiAgpUAdeyHZYCZq1i4aB+0p27EYk oyaIR46fJdebB10l0eAH0CjOpktglCjlkigvM0kGUBfvMhtOT+D5XqhytHm2t0kc90SF CjcQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=pIUnVAgY; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=bczzf3SC; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r132si4422665oig.263.2019.12.05.01.38.13; Thu, 05 Dec 2019 01:38:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=pIUnVAgY; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=bczzf3SC; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729216AbfLEJiN (ORCPT + 27 others); Thu, 5 Dec 2019 04:38:13 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:63250 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728707AbfLEJiL (ORCPT ); Thu, 5 Dec 2019 04:38:11 -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 xB59b4jF023588; Thu, 5 Dec 2019 01:38:00 -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=GeftYgWYZz4kPHpEAIl+McoT1pguf2PIpRTnugslLh8=; b=pIUnVAgYs0fAwfM3G2/81/PVsrnnY7P6dalV1fI76MxkovLethyhosFA7WX+TJ+VCkmw ll3TrkLAxA0tEUgb7zBB+Rh2yVSoRIhxd3DVeCGJQF23sa6+MilkiNhp1RWrpBn4rkjS H3rVUgYa1dZ+xJC/dN3AQPBvVnfkLeJXPDPStRGxp9dgY/zdebA5H+jUf5Q/i4FvRfvU +GW70/YO4jWM61QtLNwv4zvpkYd8PkjRHVP4WDpfcwYHOO03aMmiDDvDH+6dQZ0E0L+R zI5IArlb1G064oPSo/ejO2ku/Dfq6fS16j9jKzPrPpR+ZrsXrSHNhk6eLH6jE9NH2Mdk MQ== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2wnvgvrcye-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 05 Dec 2019 01:38:00 -0800 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 5 Dec 2019 01:37:58 -0800 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.58) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Thu, 5 Dec 2019 01:37:58 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KQ56IFsnfzwp3eOlA1f5T3zTkT6Ytb6tmt+++pOuKkLes50tfGMl7PR4avS6EnR7vpkPMYgZnAljbJwYKIxPLVY2rZuou729aid38X+4j9Am4fi6/4CyOwTcZKRxVb8aVjCms94nNDh8WLcQaKI9soE5AbTS0S1SBJ00eLHl2/+nts9LhEhMuGj52HCMA6xfGHoINCMvVXURVaPCuhMoZMqSCxfpsaDh+BV7RKyT7gXWbePefkTtqzEly1WVr9kgqCnrbypqMHfLMGz50yIvqaDBYOT9deTNv2F3umZM/MHa+IcHaMD0BFDHMRuHg7APXcT9VA+++ae5RhyqZU16XA== 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=GeftYgWYZz4kPHpEAIl+McoT1pguf2PIpRTnugslLh8=; b=G4ryZ7fJ3QOO7hGshYkVMYg0yWr4H4K3GqoRWaGzDmFCF5t2EU3nV6B6pGYyV+DwG9qqWFVvynOFhP0Gr0JysZfQYN4/i3YZie4f7NZ7hPVVXpFjJynu6/BpNlkt20AOst/uOVdSBwIwIDfIdUhcPgaBTC6+ZHX0MayVJ/CjupPpGKad72Kp9mMcnvSHtZby6YG+gapBhljJ4jPGF5fFA+JdFetjlARsWfswL4WIFFtwCYCZ8WAPxHd+PE+QTuErZ1XbUgM2RO2ADgKkb3Y71ShZPizFY/89IlwQsWPUX1BQQ0rw0oK7Z/JOvOLYod6dPThq9OZK/VekSsS31pDkFA== 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=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GeftYgWYZz4kPHpEAIl+McoT1pguf2PIpRTnugslLh8=; b=bczzf3SCi42XywtA5c94NCQb85PR14QeWT5xCRrgAqIZTfMiI01Qyfwn5U7RJUOAdUkVFitHuBRe096W48TGIHG921ynvlM2Y/ygUZWdkT/4dka9kTy4G4e5cCF7kDC12nKon0UXDNGnmlmJWaNilSSbxvlDEe4YQAml6mHLlxg= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB2367.namprd18.prod.outlook.com (20.179.80.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.21; Thu, 5 Dec 2019 09:37:57 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::657c:6c81:859d:106]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::657c:6c81:859d:106%7]) with mapi id 15.20.2516.014; Thu, 5 Dec 2019 09:37:57 +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 01/10] EDAC/mc: Split edac_mc_alloc() into smaller functions Thread-Topic: [PATCH v2 01/10] EDAC/mc: Split edac_mc_alloc() into smaller functions Thread-Index: AQHVq0+taMPTMMoQPUeGfck/EcAERw== Date: Thu, 5 Dec 2019 09:37:57 +0000 Message-ID: <20191205093739.4040-2-rrichter@marvell.com> References: <20191205093739.4040-1-rrichter@marvell.com> In-Reply-To: <20191205093739.4040-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0170.eurprd05.prod.outlook.com (2603:10a6:3:f8::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: 1fd058e5-079b-44d1-7e01-08d77966cfd6 x-ms-traffictypediagnostic: MN2PR18MB2367: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1923; x-forefront-prvs: 02426D11FE x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(376002)(136003)(346002)(366004)(396003)(189003)(199004)(81166006)(14454004)(36756003)(6512007)(316002)(478600001)(54906003)(5660300002)(110136005)(186003)(8936002)(50226002)(6486002)(26005)(99286004)(66556008)(66476007)(81156014)(71190400001)(86362001)(66946007)(66446008)(64756008)(25786009)(8676002)(2906002)(71200400001)(6506007)(4326008)(2616005)(11346002)(102836004)(305945005)(1076003)(76176011)(52116002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2367; H:MN2PR18MB3408.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: t9tJ59B9A4yA+5Fxp9JO362lsQzTo89SOcxHIYfSTdLQZIB/vl9CkaB9QclmyE0IbnhmTRJtr3uPaFaFQUvQXEN95Ss4LR2k7JSyGZKBJ8sx2zcsYGnuZYILLyR52hbYsicaH5VDnc4antf2w55v7M7FKwG3aWXbP9bHsxSqt6oBKvZeymV9Vq30GcTPTlBtzV5haaYL9Am6hiMy0PMpdm9dCw5VFoN8vWwIEXGuLKdXlYa3fUHAM49N+Uzh9lW/bA6VODl+IwkRQmYk2Y6kA2KyPQrZuskeSNekQIjJKAf6m4HXKlpCu1Fvlz3Z5jVnMvNQV+5/BxsLjVI0lW/gOE4+zmh8mLbC9NWNZENuTD9rSG+/0K5RERFexh1fyylGTt2Bja7VOr33hsnI5WD2u9SCqbkBOW+A/8HGhnuQP6v0XGEKEAOSR8TAzaQfQsIr MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 1fd058e5-079b-44d1-7e01-08d77966cfd6 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Dec 2019 09:37:57.8389 (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: Uc6+O5Vf/h9rn7KLGkqFvdvqc5CqNeD+5Y1/MQ+OYTuuTbay0YYl11hcL/P6tps79oTFNstyowsRPsLWGrUAyg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2367 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95, 18.0.572 definitions=2019-12-05_01:2019-12-04, 2019-12-05 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 | 105 +++++++++++++++++++++++++++-------------- 1 file changed, 70 insertions(+), 35 deletions(-) -- 2.20.1 diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index 7243b88f81d8..9068287604dd 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,15 +315,11 @@ 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; 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; - void *pvt, *p, *ptr = NULL; - int i, j, row, chn, n, len; + void *pvt, *ptr = NULL; + int i; bool per_rank = false; if (WARN_ON(n_layers > EDAC_MAX_LAYERS || n_layers == 0)) @@ -392,16 +391,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; @@ -409,34 +435,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; @@ -446,16 +489,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; @@ -467,39 +510,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 Thu Dec 5 09:37:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 180874 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1728492ile; Thu, 5 Dec 2019 01:38:53 -0800 (PST) X-Google-Smtp-Source: APXvYqx9Owcr7DGzUCxUUyoVMayUIJJgE84XLKbG1QLU1oXk7n9lAaCHa9Epwt/EUfhEVKUlxRDZ X-Received: by 2002:aca:ed46:: with SMTP id l67mr6235909oih.53.1575538733066; Thu, 05 Dec 2019 01:38:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1575538733; cv=pass; d=google.com; s=arc-20160816; b=AVwPY/6DxOdUkn3cEuIRYuFsyr0A+8JfNV1MRU9ZMuCHS/Ts8Bb42nwOZmExjMW7cL FemlmDvnQF4gCVuGeYhjiQXAEbHLc1N41o64cxWm2rfCevQiOmoO/0PF9u3xZs3dCmGT SvNL9EgPymK3G42TUFTM7samLl3qmNeTc0S2LH3ZD362A6owrJ2KsMmMLRqfaYiK4bRY 7UPD+xvM4YE6IY5WkP8mLhtLxzekcsXRnArNFOYFEs4jUaLq99r9ZQDccXcAvQanHW/n 1HE64o7rktQt+P1J5bm0mxtBLjy/S8R+11v31qgpwKOIyOTNLsludAXiFBm9vEKY+zG1 gwWw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature :dkim-signature; bh=VLw/rMyY0DRRcoTdhPTeXFSd28qQbBSgE+KDk2nrgWw=; b=aSjeljbiGJsUy0h+6UU5qU49G4cnq8HxOkUOinVTL3OWjfVu83sMMSBobmiZXtc9uY ng0jJVeV2ekdsymJTEbQAn7l+/112A214/k4cYS5gFuy3Ms7BAuNvA7nqIyz1ac0MsTd cYhzg5M8e5v/TqCrgee/tmWFmtEJrWwXU7dxfbvDff/ekJ/vjfgxJWu+/jNxvk6Pu5WZ 6e21jA0NBomMsSxZ2fwJM++PwCy59EuT9xbVPIO1yb+y3jYnhGkKtBlDLgczdIrIxq9d 7FspIrsWLzHH71bavPaKVlyPInO3pL7wgOe4EFDLYPElL3pt6xeM3Vv7TUewW2qm2iSG uSNw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=lZhMENem; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=PBy39npw; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x52si4590825otb.84.2019.12.05.01.38.52; Thu, 05 Dec 2019 01:38:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=lZhMENem; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=PBy39npw; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729153AbfLEJiL (ORCPT + 27 others); Thu, 5 Dec 2019 04:38:11 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:29260 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726384AbfLEJiL (ORCPT ); Thu, 5 Dec 2019 04:38:11 -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 xB59bKkW023619; Thu, 5 Dec 2019 01:38:03 -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=VLw/rMyY0DRRcoTdhPTeXFSd28qQbBSgE+KDk2nrgWw=; b=lZhMENemMHEzlBUR7m31FaRz8SWAD05+RvDz8i/CgLOJlNFSbNv4tKECjt6FCeR2dRba DfQ6lasBumUs26OUrDB8lTM2vTQWgkyeHIzZ3FkbBqH4NgfXtvBH+B7e4i3THKCKsoiC iZ4BafQ5anMSMx0CARXF2SLkgJwLJxTGupZ9ST2ttLXYhti8CF09k38BqKJwV5V4EZjr 1tKKcDl0VwXchpe/GQVb/teuOsdmKv42Eh30GOr8Veyat3mOlA2jKe9MYxh/1gCeMPgw OvgVUXX3mOVGQPt5cd0JGe4AdApKUm+Zl5pDIJgT05InOWTCH4r99BhXyJrpztUjiwtm RQ== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2wnvgvrcyp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 05 Dec 2019 01:38:03 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 5 Dec 2019 01:38:02 -0800 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.55) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Thu, 5 Dec 2019 01:38:02 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z4cYMYSZpVhtsi6ceQjuTvefXsudLZTl/wUoQ28/hexNFt5so65mzX7Jk6H8/54ZdXIMbA1NJzUkFqtb0ey54zlXpN+ovaeGjTPW5nWdAkgr2aHu2ogB7ksbL9yiKK/42of3AhYQGeTZo3ieZ+pLTPIIaREcANR59f+Re2ifV2GN6fVMTH2fa4+B6xEepT/2mnEo1X2VaW0EInwhPeQR1wLDXmCMssTnpXGgcGSWMYpEB6jbuHVG5e09uhcwHwbRDwlgSWeohGKr8eqzar9P8QTLirbLanyIG14YPVK8hoK2Mdvmj2vpJZ2cr3xyEySlcYwRe1wpw/Vmuq6U2r78Gw== 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=VLw/rMyY0DRRcoTdhPTeXFSd28qQbBSgE+KDk2nrgWw=; b=lBDNyMhjCTvp3sRQ9OLH2f+fMydq9tauLoKD4aq/ZUMtfhpY3+RN7C3pgT5o7QDClPqZ92sEitJOOm2Gzw8PGrlo2Xy9DgeEmIG0HkrIQVf2OOOMjY2+KhEjHN0gbfyIZAFAQVZZUmvDbOu7gH4++/ZpVX6dsGB3CZ3udutOno0EhQEENrQhQT0sSR78qYjFVDAJNrvPUqb1P/U9hyX9L6RQudrxdQjSGdeqMSSqxjrvh+mh10oshDpLjqXpyznLdeHMNVhLp4PKVewtdrMDAq3tZHPA4oaSTdAcDtiQAuKnwmvN1KiTp+1g3MToIpMGEDVBmqDqWJLUMVdjNAZnXQ== 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=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VLw/rMyY0DRRcoTdhPTeXFSd28qQbBSgE+KDk2nrgWw=; b=PBy39npwdrCzxuPmwFnIZNdyUuLhPKHZXd6myh7AiAI5e18POnRfvzX/KJf2S+ql9r9ooWJwovB6Yb/HuyIIPXxgrL4Zr2CVXhVVcl5ZZAg6C2sZhGWP4ru0m/VdEgNjG4DewP+l1us6MBnlAUoRPFWH2WGtGL8SOLzFYJT61Sc= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB2367.namprd18.prod.outlook.com (20.179.80.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.21; Thu, 5 Dec 2019 09:37:59 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::657c:6c81:859d:106]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::657c:6c81:859d:106%7]) with mapi id 15.20.2516.014; Thu, 5 Dec 2019 09:37:59 +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 02/10] EDAC/mc: Reorder functions edac_mc_alloc*() Thread-Topic: [PATCH v2 02/10] EDAC/mc: Reorder functions edac_mc_alloc*() Thread-Index: AQHVq0+uGfP8zCioCUSQF9fluRdaUw== Date: Thu, 5 Dec 2019 09:37:59 +0000 Message-ID: <20191205093739.4040-3-rrichter@marvell.com> References: <20191205093739.4040-1-rrichter@marvell.com> In-Reply-To: <20191205093739.4040-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0170.eurprd05.prod.outlook.com (2603:10a6:3:f8::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: e4a4d1fe-3d2d-4681-0542-08d77966d100 x-ms-traffictypediagnostic: MN2PR18MB2367: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1303; x-forefront-prvs: 02426D11FE x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(376002)(136003)(346002)(366004)(396003)(189003)(199004)(81166006)(14454004)(36756003)(6512007)(316002)(478600001)(54906003)(5660300002)(110136005)(186003)(8936002)(50226002)(6486002)(26005)(99286004)(66556008)(66476007)(81156014)(71190400001)(86362001)(66946007)(66446008)(64756008)(25786009)(8676002)(2906002)(71200400001)(6506007)(4326008)(2616005)(11346002)(102836004)(305945005)(1076003)(76176011)(52116002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2367; H:MN2PR18MB3408.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: 5S3435aybNtop0djMBNfRFm9TsCsNv6xVu7TZNIusKdQPOkwfxntMPoJhQceajqSAk4p//r/jtQCPriTUqMPMXU2gLl2TCNBHevtlOocoyFR98TuJ65Cz8FQNJLTCPq9mPIrpKHm+Ksl59cQMwG1qGaKORLcXBQ/ZT3jGKIaMsLZmaKtlsfrqFklAwF+8mx+AWMzsHqXdQPVmYaXnJBSfvOEppexHiQgVqRsp5/bDW2R55RzkWz/WNkqk2a7cwn1rWu48mKUwvwNEynGlTqBu9RmiCvaMrrdUPk8k4tkDtxL/h5DJq7sui7+KJ8RIVFOxWtxpQmRe9Tc0wUZ8bKSnIyplowe0AdtNTDQHggtNfUrttfX7cjiGOpncBW8n2tVAtyFB3MwILCu+oKsyzNHQEuNZn3p9CzQd6aWjYI3bVQ3jp1zmQ7++rFxXmqOqVKB MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: e4a4d1fe-3d2d-4681-0542-08d77966d100 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Dec 2019 09:37:59.8098 (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: HUA/v1cdphRuQdvIgihqna1nouLpJeoTaddky/dDZ3RNvoY8ri0mGIIPi0o6fXUfGGZzG9OW0qLpseWIg4d/Fw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2367 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95, 18.0.572 definitions=2019-12-05_01:2019-12-04, 2019-12-05 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 | 203 ++++++++++++++++++++--------------------- 1 file changed, 100 insertions(+), 103 deletions(-) -- 2.20.1 diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index 9068287604dd..f2dee4e8ba85 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -305,109 +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; - u32 *ce_per_layer[EDAC_MAX_LAYERS], *ue_per_layer[EDAC_MAX_LAYERS]; - unsigned int idx, size, tot_dimms = 1, count = 1; - unsigned int tot_csrows = 1, tot_channels = 1, tot_errcount = 0; - void *pvt, *ptr = NULL; - int i; - 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); - 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; - - 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)); - 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 */ - 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; @@ -536,6 +433,106 @@ 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; + u32 *ce_per_layer[EDAC_MAX_LAYERS], *ue_per_layer[EDAC_MAX_LAYERS]; + unsigned int idx, size, tot_dimms = 1, count = 1; + unsigned int tot_csrows = 1, tot_channels = 1, tot_errcount = 0; + void *pvt, *ptr = NULL; + int i; + 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); + 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; + + 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)); + 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 */ + 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 Thu Dec 5 09:38: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: 180865 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1727945ile; Thu, 5 Dec 2019 01:38:17 -0800 (PST) X-Google-Smtp-Source: APXvYqyKsPknZnkys7WoCx4sc3vYKw1P3OSMUTxdLovjPeg6qKEHDXZn3O7NiPhZc90eydduo7je X-Received: by 2002:a9d:313:: with SMTP id 19mr5912616otv.197.1575538697045; Thu, 05 Dec 2019 01:38:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1575538697; cv=pass; d=google.com; s=arc-20160816; b=Z4QKrjYTdZzfY2/nw4k+eDP13tHHa0096I0m+/1UvfdT0KmFwKDToPZJIttZliCCIK 1JzLmXO/suknNK/yO9RS7S+NIXqrloJRWhg3KdSupPF/5pHIAKigdoGih1t7r+Trc4Wg G0auD86cWZQP4tW4DhHFwRhnTUdNgcX8ux/5Q/jo8rJH+FeTcuNCazUo+9IUMu7IGYeM lM7+hrvK5jH7rK5oYiLjsaaWuoYfWRWdSZDtk8NxpS2/YB849UE9zcDELiinpPVNw4LL SosbsAQ1gMYn3o0e+VQin+nBd/IQj2EAohrcYg9Y6vAtjcswkqj0t/t0u6yKO49urH1E vZ2Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature :dkim-signature; bh=VcgVg3uNsxjAXMRsTRXPElCFXShVxk/CBxpn72jvrUY=; b=QcxhWomZQpdco4goDk2j78gMYkEIit7rzoDp/ua6ATG6tIJK+DMKMDR22xmQDopL8/ UpNhrm8/KeyEnorHfni3YTLDN3nT2EphPNON6amuYOtpWFovXLjl/8txMSDVHVa2XgaA TVS33Ui8EMa5d3wynkWif3dWtYSiSpGeRCae8xQZbBNtRTZYgYL4pKYh/tpXDjRUkQTy co8yVuhOrjh2epCGmhv5VKSWT0hbq95r+TUkSfkmR02x0R1N4LXlMKsKzaxitWlIx4Yd 4fwcDDkA4EVahExTSTEBbnOJe1vKO7U/Ia5bTzBZ2HsoB5N6bQFa3SJGVmxm4qcpsKR6 eI4w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=gvHokiDf; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=BG0ubPOm; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t142si4678805oih.242.2019.12.05.01.38.16; Thu, 05 Dec 2019 01:38:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=gvHokiDf; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=BG0ubPOm; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729246AbfLEJiP (ORCPT + 27 others); Thu, 5 Dec 2019 04:38:15 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:20256 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729215AbfLEJiN (ORCPT ); Thu, 5 Dec 2019 04:38:13 -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 xB59b4jG023588; Thu, 5 Dec 2019 01:38:04 -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=VcgVg3uNsxjAXMRsTRXPElCFXShVxk/CBxpn72jvrUY=; b=gvHokiDfALardjgCAm02HAcooTe0w2w9J4E/KSIXBrvOlEw76STX2KyTcWK1IiGRuJ+M Gul/9ihcuOtafK2klMX+HJCwQbDx+NqDb0ls2Wr1/HZ94AgCWc7Jh3q8LjVQb0RNMIu0 3BxvdF4F2eIx/OeBzERBywkoGT7qUQ1CnjPui17Gtik5BrnPCIOLspwBsT5paAXfMMkV rX9YtcmBsKvZfPmigPUSD9q8sl011G1ypo6Zn+jKotS+2C6AgNNHxdzFsys9gaO3kixs 2XgXHPyp9wBrOpHw6ytBvBYcMyUjtu8CWnDGke9p3LgOFlGVtNrKuOLfZkIoog8mXn/z tA== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2wnvgvrcyq-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 05 Dec 2019 01:38:03 -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; Thu, 5 Dec 2019 01:38:03 -0800 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.55) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Thu, 5 Dec 2019 01:38:02 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R44g7vy9ZETo2XpG7TwEA/b9UtV+iW8aONDR5V9h7r/E4+sILFmL2hnVqbShOE7Q1m1sglgYlsOR5A3WTWS7wAmXzlHC9LHmaoI0pMXKC1x1cLneLGOY4T2wt/6cOKXfVLFe5EaWaKJGbE9+nOmQrhaYASVGiMK6abUw1o1HRoqMKlJT3uRMe7VTJdPNhVTso/t1OM0AMjrYTPv//dFU+/GIbKDdP+r6ymTMlkdROvb8Ct9bQXZrN9KPUU0ZH9HMpzCK0xjQaPjjporu4fqPJ5iAKbgPaYpLqby8aWThJsNR3MgE1sqCP83mVdXppyef9qdJ8MBNIbhnQJn0j4+iUQ== 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=VcgVg3uNsxjAXMRsTRXPElCFXShVxk/CBxpn72jvrUY=; b=P2rQemk92VsOyjWQnuog1X7SSYVf7qDoxxg4X9itajJEaJSye8wGN63ns09aNt82IIsegZbJ0NzuIdd4CCJjEIi/j8A5f/Fny5fQ6QGhGyiO9lrxEZ8jhgSGU6IrN/mO85AXIuiLVZOS1P4ez8QZ5OwX59L/nw5SzEPZBlnUAwjJxdD2JW9hAusacEyW4a1oxodzwgMhf/a/yeExevxFHwWdww56Pi8P9HIky1gVoTuyVeBH2IwgfsX5N61oGno2EXIm7axICSX3UhG3zkEnjDZkPs2nwG1GcXiun+yULtM4V9sHB68FfqMM6BHwCUX5XlrBoQpYzrkx1QMVPKDbHA== 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=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VcgVg3uNsxjAXMRsTRXPElCFXShVxk/CBxpn72jvrUY=; b=BG0ubPOmSpEpALan8OsOmLzqM8H5WuJO52JJisBK4aAFm7Ri0S12/NlC+ug3PjrRb4GG0+RNFCyPUjNTq1e5kfcl2YfyyD2I7kS2i/bDgwIbt4IhlSKoAryKMgLqnXP4GLGCeIEqGj4fR9LfacAnfQy/GbHIhf39BUvXFCc97d4= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB2367.namprd18.prod.outlook.com (20.179.80.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.21; Thu, 5 Dec 2019 09:38:02 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::657c:6c81:859d:106]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::657c:6c81:859d:106%7]) with mapi id 15.20.2516.014; Thu, 5 Dec 2019 09:38:02 +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" , "kbuild test robot" Subject: [PATCH v2 03/10] EDAC: Store error type in struct edac_raw_error_desc Thread-Topic: [PATCH v2 03/10] EDAC: Store error type in struct edac_raw_error_desc Thread-Index: AQHVq0+wAVwKV0n23Uap0dgfSroNbA== Date: Thu, 5 Dec 2019 09:38:02 +0000 Message-ID: <20191205093739.4040-4-rrichter@marvell.com> References: <20191205093739.4040-1-rrichter@marvell.com> In-Reply-To: <20191205093739.4040-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0170.eurprd05.prod.outlook.com (2603:10a6:3:f8::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: bc4c514a-eab2-41e7-c8bd-08d77966d26e x-ms-traffictypediagnostic: MN2PR18MB2367: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 02426D11FE x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(376002)(136003)(346002)(366004)(396003)(189003)(199004)(81166006)(14444005)(14454004)(36756003)(6512007)(316002)(478600001)(54906003)(5660300002)(110136005)(186003)(8936002)(50226002)(6486002)(26005)(99286004)(66556008)(66476007)(81156014)(71190400001)(86362001)(66946007)(66446008)(64756008)(25786009)(8676002)(2906002)(71200400001)(6506007)(4326008)(2616005)(11346002)(102836004)(305945005)(1076003)(76176011)(52116002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2367; H:MN2PR18MB3408.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: Tgmpy8AriyGpKImrwZnacIIF12rbdHb585o2s07JqLAw4oyAFYgo2ceimcVA99vrHri0GsDLcHP/xpIQMKKwRpmb2DxTlgWe4Lp+1JnsOZvPYRi0w0zqAQpYdh5i/aQbr9gUpTPYdbUHSXHfLebzQwIxZXJ9bgtA0E/R6JLTImaHy/uaWvqbqINXBxET/u1Q5RWzEoz2tSBl0fPsWgIhYwfh9pOYkomO3WJ/Ry6j3tRGImegU0gqxsiNzMYsUuFZuraDjiHiUjwtBufKBAkVJfF7QbZFB0Q8Xpcw2r+kv3aJICadD+6o5nYyBYPjb5aKY2EsJtB+DALDzo9wAXveLua3iO0ejA2wj4HDecgz7Qz5UsFdXPl9exctCj2NA0LDKRpADr1eQeP8KEDsnV2b55DJuTN0jd6/DqEEI5QorRQcY66WvC3AGHxeRIsaRuSH MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: bc4c514a-eab2-41e7-c8bd-08d77966d26e X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Dec 2019 09:38:02.2204 (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: Jt7oRtyIPqRh7+Dn1idaVAxarBlUM1ebOnsxjaSqHqoQjpT7uhWNBPBiq2bCjQykTJg4TXROrgo0elCf3P3Mqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2367 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95, 18.0.572 definitions=2019-12-05_01:2019-12-04, 2019-12-05 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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. Reported-by: kbuild test robot 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 | 2 ++ 4 files changed, 13 insertions(+), 14 deletions(-) -- 2.20.1 diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index f2dee4e8ba85..ecab08032b4a 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -1084,8 +1084,7 @@ static void edac_ue_error(struct mem_ctl_info *mci, edac_inc_ue_error(mci, enable_per_layer_report, pos, 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 edac_raw_error_desc *e) { char detail[80]; @@ -1100,14 +1099,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, @@ -1152,6 +1151,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; @@ -1282,6 +1282,6 @@ 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); + edac_raw_mc_handle_error(mci, e); } EXPORT_SYMBOL_GPL(edac_mc_handle_error); diff --git a/drivers/edac/edac_mc.h b/drivers/edac/edac_mc.h index 02aac5c61d00..5d78be774f9e 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 * @e: error description * @@ -220,8 +219,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 edac_raw_error_desc *e); /** diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c index b99080d8a10c..7c3e5264a41e 100644 --- a/drivers/edac/ghes_edac.c +++ b/drivers/edac/ghes_edac.c @@ -201,7 +201,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) { - enum hw_event_mc_err_type type; struct edac_raw_error_desc *e; struct mem_ctl_info *mci; struct ghes_edac_pvt *pvt; @@ -240,17 +239,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) if (p > pvt->other_detail) *(p - 1) = '\0'; - edac_raw_mc_handle_error(type, mci, e); + edac_raw_mc_handle_error(mci, e); unlock: spin_unlock_irqrestore(&ghes_lock, flags); diff --git a/include/linux/edac.h b/include/linux/edac.h index cc31b9742684..6703eb492cd2 100644 --- a/include/linux/edac.h +++ b/include/linux/edac.h @@ -442,6 +442,7 @@ struct errcount_attribute_data { * struct edac_raw_error_desc - Raw error report structure * @grain: minimum granularity for an error report, in bytes * @error_count: number of errors of the same type + * @type: severity of the error (CE/UE/Fatal) * @top_layer: top layer of the error (layer[0]) * @mid_layer: middle layer of the error (layer[1]) * @low_layer: low layer of the error (layer[2]) @@ -462,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 Thu Dec 5 09:38: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: 180867 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1728019ile; Thu, 5 Dec 2019 01:38:21 -0800 (PST) X-Google-Smtp-Source: APXvYqx362V5p7eIFbsM38ynkmWIRpsDdvT3K4m0Z51H+Ox4v01U8JbRjbTijejE8DyrtfBrLEsI X-Received: by 2002:a05:6830:95:: with SMTP id a21mr5584487oto.167.1575538701568; Thu, 05 Dec 2019 01:38:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1575538701; cv=pass; d=google.com; s=arc-20160816; b=t5fkT/zY/0Be5z1srpnmhnqKFPzT5M0O2PziATge0rWPv6W1TUF33jqj2zdDKOq/6C iWuULunUsT/BTE1JYgU8LMsqN7doqsWnb729uett3NQbPFRCo5+wD+V+WEMaiIBMnNqb mH8l4ECS+m2PSw/Xk+CCXX0Tc6SdvRw1LfCNC0uaPU/sDno+WwRmtnARhoNWTBViKLJF Wpo2aYdW3d5Fb2Mj8+rt8CFCB4W183E6khK79T1Rbp6zlPYSf3YLk8eVs66qqQ8y/rYH Qf8NdaHPm7NLncoFJTpKEO6ifhbMTbK/uucKqs2wd0epjTwH9G2Jsfwz8eyoMJah12b3 mYgQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature :dkim-signature; bh=qV5qi/AfPq3EqFN41vakSlCrzeSPxB0+xglTrWS/iQs=; b=GiGw0SU7yeEeadCOkPyqwIM5JZ6zCW2OPldzps1ujkz9aJ9OicRFTUFxPVh825FgS3 KsR7VDDcmwmbeI4VNhi8HC0rXqhmNEzCn6v2LqmxN5k6fTw74svZdmeelRy0mZMuQlUN S6HbMuywW+Mnjy+IskhMs5XmEnQ858w6p/yxjtn18vzM4HtdFkFN2XTwp+Y7n5OTBI9M UVSBDgAgJpfEobBXdbPoGkcBqxH4UzHErHyVjbZ4LmPIwkTUDIikEaZuLbtoFlfmbMru GzYx5RaignerP1pj1eQzY9OW5l4MZP8akwUfx5B6GbAXb/KOMxOGIfDULOlBrpXKqrOD w15A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=lXrWYKGv; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=roDuDoLY; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t142si4678805oih.242.2019.12.05.01.38.21; Thu, 05 Dec 2019 01:38:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=lXrWYKGv; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=roDuDoLY; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729296AbfLEJiU (ORCPT + 27 others); Thu, 5 Dec 2019 04:38:20 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:48538 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729215AbfLEJiS (ORCPT ); Thu, 5 Dec 2019 04:38:18 -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 xB59avmA023516; Thu, 5 Dec 2019 01:38:07 -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=qV5qi/AfPq3EqFN41vakSlCrzeSPxB0+xglTrWS/iQs=; b=lXrWYKGvdE9ig6V7LzcukY41pezWrLxUH2a2piyC+DKyx7IE98QyTkA3tmOSpTBTO29r Nsbgk8QBSQA/X+3Vxf1OUr+i1qbYFVHY8MAsOp9V9GT+lLLjGEchA4e07A0glRSTHdPP InQHOp+3h6VUF1yNxyhFo4fvY3zB5Uu/A0dKq5f0V2f9eXedAYH4/rQS+c9uRYLvie5S gvyF6aFLWspfeS4INWlX1mK17GlDfYYyfS9499HCV4DR7Avep7Jd7ydpgCAo3kJz9cFL t7zcJCCd1JmtI8jUIwYaj8AwqiLWN0O21AzTnWSZII14mZScsgtCbI2oTEONQ6bt3D3z BQ== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2wnvgvrd03-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 05 Dec 2019 01:38:06 -0800 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 5 Dec 2019 01:38:05 -0800 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.54) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Thu, 5 Dec 2019 01:38:05 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZbKfMnvDKtspl1kxUjT739vrfUhwG4sw9TRVshDoYC2orffJUly90PvBXMNXpHVk2BW/It5RHldlJkRq1XKVKCRfKKa7s9639AwDBHimmNS5X5s0QgNhIUDpLOIbPr73I0L0B+iv0O0sdnTa2whe7TCbHz/frjlCepqVEUdtI5lk0QWd6mw14mMrQxWYMaHDMg5hwHDBBXrMJy5KgzXpsz3ZQYTCxy5g9L6FwEaGYmWzEjZFcxPGijz44lNlwGQwnPI++f/ZYJvuUDlLgBz1gPSXpEFdq64vIuGn+f1HX8TbcNAPeeJPjyzkSkHE2Rxif/JnlZ/AvfgcFBC22nWO+Q== 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=qV5qi/AfPq3EqFN41vakSlCrzeSPxB0+xglTrWS/iQs=; b=nXFDjEwUaTA7YyfuvzEnCz2Ls+qyGLgDjom9sPUfsBnHWACX9RePPYUEhfAbYarBwwXcsnx8VFpzJhZh+nQjJsRa6Bq0HaWQHTzSJJWU7qdB9XbKNlPOq/F/9o3iAOYawwcAuVrOcqyqNt8GYwNYrXn6/65NiVNLYnPTton5H/8r6B1fJa9SicCllHj05dCRLFt6gBVds88fwQm7oOJUiUb02RShvSo5SUs54WamDVN0yuTzHhONMkBj0fr4cPiwKb5QWBIJiQ2m+o+aMxf1UwXJSesgLbVA0UtozrQrB6Jp9hzuioAxXCefs3k8nHGIP2ilkhazGL47AzNqtexqCw== 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=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qV5qi/AfPq3EqFN41vakSlCrzeSPxB0+xglTrWS/iQs=; b=roDuDoLYRfnzIrKCH305mI6NX2aPc2X6c4KdpMP1bhyVsF5girve/RnRz0Lx+WEdUHQCKpzNgJglRpzqLTYOhStcXpR3m0FqtLvLERjd5MvKumev2Uu/O7IuYg2Nkih2wU1tyO5tADQBzCX04oGyV9h6anzVhS8n9UVme5kA0ok= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB2367.namprd18.prod.outlook.com (20.179.80.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.21; Thu, 5 Dec 2019 09:38:04 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::657c:6c81:859d:106]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::657c:6c81:859d:106%7]) with mapi id 15.20.2516.014; Thu, 5 Dec 2019 09:38: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" , "Mauro Carvalho Chehab" Subject: [PATCH v2 04/10] EDAC/mc: Determine mci pointer from the error descriptor Thread-Topic: [PATCH v2 04/10] EDAC/mc: Determine mci pointer from the error descriptor Thread-Index: AQHVq0+xb1CUUMWr+UmUY/kup7ElpA== Date: Thu, 5 Dec 2019 09:38:04 +0000 Message-ID: <20191205093739.4040-5-rrichter@marvell.com> References: <20191205093739.4040-1-rrichter@marvell.com> In-Reply-To: <20191205093739.4040-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0170.eurprd05.prod.outlook.com (2603:10a6:3:f8::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: 45551063-58ed-4b20-cec4-08d77966d3c8 x-ms-traffictypediagnostic: MN2PR18MB2367: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-forefront-prvs: 02426D11FE x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(376002)(136003)(346002)(366004)(396003)(189003)(199004)(81166006)(14444005)(14454004)(36756003)(6512007)(316002)(478600001)(54906003)(5660300002)(110136005)(186003)(8936002)(50226002)(6486002)(26005)(99286004)(66556008)(66476007)(81156014)(71190400001)(86362001)(66946007)(66446008)(64756008)(25786009)(8676002)(2906002)(71200400001)(6506007)(4326008)(2616005)(11346002)(102836004)(305945005)(1076003)(76176011)(52116002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2367; H:MN2PR18MB3408.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: TyDrnfzeF29z4NnAZK9AhoM3a7bGZMRSbdeSVcZSk0yjtBMNsoLjEdI7Yq4MQxqHy6HKhnmi2NNVqfZmbgw+ZSwKvRlXqiAd5a5kEtigSs5iJUysurPyx2z8d7mxlcdzYQu64CbfsHDdH5wWIrgUyXAIkERQDpY4JhHuaHqhDX+lqVwGI9vh6NmH5zvrvZA5LzaTKAzidlWynRsQ/HTVF8y8XxGYP5R9mYgah4oHwKfJ16CvVvwIw05pIgTyjF+aSLClhVWNaDMpVNS43PCdHOZlZGdP4cYWTGSdDD0wLnQcOaC4hV0xEuSfoxM7/7d14XD3IQHnkcyhphYvioGaPSFpVbbQvCSoK2evRKbdYRNn2VEt1+vVqbZBuVq3DE6TptfufVxsB2p0D+ojmgkwvmugenNtVJRzDl4H68p5NkxVrUp9ySukxpcJ5iS6Sneq MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 45551063-58ed-4b20-cec4-08d77966d3c8 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Dec 2019 09:38:04.5231 (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: tisSjB4d+dETnl2r0Hx4UP7tJYB974sIZ2Zk/rkINXjSTHpc6/mlLHqsC4E90Qha1H9Yr6uac856qJ3Juh6nvQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2367 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95, 18.0.572 definitions=2019-12-05_01:2019-12-04, 2019-12-05 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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. Signed-off-by: Robert Richter Reviewed-by: Mauro Carvalho Chehab --- drivers/edac/edac_mc.c | 11 ++++++++--- drivers/edac/edac_mc.h | 4 +--- drivers/edac/ghes_edac.c | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) -- 2.20.1 diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index ecab08032b4a..aff0630c02fc 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -55,6 +55,11 @@ static LIST_HEAD(mc_devices); */ static const char *edac_mc_owner; +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); +} + int edac_get_report_status(void) { return edac_report; @@ -1084,9 +1089,9 @@ static void edac_ue_error(struct mem_ctl_info *mci, edac_inc_ue_error(mci, enable_per_layer_report, pos, error_count); } -void edac_raw_mc_handle_error(struct mem_ctl_info *mci, - struct edac_raw_error_desc *e) +void edac_raw_mc_handle_error(struct edac_raw_error_desc *e) { + struct mem_ctl_info *mci = error_desc_to_mci(e); char detail[80]; int pos[EDAC_MAX_LAYERS] = { e->top_layer, e->mid_layer, e->low_layer }; u8 grain_bits; @@ -1282,6 +1287,6 @@ 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(mci, e); + edac_raw_mc_handle_error(e); } EXPORT_SYMBOL_GPL(edac_mc_handle_error); diff --git a/drivers/edac/edac_mc.h b/drivers/edac/edac_mc.h index 5d78be774f9e..881b00eadf7a 100644 --- a/drivers/edac/edac_mc.h +++ b/drivers/edac/edac_mc.h @@ -212,15 +212,13 @@ 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 * @e: error description * * 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 edac_raw_error_desc *e); +void edac_raw_mc_handle_error(struct edac_raw_error_desc *e); /** * 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 7c3e5264a41e..bef8a428c429 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) if (p > pvt->other_detail) *(p - 1) = '\0'; - edac_raw_mc_handle_error(mci, e); + edac_raw_mc_handle_error(e); unlock: spin_unlock_irqrestore(&ghes_lock, flags); From patchwork Thu Dec 5 09:38:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 180866 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1727989ile; Thu, 5 Dec 2019 01:38:19 -0800 (PST) X-Google-Smtp-Source: APXvYqxN4ikKycQI7PVE+DV3vyeetED4/E6nTOnv2tUFlD8XR17ykQpudDyXHeX75jIWOqrKAciN X-Received: by 2002:a05:6830:1e7c:: with SMTP id m28mr6070453otr.131.1575538699327; Thu, 05 Dec 2019 01:38:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1575538699; cv=pass; d=google.com; s=arc-20160816; b=ay4S7zkPLSrggP3HKdmfgHTE/UNJMH3yRnixLmT/S3AG34qmuCIkRxmu12tQp7vTVL ODe3HaP2uoOv3z+bOFOQEwmARpEJquHSJ7K93ETswiUzXkGZBmCggYi7ACNhrKW4XJZa IOUCTVQYqBhYNqIjr+TQdJz9TFs3H3OEVnFjgsNjB3f2HBFRqDTlDQ6k8SsCwvqNs4TL 2V/by9K5LekonhbY65UcjqECa3b5hXx4veDISj2GPMerwd6V1btVEZgqBaqRkMyIMnI9 ugSiJVUN4BrA9vCLYaN++q215GtmQodCjRw0+6SdRaM4icJ0ca93EHfFqef++XfSizLG Aduw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature :dkim-signature; bh=YYp/oOuA8n2lwLMoUuW95cJ2bKYWXJPqEGaTueCLunw=; b=0MQvffLlZ+EhVKnBad7hPfFc49LU4OP9rP0MQsb88WTlRjchTjbsIHt1whnQGp2Val 8vLUrpyWHn9sfjOWw+VhQOYcQsSHaWtVsSUsa55VZDGTTEJScwhMEufIbdXXEfl7rZx9 gZxxtm0eHXH7YQBd95qJ2PbFNhAdR2ZRAIqtNVZNHRMzoaMHLrtKVaA/c3DbHfvS5uky AWYmYJSaeyLr4vZhBXT30bHztqCpTCSmi/3DtUbVamLf/IGdUTgu8FouOmviCku2q7Zh cYL3VQ3zKBrr4WtIA3Rmf6QJQJ2Zertg0civo9UTADRmC20wuUIWKqS6xmCWfNBR2VQ2 cW+w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=ogsSB1Jb; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=UVJaZ+KS; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t142si4678805oih.242.2019.12.05.01.38.18; Thu, 05 Dec 2019 01:38:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=ogsSB1Jb; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=UVJaZ+KS; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729276AbfLEJiS (ORCPT + 27 others); Thu, 5 Dec 2019 04:38:18 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:40864 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729215AbfLEJiQ (ORCPT ); Thu, 5 Dec 2019 04:38: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 xB59bcUr023683; Thu, 5 Dec 2019 01:38:09 -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=YYp/oOuA8n2lwLMoUuW95cJ2bKYWXJPqEGaTueCLunw=; b=ogsSB1JbFHKtODdhmck6Zioufmn6yFKdCLgvxOnheapgK1wPdXuTGQ0KnkM3EstnX7fg ax4CD66VFpNp6piuNrFHxkO3MD4jlJGgCzwPWb7yJx2jjthhKN6tGj206RYFrDiuweYA leH52mDE9KWuswTn55OORsj+CerGHkrg3NuqtroV0/VQWUbqggT4tfKTpXg3MJPSL/z1 dnjs6Q+SyRVHFrZRDDXwTCBcUfdnfiw5UaJJaoEp8MNeaAPGje8Ts0KEqSYaR12FDX6Q 3+njaxYq4937/zk7ZJZGpTurEYk3uwNH0IT80xENVGRMRwrMEzR0MDfrm9NUGjg/xw7G Zg== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2wnvgvrd07-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 05 Dec 2019 01:38:09 -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; Thu, 5 Dec 2019 01:38:08 -0800 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.53) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Thu, 5 Dec 2019 01:38:08 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F8b3zeab3mtCKRN/27zVycDX8MmJGuEpA/44E4Si3H56qkLpe0Ps6Yl7C9jeD8raITBaqN795O/Gu5jFv9FJmDmkAIp4b8xZ2I3dkHxswH8ataOniJLlbu59AnEf78JDz2e1Z4s6b+abVBE3w/y9TQh9JhgkhPTN14ChLK+rR137oIB9RJpZyogyHOPuvOraiUpiSDfUcbFwt+arKo6JDmnkbMnikUwAZ++qT/HxzwU97ph/aQYUYywYG055th3zhoMv1C9jrftqOz37mDDtI7OstRZXqnoatQOVc3pwxakZSyYVxkMKd+CBLGcedjCeIjwDH0AkkadELF2kvLHqwA== 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=YYp/oOuA8n2lwLMoUuW95cJ2bKYWXJPqEGaTueCLunw=; b=VH1rQfBRvHtSSrP/57FKXGlk3PiCVdKD0dsG53LTk+fDSbZEYuEjwMp5uIA4taXZwPdQGmH5HgyhCquAJnnmu/3I2a6XELr1J0MuemKfOPvQaUCniYiCyCZoKQYnEK4VQh9FNFgp/AKd8cmvpZ7ReLBxPpQ8V4LPQ5fM3aKYcraId8ZrhVVTCvvAfDnB5ClZSgeN5DJYombxWHgvMtSGzguy+5UD+S6Qchc92WSHnEse0maFbC/tOW6RfkllSkemqzb1hK5h+nnQv1Q0K58eP5G2K2BIUsyQvNj9E63wN9aLtZX6cDjOdUAZSJclPPWIw4Xp4ODFHP/N08DqJxYanA== 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=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YYp/oOuA8n2lwLMoUuW95cJ2bKYWXJPqEGaTueCLunw=; b=UVJaZ+KSY/8oBr0HPKHxzZBxTJ37cwTSt27JjzmkARvajtVCzrdDv/yMPNTpnQDz1gnk/gxEWgT3rJyCh+xPkmXEO1SOsSXx2Do2D36F2rWO2chifdRy4wqvBKluTNSpc68Dqq1SFs5fe1h89LfhI4Zb4zTj60Mj49rkHou+uXw= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB2367.namprd18.prod.outlook.com (20.179.80.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.21; Thu, 5 Dec 2019 09:38:06 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::657c:6c81:859d:106]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::657c:6c81:859d:106%7]) with mapi id 15.20.2516.014; Thu, 5 Dec 2019 09:38:06 +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 05/10] EDAC/mc: Create new function edac_inc_csrow() Thread-Topic: [PATCH v2 05/10] EDAC/mc: Create new function edac_inc_csrow() Thread-Index: AQHVq0+yPgEeAv730k+GRrQq6PBK8w== Date: Thu, 5 Dec 2019 09:38:06 +0000 Message-ID: <20191205093739.4040-6-rrichter@marvell.com> References: <20191205093739.4040-1-rrichter@marvell.com> In-Reply-To: <20191205093739.4040-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0170.eurprd05.prod.outlook.com (2603:10a6:3:f8::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: 7c74e149-7baf-4487-c74f-08d77966d4eb x-ms-traffictypediagnostic: MN2PR18MB2367: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5516; x-forefront-prvs: 02426D11FE x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(376002)(136003)(346002)(366004)(396003)(189003)(199004)(81166006)(14454004)(36756003)(6512007)(316002)(478600001)(54906003)(5660300002)(110136005)(186003)(8936002)(50226002)(6486002)(26005)(99286004)(66556008)(66476007)(81156014)(71190400001)(86362001)(66946007)(66446008)(64756008)(25786009)(8676002)(2906002)(71200400001)(6506007)(4326008)(2616005)(11346002)(102836004)(305945005)(1076003)(76176011)(52116002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2367; H:MN2PR18MB3408.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: LtXIVR5zZJNBs4smPiuMLPb76PjgR1+MsIQTGYbhN3wFntR6HIFB23AXdUFtGpBKIzC9nhpxJCI7HGgqS8+DkySlYqBSZGJz2saTF8OdDbsqxCKKaYKmomXUQ3fSBdUmilLnezc045lqfp+GZ5ViP8ZMC+QDNVk4rjYXyOaIgejW3f3lN6sK2FnhYpkAfzxHYaRR6vjDcELGfX5nQP944uijSFZ0eJvHuSG7EoeWxboD3YSiboZJpF387DcOzIAKQRZSaZ3oZSovXxd5M9Wpi3/hmhSU3yUfVeuJ6LnWYybEOSZhmSTDIm1plpuqXXNueAWpIcH0rBfiAFpiFqkVNIkzp6ZZcAkY5/fsYxfEYcUFexPNobPwbxO30K1F40OcLQsclSXeDbwF9XToSf1HOzcbBPrO5rvXF2a5fztAQcwro9fM3B7mPQOq1ELW5I4A MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 7c74e149-7baf-4487-c74f-08d77966d4eb X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Dec 2019 09:38:06.3690 (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: WJ+qbs5JTr7I3QczDHGYtwZ8/0+80418nPRIkigjfJL/XkqOgd2KaI4dn+OOOv3OL+HrvsYLWciECwOmRPz8ww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2367 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95, 18.0.572 definitions=2019-12-05_01:2019-12-04, 2019-12-05 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) -- 2.20.1 diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index aff0630c02fc..e81d33960a0c 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -1089,6 +1089,26 @@ static void edac_ue_error(struct mem_ctl_info *mci, edac_inc_ue_error(mci, enable_per_layer_report, pos, error_count); } +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 mem_ctl_info *mci = error_desc_to_mci(e); @@ -1256,22 +1276,12 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, chan = -2; } - if (!e->enable_per_layer_report) { + if (!e->enable_per_layer_report) 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; From patchwork Thu Dec 5 09:38:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 180871 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1728292ile; Thu, 5 Dec 2019 01:38:39 -0800 (PST) X-Google-Smtp-Source: APXvYqyo2YxSs/dMMAtqz1FImOwzZ83HB+nSB22jLSIviQA+99BDUEfTgyXBifLV4iL8NBNOS1s8 X-Received: by 2002:a9d:7e8c:: with SMTP id m12mr6006882otp.346.1575538718860; Thu, 05 Dec 2019 01:38:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1575538718; cv=pass; d=google.com; s=arc-20160816; b=M1lAUV/M0XHOhAawNCBHn00z01M7bWGnzPBxCKS9wi7KwJ3H4v07vbZOhYhXLK+/IJ Dilc0uF3eobrxTTag+YZ1RS0mu0zoq6zruC9EuHQC8jryz7VSznreWYkTIK2tUstQYgl X335IQlx7f/495SkkrAI8WMYK4LACjWhFmpr1H68Ua/E5sV8/Ni7JqBsURyB6P6TF+v0 r2ia86c6yVbse5g9iU4aA8Widu6y0sgEc/ItdQy/4QtP/zPB+cSRKs8WnKFCpWNdmLkO RTcTedMtW81vvoOYqeaFg6/pzZXHtNDBPs40DOw07ADxYQwlv9mjHyDBjGmHOTRGB5KC KAYw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature :dkim-signature; bh=p4XQFsZ1vCxGqQKEPMJI1oMeRWfaj3eM5bgY3ORJMl4=; b=tPxhlYlBs0Ej3DYtxoOwM0ipEXRUKS27pK3d4rhHN84rU/Cy8syORmdzNHw5YTgGa6 SDTgKJCALvnEOmXwjk9jTFdgiJo+xZg2LCQzE0dDstieBvxKnEmH4nCAQzUTz9dNW4B2 WrkuOh0cHOK/KOODk0ojJYVrBq1z6n4XZf62GQdfhXGzg3Ii9IwlxfzYrf9bC4fHZw1p xjRo721oo/HQvgzgAemuOGaJPr+QWsb58uG9Mg7CjH5wLS2urcNiHSQL/Pg/q+C3BjBw PSdoF+4ZC1wrdIacw0CkhGghtKUcPXIS2OWYcDlFIg6qDvHSEYNXmtFrzU+LNpXpQ8J1 SPOg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b="Z7/HZNuC"; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=Lx1AhorO; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u12si553455otq.51.2019.12.05.01.38.38; Thu, 05 Dec 2019 01:38:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b="Z7/HZNuC"; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=Lx1AhorO; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729338AbfLEJi0 (ORCPT + 27 others); Thu, 5 Dec 2019 04:38:26 -0500 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:17372 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729102AbfLEJiY (ORCPT ); Thu, 5 Dec 2019 04:38: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 xB59XxxC004816; Thu, 5 Dec 2019 01:38: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=p4XQFsZ1vCxGqQKEPMJI1oMeRWfaj3eM5bgY3ORJMl4=; b=Z7/HZNuCN5bIuGVM4YmOViza3q4+pDjFoW43j3qA5ri/ogPl03Rfb4+N78png/KLYiKH fGS9EEpIbpb25wthrn3LK7vwBqiZXzH2EKchD9mwAt9R1aKeBzpAjDTGj4hgE4Lp4S36 BmDiuqzivCfjGVOpYs85fGWbxudZmUzLola3nxYreZQ8IeLacIz14epGWx0DxV3lcQMg pcIp2zHekN8o6w5dZe8jELDJ+YG0LYV2lkCK41pGCgUKN8/Yr1KfHs2HV93NGouYL5lQ f3PWlhjpJNyJaZEIJikj9tSLwl6apee/Xfh/UEcNreu83ZDnVr1L7vVHoaI1XhEuihiC yw== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2wpybwg0d4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 05 Dec 2019 01:38:12 -0800 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 5 Dec 2019 01:38:10 -0800 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.53) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Thu, 5 Dec 2019 01:38:10 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZBy2SSg2OQHqPLRkQ1A+bTBXu/RrMx2s7TwB4Sn0NsKVRR+Bvp9Z52JEEXZ2aTPzeuPfUzIwwZtzPUrZhUw1FQSlf+rE1RurQlygAhPuaBkGcyy5cmEEiNsaZv8qeOxWuCNY/JcUA/inIywfYgvuP29rffsMhatgdzTpmkiRaiwpAE/SuAUjf92zKuEENWOWA9lNqA3v0fjKA1O6cIdqnBW0lbrv9ECobKYIA2+xahLrHme/4U9hoqnm9uprx0U5Uv/gIDiwp9ytn1PiuNeZe1vYXXDSWY83Rsc6/jiD0JFEBerp4+DeP8NHUa21cGk6WYwARew4KT6yhIHMBiF8yQ== 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=p4XQFsZ1vCxGqQKEPMJI1oMeRWfaj3eM5bgY3ORJMl4=; b=K64d4I0LxLT7qx7CJ9aC+rYyxKD1BYpA6J5Q5UWwb+ML549z90gr7Aio3gqcZnbvZwDYsVjwzTsbDGybG8SoxGOWhJkizlY5Rj64LGo13dkW3xxSHYmFcM+n0IDtYPmR6j0LT3E3ISZo/oczZygWKP8qH/CwKrhc7v0Nqsz7oXGbBEk2GnjKnk0HgqPOJbsix6S1NtoYTKDAkfpdU0jn2iWjHCyOT7+aMppZp7PLHMmDMc/titdryJe4rVS1r8Ydlv75nd8ucsWmeq7WkBvuit6XIyAtsbfU/LXqvyNRWRrSr05CjeOwx5tHNckB6F+vgWhb6GJ4VrrSjq3BXdrwfw== 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=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p4XQFsZ1vCxGqQKEPMJI1oMeRWfaj3eM5bgY3ORJMl4=; b=Lx1AhorOYUgR+tFIdWBG2T3dPwtuR0DrnC4Pp4es7l8UXJzxNUxso+mVATujnelDyw62uGLFLQhl+kfTJ6hORZ19pRjxyC7seHw/1GFmecZly/vRKZk1nVITwhFv/BUC9WekaUfP/E3B341cgelrVn/u0v9k/8q3+eKOm3/OMxw= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB2367.namprd18.prod.outlook.com (20.179.80.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.21; Thu, 5 Dec 2019 09:38:08 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::657c:6c81:859d:106]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::657c:6c81:859d:106%7]) with mapi id 15.20.2516.014; Thu, 5 Dec 2019 09:38:08 +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 06/10] EDAC/mc: Report "unknown memory" on too many DIMM labels found Thread-Topic: [PATCH v2 06/10] EDAC/mc: Report "unknown memory" on too many DIMM labels found Thread-Index: AQHVq0+zgY+Ar2abxEWY9eRyfsDdMw== Date: Thu, 5 Dec 2019 09:38:08 +0000 Message-ID: <20191205093739.4040-7-rrichter@marvell.com> References: <20191205093739.4040-1-rrichter@marvell.com> In-Reply-To: <20191205093739.4040-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0170.eurprd05.prod.outlook.com (2603:10a6:3:f8::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: 8ed2afa4-4298-46d9-fd49-08d77966d604 x-ms-traffictypediagnostic: MN2PR18MB2367: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 02426D11FE x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(376002)(136003)(346002)(366004)(396003)(189003)(199004)(81166006)(14444005)(14454004)(36756003)(6512007)(316002)(478600001)(54906003)(5660300002)(110136005)(186003)(8936002)(50226002)(6486002)(26005)(99286004)(66556008)(66476007)(81156014)(71190400001)(86362001)(66946007)(66446008)(64756008)(25786009)(8676002)(2906002)(71200400001)(6506007)(4326008)(2616005)(11346002)(102836004)(305945005)(1076003)(76176011)(52116002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2367; H:MN2PR18MB3408.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: F5GpYosiQTlNCnl/HRDFO6ckW1JoLOtat6WrLKHENE4x8yS+/+GH6MJgzHo1DHrsVJ/w65b1t0ATYyJsTiTfPctCtaOFWTOvsY7XxezZ5Se/VvzkatujPQIH6Ht4q2cgBpR7gfoJFF6J8j8BwDf6UWuxvBmbWEr8KD6K5PaksU/sQv8t3RELDp2pwLn6iSmOYdf/BQ+uRipLtJ6gMivUWe7eov9WgwQycyZS1bpqoa3Fri48iBNdOdHKsykzfYfzLIDoPlFBms7SHEyYtYGOszGU32ODyPVHM/kevQYVI6afweiy9X5Msjj0l3UlkZVseWqgS69gjrZXGSQ6I28Jm2cf/XXhIlOLP9mcb+m7OlYL4iVSrYlJUoPngtbKutpnmo5Et/4T4+B31neRalb2S/bjxUyr8iyw2IEX1Xh3K9RpUn5+xAF1ix+W/pp33g7V MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 8ed2afa4-4298-46d9-fd49-08d77966d604 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Dec 2019 09:38:08.2559 (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: dnk4ky1acYdfAPzun6Skn1x7qD1XKWPlRaJ8u4h6JtsaNep3/phzBlGN63TkByNZtMmBSRFM1aNTfYzCQoIelw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2367 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95, 18.0.572 definitions=2019-12-05_01:2019-12-04, 2019-12-05 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is a limitation to report only EDAC_MAX_LABELS in e->label of the error descriptor. This is to prevent a possible string overflow. Current implementation falls back to "any memory" in this case and also stops all further processing to find a unique row and channel of the possible error location. Reporting "any memory" is wrong as the memory controller reported an error location for one of the layers. Instead, report "unknown memory" and also do not break early in the loop to further check row and channel for uniqueness. Signed-off-by: Robert Richter --- drivers/edac/edac_mc.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) -- 2.20.1 diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index e81d33960a0c..2b12320ce2f1 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -1243,20 +1243,21 @@ 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 (!dimm->nr_pages) continue; - 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); + if (n_labels > EDAC_MAX_LABELS) { + p = e->label; + *p = '\0'; + } else { + if (p != e->label) { + strcpy(p, OTHER_LABEL); + p += strlen(OTHER_LABEL); + } + strcpy(p, dimm->label); + p += strlen(p); } - strcpy(p, dimm->label); - p += strlen(p); /* * get csrow/channel of the DIMM, in order to allow From patchwork Thu Dec 5 09:38:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 180872 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1728376ile; Thu, 5 Dec 2019 01:38:44 -0800 (PST) X-Google-Smtp-Source: APXvYqztPnvqHTNczIRzfEnNXPsx14iWEN1cTsR6pyfdvsB6lleFVQBG01niyOOZSJPrFXLHLBYc X-Received: by 2002:a05:6808:687:: with SMTP id k7mr6552561oig.115.1575538724272; Thu, 05 Dec 2019 01:38:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1575538724; cv=pass; d=google.com; s=arc-20160816; b=B3LCO6n9ve5sW/YRIG6nkdxdd+jCbds0Bxc2Snn5lbJ48Zuv2Yd0NebDo3IZzMCSvE UJYEC+d5NzAQyHPTNL12x2xuJozxsy/rN3BvJ/UCB0YeHNDBGy51S8Z73WNQ5Mg+Ga9L VT6yH2FPLfXD2EwZAdY9bGEIVpm10FIch6SFJgJCocCYr8gEGiu7we1wJothLsZkEd8f LSBy0WD3Jxwd6tcuJlI5LC1dYyp/5u8isuOVMPIeMYjzht4bzlVXzxaL5mjgGMQ3NCgD ag7Qc+8Q4++TQNPpdi7fP5NhRKZ4S/VYgM10JdpG9De39RKEIosDKLpuuBmoK49syhXp ixPQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature :dkim-signature; bh=7QCxQf32pX5GTSWyiY2ZvY/59cTZ0aadsulEaPBkvR8=; b=Mw5mzLhJWyAOKL8LQpCeE1S6pDKMDlpHEsubC7J89Sm/vUFINYOU898cXpqgbLMRJB AOgE8vrN/7g+8p5/ArYr20BvaaK4MObUGO5bj5Hn+WtbUecDTAGXYWJuIMsqnp91czL2 5xUGDfdILhXto56mczSOwOuVB4407hgmK9Ce3V+QNEwHXZFVFIADctEkK/Yq/Dzowf35 27udXTeBS2EKleqHJvGx7Do1a5wuHuCGKB3weRjWQVjdcsILLNn2tdsGiEK86BPaKfsN sNPLoTCTD1LP1qiZeLiz9dgt1lfU8dJJ8/b/Bw1deBNTb+kW+rzURiik04L2MQ3JIlfJ TuSA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=kXjORx3k; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=jqqEQUm8; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a197si4887158oii.199.2019.12.05.01.38.44; Thu, 05 Dec 2019 01:38:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=kXjORx3k; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=jqqEQUm8; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729394AbfLEJim (ORCPT + 27 others); Thu, 5 Dec 2019 04:38:42 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:16036 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729280AbfLEJiT (ORCPT ); Thu, 5 Dec 2019 04:38: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 xB59avmB023516; Thu, 5 Dec 2019 01:38:13 -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=7QCxQf32pX5GTSWyiY2ZvY/59cTZ0aadsulEaPBkvR8=; b=kXjORx3kQDN2gqTrrhiJjXH+bjQlf81rbkv1LaR4kU6dQ8noJqrIutrouX66jhJI9u7Y W2eJELkedX1ZQ1DCd1yHw1lzZYKDBBXo7oOPYwmg1BSmXCKAdBEUX8pNgev7BRA5bmVV CzIr2dwPELG6UmmE/kA25YFipan6mn7VG38QXIsXk/8mkK5V9ogbGnvqM/vRRvWsdLwZ oy6bHj/GXO2eVe2ERc+Ov72BOFcaIGY2uXYWTu0Yofgco0vDTQ8HyoR+Rj1gi/tHFX4R OzJ4VOOrQQtLGqSAhfPbxYPL4pEcv3Db3vcP2oGivQsHxg/t2H0499cKrM/BsdyiLKiB ug== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2wnvgvrd0a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 05 Dec 2019 01:38:12 -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; Thu, 5 Dec 2019 01:38:11 -0800 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.55) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Thu, 5 Dec 2019 01:38:11 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JTiZfwMEF12prDRJrecbeOEdISgzR0e5sPglUcG5GICbifXO+5R3/M6qG843Wgho3j6M1vdjd3BII0UdJSbCo8UnefNr1dr2HqhGt/2jf5+qkUKahrCQ1DsVN0GxU08KYMtcyBfiK+xaPSTI1kLR8WwGL+Z3cg1LbQs8i/+TuoWZx8MBC5a9lfBsUUHQDe5hV46Eu5LSdd0KiD7IG7oGr7Tso3uFRxSshBrcko05BqbFpJRP+FoLIuWlx+yM9LNi21z5zI2rY+zkvhdLfZG4YCqzX4SXxPUCP5QiN2S2a6+4ib6BQo8TVvd/t2qGTvJJLHhRlanQE74JtvJExanCUA== 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=7QCxQf32pX5GTSWyiY2ZvY/59cTZ0aadsulEaPBkvR8=; b=OHPp+dOz7gcE80asxd5NGPHjhacobbs93KCaxxYHge2WnCiLceq8YhAb2s8FacQn51bKlBUsXG3uxIkuElzz3s8Qjw4rGLLfqJHtDjGGY3MZf9+p0UCPqDPLH4MwSDpttzfKrBQtbSOeS27FpyQGfIfywbn5BzFo6le2AJN65sPF08JXpw8cwOVGKg0+hpGkCFKw5fJg972gx+2n4Q1GDhFYeGhbhQkbef/K+000DoEeeUael26TJIEysuSKVYXSq/UZTJO2mHKrAZS0ETqLsYKUG5UhBNv4nHHkvsvFWyTDiIhK0XX01f9qdKs9YhKnqkyksn3OeX3qHQEZpiXQvw== 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=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7QCxQf32pX5GTSWyiY2ZvY/59cTZ0aadsulEaPBkvR8=; b=jqqEQUm8ZwBskL3yoxPRZ5stLVo7UmW/DL6oSUi9vB3WQzZgZz4JGxYkhAIVZkcw13wrHm6zacn3Y0olMOJqMwW1H+p+oF4zulqL138nu4JrYELKaq/itZD6zmH9e6YUSmEuJXb5VUtlgyRS70LsYQr+P0N2WzmmRD629D6Z0YY= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB2367.namprd18.prod.outlook.com (20.179.80.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.21; Thu, 5 Dec 2019 09:38:10 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::657c:6c81:859d:106]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::657c:6c81:859d:106%7]) with mapi id 15.20.2516.014; Thu, 5 Dec 2019 09:38:10 +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 07/10] EDAC/mc: Remove enable_per_layer_report function arguments Thread-Topic: [PATCH v2 07/10] EDAC/mc: Remove enable_per_layer_report function arguments Thread-Index: AQHVq0+0Niy4TymAK06bA7H1VLoYzw== Date: Thu, 5 Dec 2019 09:38:10 +0000 Message-ID: <20191205093739.4040-8-rrichter@marvell.com> References: <20191205093739.4040-1-rrichter@marvell.com> In-Reply-To: <20191205093739.4040-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0170.eurprd05.prod.outlook.com (2603:10a6:3:f8::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: 6ad335bf-fda5-4cf9-33ed-08d77966d752 x-ms-traffictypediagnostic: MN2PR18MB2367: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1728; x-forefront-prvs: 02426D11FE x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(376002)(136003)(346002)(366004)(396003)(189003)(199004)(81166006)(14454004)(36756003)(6512007)(316002)(478600001)(54906003)(5660300002)(110136005)(186003)(8936002)(50226002)(6486002)(26005)(99286004)(66556008)(66476007)(81156014)(71190400001)(86362001)(66946007)(66446008)(64756008)(25786009)(8676002)(2906002)(71200400001)(6506007)(4326008)(2616005)(11346002)(102836004)(305945005)(1076003)(76176011)(52116002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2367; H:MN2PR18MB3408.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: GJaneQdJ+ye+CQkQWSBc52Ji3wRI+bSoMSHUTt0E5SAR2hDjKcg9ufawdUgzSZHQ24Y2khwCeWNTKLA5AxUO9bljq58Q/27Hxw+t9l9dZrxK0aj+kkQG9nFhF67OB24nS4zaWVPcHGBAwPyzRgFzQrVP6pZDtsei/iBcSAij1mS2tHePqaAW3cRiojjR9DhJt2PYgxWmo8OplDuexnj64iPTzJfDkeeMqisL3W7yzprEPkPHJ7O722l9R9IilfrMuvjP3favu9HR37WZ8B5oYCVJU4lHMKwsb0RM3//7P6OGH0A93HPVv1wpakBplv75WYbINRfqFqGPslGsV2Alz82eWyCGVOQpj0fiaqFI3KXS9Fhyv6G7GxTXmI01b6FjGMVfTvysPozms5CHHFC2PlbzdCOURHXoUXrYqc2vi1iCwP77pXkTO6tQSyDFKSyW MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 6ad335bf-fda5-4cf9-33ed-08d77966d752 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Dec 2019 09:38:10.5246 (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: dKjhof8Mp+YM9FFxIV3FLGRq7gFETmRpepNungfAp7I5hZH9/38vz26PRqYPk8q3MP5UQWB09ph8DvtpLR+7rQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2367 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95, 18.0.572 definitions=2019-12-05_01:2019-12-04, 2019-12-05 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Many functions carry the enable_per_layer_report argument. This is a bool value indicating the error information contains some location data where the error occurred. This can easily being determined by checking the pos[] array for values. Negative values indicate there is no location available. So if the top layer is negative, the error location is unknown. Just check if the top layer is negative and remove enable_per_layer_report as function argument and also from struct edac_raw_error_desc. Signed-off-by: Robert Richter --- drivers/edac/edac_mc.c | 42 +++++++++++++++++++--------------------- drivers/edac/ghes_edac.c | 5 +---- include/linux/edac.h | 3 --- 3 files changed, 21 insertions(+), 29 deletions(-) -- 2.20.1 diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index 2b12320ce2f1..38a9a68eebfe 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -946,7 +946,6 @@ 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) { @@ -954,7 +953,7 @@ static void edac_inc_ce_error(struct mem_ctl_info *mci, mci->ce_mc += count; - if (!enable_per_layer_report) { + if (pos[0] < 0) { mci->ce_noinfo_count += count; return; } @@ -971,7 +970,6 @@ static void edac_inc_ce_error(struct mem_ctl_info *mci, } 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) { @@ -979,7 +977,7 @@ static void edac_inc_ue_error(struct mem_ctl_info *mci, mci->ue_mc += count; - if (!enable_per_layer_report) { + if (pos[0] < 0) { mci->ue_noinfo_count += count; return; } @@ -1003,7 +1001,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) @@ -1026,7 +1023,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) { /* @@ -1056,8 +1053,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 = ""; @@ -1086,7 +1082,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); } static void edac_inc_csrow(struct edac_raw_error_desc *e, int row, int chan) @@ -1136,16 +1132,16 @@ void edac_raw_mc_handle_error(struct edac_raw_error_desc *e) "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); } @@ -1170,6 +1166,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); @@ -1188,9 +1185,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 per-layer error counters will be + * incremented. */ for (i = 0; i < mci->n_layers; i++) { if (pos[i] >= (int)mci->layers[i].size) { @@ -1208,7 +1205,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; } /* @@ -1238,10 +1235,11 @@ 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 (!dimm->nr_pages) continue; @@ -1277,7 +1275,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 if (!*e->label) strcpy(e->label, "unknown memory"); diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c index bef8a428c429..cb3dab56a875 100644 --- a/drivers/edac/ghes_edac.c +++ b/drivers/edac/ghes_edac.c @@ -355,11 +355,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 6703eb492cd2..815f246e0abd 100644 --- a/include/linux/edac.h +++ b/include/linux/edac.h @@ -454,8 +454,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]; @@ -472,7 +470,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 From patchwork Thu Dec 5 09:38:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 180868 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1728070ile; Thu, 5 Dec 2019 01:38:25 -0800 (PST) X-Google-Smtp-Source: APXvYqzs0OIcn84MRUMiOdcoULY/vNn4XG1F8xkLS7dia7h66dEt8ug44Qo0a70SoyIF1hLZ12Er X-Received: by 2002:aca:4c87:: with SMTP id z129mr6612124oia.72.1575538705152; Thu, 05 Dec 2019 01:38:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1575538705; cv=pass; d=google.com; s=arc-20160816; b=D41YZx6gTjyueoNrjajlFmkEWDw2PelKXXoQ9ExvQwrbWn4ItIASnPCC+Ech8FjxOR NgQg04G54x6bXHYAiIsiUloz7FW3XDWAGc6Wbk/wUAD8z7eMIdH2sKIEixVflp37Vgau SugEgkgFGcC3dSzmlOPr6Wsl4XBs/5lQD2NUHLv66+VMer0sFGI59A+d5jXCjg7W4seW d3oQUaeNwTA/6JLvec6hkc38mPN4FgJVTC15jTQRJr1V7qb2LkICJlWEs1JkSBYgEChr qbiXD+ORKEinOSiepqMm/kXLqXkWZXvXncxSXts1KYWkjk4UTE/0yBltXn7jk6fwg+Os rgnQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature :dkim-signature; bh=g1gwTQlHy1wvorIqQq7F4OyXokTTiOv4CbtXHcDzafA=; b=vcLGwHIsjsNkGrH2nLpuDuDvk4bIDrgkGq3n6W+HmyJna/PwYj4iusi56jAp6ahI7n KZ3VaXAPHgHjzY0HfinjIc3Osv9QhEPjOWOCMXRi45O/6HJTSaVl1B1F3ZRI6Xj5Dqwx ycewGPTSr91T45u37WxJUw6y5jQAXCFnovlp+vBm5b9GgVkS4TZrlAQfj6K+bWMKIf5/ Szcrvov/68OUWKzBfLD0+F9FBaBl/TkKAT/WQrzHcXpq3Z19vUrWla3El/sGPhb2Ixyd l6Hhdc4Ox5XNB0oom/RDG5rp8ganB6Ca7Xhdf4GuJHhoteeBU8RqCFwrFFCVf3eVTDXY ugNA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=CQgLC1Z1; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=fCxh3ASJ; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u12si553455otq.51.2019.12.05.01.38.24; Thu, 05 Dec 2019 01:38:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=CQgLC1Z1; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=fCxh3ASJ; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729324AbfLEJiY (ORCPT + 27 others); Thu, 5 Dec 2019 04:38:24 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:28908 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729215AbfLEJiU (ORCPT ); Thu, 5 Dec 2019 04:38:20 -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 xB59bKkX023619; Thu, 5 Dec 2019 01:38:14 -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=g1gwTQlHy1wvorIqQq7F4OyXokTTiOv4CbtXHcDzafA=; b=CQgLC1Z1oQlVIlJ01pxwoy828QyKLYKAylkHYgTfoXmLPVS8+/61Izllg/0W6X5lfWw6 fF5b4KOM2IaSmP0QSp92RbBnds2FxHdPRoaKUcHmpTaSbfiYPAWiUj9rryRLoBdHxOPr IYRRgy/1k4rEV7AYnLYbgWhYTg8PHhoSwGTGLoHHLHZFuxrDLeL0VrkOPo4IkYQFHSkA RINrCdX9oIu1b+CUf7f0KkL7MQoiBJcXc5xUN2EI+hR6soDKFlJ2CD9d4MdfK4bNawyb IZNg8ZgzERFPiaik3WLS+QvV4l/98/spvh+iIyrLKWhGnyrV+qmX7gjn2Zp6oypWXUHn Hw== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2wnvgvrd0d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 05 Dec 2019 01:38:14 -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; Thu, 5 Dec 2019 01:38:13 -0800 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.55) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Thu, 5 Dec 2019 01:38:13 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=grE8DqRqU3Kjt5UjHtMoUMGVlS+7Ve20YONTN35vP4KyEgw4EnaL1c2V2kS5vKgKJLoPurD5rODb7ZApGzYynDZLi/PrzTFIh7Zx9F8GCwr6Z0b2BetowOunrBvK+15CGNvlQhQLJ00uXvMAAABiG4WIMKgcnOATg0dL/p967+rZYwl0XoctglosaeU8zcmU+8ds+8K+KFuezbdgwQSevU1zUWICmJ1uCLKzUb6RLwes3bc3zap8+Lypb1bCL3lShHmNNiFomi+2OrDwfB//FgtPzs0xrSPY4m9QDKXc/OBhz5yPwuAIpfd3OQgnP++zQyd5E1LmXGhvOWvsksCgOA== 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=g1gwTQlHy1wvorIqQq7F4OyXokTTiOv4CbtXHcDzafA=; b=jteOIAGzjf75TM11eMQ0XpvQIKJPthlzrEE8/H8+w0fd3FQ09bcHUD+60Ks+AZ3ITKkybHoBXK0jQvp6c8kNxo3o7ALmYURcrrVdG0W0lAQAO1Sso3wwgtuEvNaIh9X9235IXRPoejGVzo67ozfDNmBxESx5mPoEUiVPDsfsGcHITH/pXl8DFyEeNUlBKpFwK2zYWw9vIY+NN1o1jZvIjezmq7x4doFftwO+M0N4G03C8RYRT+kkubFtkZc4RMYC3k3MsrkfRU7PgXFfQ4tXuc8AptA45vj9t18WnVtfx01F1Gb96/kUu+DCv1mOB4umJCsGi24/Nmj5rvHQbpn47g== 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=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=g1gwTQlHy1wvorIqQq7F4OyXokTTiOv4CbtXHcDzafA=; b=fCxh3ASJggNODLU3qmWtSyidtdkQY4hRRI88Skrfw1pltOAA8PPh91D+VN/xkqya1P+5IeG8BbbdKX3pNK8pTQFtKybZR7P/VqYRgorbdLW7U1gqEuC7QEj3s2hS6RlMqYoxEeQHrVmhlBXoN5OHHUAxmky+LKY+t/8uTfARnjI= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB2367.namprd18.prod.outlook.com (20.179.80.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.21; Thu, 5 Dec 2019 09:38:12 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::657c:6c81:859d:106]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::657c:6c81:859d:106%7]) with mapi id 15.20.2516.014; Thu, 5 Dec 2019 09:38:12 +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 08/10] EDAC/mc: Pass the error descriptor to error reporting functions Thread-Topic: [PATCH v2 08/10] EDAC/mc: Pass the error descriptor to error reporting functions Thread-Index: AQHVq0+2OTakJ7xVJkC7+Ue06c1H3A== Date: Thu, 5 Dec 2019 09:38:12 +0000 Message-ID: <20191205093739.4040-9-rrichter@marvell.com> References: <20191205093739.4040-1-rrichter@marvell.com> In-Reply-To: <20191205093739.4040-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0170.eurprd05.prod.outlook.com (2603:10a6:3:f8::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: beb199b4-2e73-41ac-756c-08d77966d880 x-ms-traffictypediagnostic: MN2PR18MB2367: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:439; x-forefront-prvs: 02426D11FE x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(376002)(136003)(346002)(366004)(396003)(189003)(199004)(81166006)(14444005)(14454004)(36756003)(6512007)(316002)(478600001)(54906003)(5660300002)(110136005)(186003)(8936002)(50226002)(6486002)(26005)(99286004)(66556008)(66476007)(81156014)(71190400001)(86362001)(66946007)(66446008)(64756008)(25786009)(8676002)(2906002)(71200400001)(6506007)(4326008)(2616005)(11346002)(102836004)(305945005)(1076003)(76176011)(52116002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2367; H:MN2PR18MB3408.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: 8/M1II7M38QDMYpxfzJRyXY7NePHULMpYSIr9J8QS7cD8vE1Fb+swwd5su0JqGmxGej+R9Baa8i0a97vd0kZO4Wa4iBNa2YllcaN0A/BogoV1lbSlBdD5ca4TMzzScQIL0yNQ8wtWCvefuM3K5fr8PvS62Mt/S3dX3kP0Pj9hXSxP87yMwCyrE+jM/krGSNuN8Xf0kMyuob8mvYt5R40rd9KZm107lSmRH0lkxBKYfir2dVCwoLgLLzQ0VxJHupDk6bmiVfWR8MrWVX6jHgPLxtGhSc/pbb0CtbsYxcpq2P0+cKnEgJtRwg5trwPg4DFu71gAXRnjQfnKA3J0JR3WQcUJEK+5BkRkBM78WuyZ0AVqWB3qI4EM7AMvGxhciaD+LoGU9DsCb0+WIVgSNixxopoQtxSRnjAE6X4OchOwi9dJ4Xvf62F12OS22EFkb+9 MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: beb199b4-2e73-41ac-756c-08d77966d880 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Dec 2019 09:38:12.4215 (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: J4okMD5BVnaqBXz7RDBHjrr9WrPsx5TLnrwOfgjsQAQjhXrZOjyyA2Bmjzu2Rfji70cXflc3LfXuZYX65lC6RA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2367 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95, 18.0.572 definitions=2019-12-05_01:2019-12-04, 2019-12-05 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Most arguments of error reporting functions are already stored in struct edac_raw_error_desc error descriptor. Pass the error descriptor to the functions and reduce the functions' arg list. Signed-off-by: Robert Richter --- drivers/edac/edac_mc.c | 100 +++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 58 deletions(-) -- 2.20.1 diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index 38a9a68eebfe..545d25c8654e 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -945,16 +945,16 @@ 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], - const u16 count) +static void edac_inc_ce_error(struct edac_raw_error_desc *e) { + struct mem_ctl_info *mci = error_desc_to_mci(e); + int pos[EDAC_MAX_LAYERS] = { e->top_layer, e->mid_layer, e->low_layer }; int i, index = 0; - mci->ce_mc += count; + mci->ce_mc += e->error_count; if (pos[0] < 0) { - mci->ce_noinfo_count += count; + mci->ce_noinfo_count += e->error_count; return; } @@ -962,23 +962,23 @@ static void edac_inc_ce_error(struct mem_ctl_info *mci, if (pos[i] < 0) break; index += pos[i]; - mci->ce_per_layer[i][index] += count; + mci->ce_per_layer[i][index] += e->error_count; if (i < mci->n_layers - 1) index *= mci->layers[i + 1].size; } } -static void edac_inc_ue_error(struct mem_ctl_info *mci, - const int pos[EDAC_MAX_LAYERS], - const u16 count) +static void edac_inc_ue_error(struct edac_raw_error_desc *e) { + struct mem_ctl_info *mci = error_desc_to_mci(e); + int pos[EDAC_MAX_LAYERS] = { e->top_layer, e->mid_layer, e->low_layer }; int i, index = 0; - mci->ue_mc += count; + mci->ue_mc += e->error_count; if (pos[0] < 0) { - mci->ue_noinfo_count += count; + mci->ue_noinfo_count += e->error_count; return; } @@ -986,44 +986,37 @@ static void edac_inc_ue_error(struct mem_ctl_info *mci, if (pos[i] < 0) break; index += pos[i]; - mci->ue_per_layer[i][index] += count; + mci->ue_per_layer[i][index] += e->error_count; if (i < mci->n_layers - 1) index *= mci->layers[i + 1].size; } } -static void edac_ce_error(struct mem_ctl_info *mci, - const u16 error_count, - const int pos[EDAC_MAX_LAYERS], - const char *msg, - const char *location, - const char *label, - const char *detail, - const char *other_detail, - const unsigned long page_frame_number, - const unsigned long offset_in_page, - long grain) +static void edac_ce_error(struct edac_raw_error_desc *e, + const char *detail) { + struct mem_ctl_info *mci = error_desc_to_mci(e); unsigned long remapped_page; char *msg_aux = ""; - if (*msg) + if (*e->msg) msg_aux = " "; if (edac_mc_get_log_ce()) { - if (other_detail && *other_detail) + if (e->other_detail && *e->other_detail) edac_mc_printk(mci, KERN_WARNING, "%d CE %s%son %s (%s %s - %s)\n", - error_count, msg, msg_aux, label, - location, detail, other_detail); + e->error_count, e->msg, msg_aux, e->label, + e->location, detail, e->other_detail); else edac_mc_printk(mci, KERN_WARNING, "%d CE %s%son %s (%s %s)\n", - error_count, msg, msg_aux, label, - location, detail); + e->error_count, e->msg, msg_aux, e->label, + e->location, detail); } - edac_inc_ce_error(mci, pos, error_count); + + edac_inc_ce_error(e); if (mci->scrub_mode == SCRUB_SW_SRC) { /* @@ -1038,51 +1031,46 @@ static void edac_ce_error(struct mem_ctl_info *mci, * be scrubbed. */ remapped_page = mci->ctl_page_to_phys ? - mci->ctl_page_to_phys(mci, page_frame_number) : - page_frame_number; + mci->ctl_page_to_phys(mci, e->page_frame_number) : + e->page_frame_number; - edac_mc_scrub_block(remapped_page, - offset_in_page, grain); + edac_mc_scrub_block(remapped_page, e->offset_in_page, e->grain); } } -static void edac_ue_error(struct mem_ctl_info *mci, - const u16 error_count, - const int pos[EDAC_MAX_LAYERS], - const char *msg, - const char *location, - const char *label, - const char *detail, - const char *other_detail) +static void edac_ue_error(struct edac_raw_error_desc *e, + const char *detail) { + struct mem_ctl_info *mci = error_desc_to_mci(e); char *msg_aux = ""; - if (*msg) + if (*e->msg) msg_aux = " "; if (edac_mc_get_log_ue()) { - if (other_detail && *other_detail) + if (e->other_detail && *e->other_detail) edac_mc_printk(mci, KERN_WARNING, "%d UE %s%son %s (%s %s - %s)\n", - error_count, msg, msg_aux, label, - location, detail, other_detail); + e->error_count, e->msg, msg_aux, e->label, + e->location, detail, e->other_detail); else edac_mc_printk(mci, KERN_WARNING, "%d UE %s%son %s (%s %s)\n", - error_count, msg, msg_aux, label, - location, detail); + e->error_count, e->msg, msg_aux, e->label, + e->location, detail); } if (edac_mc_get_panic_on_ue()) { - if (other_detail && *other_detail) + if (e->other_detail && *e->other_detail) panic("UE %s%son %s (%s%s - %s)\n", - msg, msg_aux, label, location, detail, other_detail); + e->msg, msg_aux, e->label, e->location, detail, + e->other_detail); else panic("UE %s%son %s (%s%s)\n", - msg, msg_aux, label, location, detail); + e->msg, msg_aux, e->label, e->location, detail); } - edac_inc_ue_error(mci, pos, error_count); + edac_inc_ue_error(e); } static void edac_inc_csrow(struct edac_raw_error_desc *e, int row, int chan) @@ -1109,7 +1097,6 @@ void edac_raw_mc_handle_error(struct edac_raw_error_desc *e) { struct mem_ctl_info *mci = error_desc_to_mci(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. */ @@ -1132,16 +1119,13 @@ void edac_raw_mc_handle_error(struct edac_raw_error_desc *e) "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->page_frame_number, e->offset_in_page, e->grain); + edac_ce_error(e, detail); } 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); + edac_ue_error(e, detail); } From patchwork Thu Dec 5 09:38: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: 180869 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1728142ile; Thu, 5 Dec 2019 01:38:29 -0800 (PST) X-Google-Smtp-Source: APXvYqxWgQUs+1YZw2CeIvtAln4ZOT4dqHos+BqOmfuc+4NuLr+nclTdsn8wgCnXMPFwQUmBWFv/ X-Received: by 2002:aca:39d4:: with SMTP id g203mr6277129oia.78.1575538709072; Thu, 05 Dec 2019 01:38:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1575538709; cv=pass; d=google.com; s=arc-20160816; b=k30F8Tt+dN0ruT+XPj+zt7/69J29pULRhgW9Ga/h7yGnvj9ztjjjqcugoAa1KDN7wx pGfvHXvrgaufsCyfCIv3H0Vsl0UWOt2lwaMb/lWhwJ3R08VP0V/1iecvD73wa7TWcAtH BEhnJFF3uUUmDGuTaFzBbRmncdLCagR9xGaPyP6WYCnHW+9VuIZaGpxe0UorW5rnI2Kr uCZ1D1yPCDWqzTOV9I5pd/NaObMdmx5eMNazfq2EyzWeBUBMEY1GfrYZg6Xyg2retAVG ZBqjBMT1xjxasyPkRg55pMy7qFg9iKWOwHpueHbrCuLMcdR5qW7iMx7MgeVZVefDFXgU 5jSg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature :dkim-signature; bh=svAMmrkoHYpj9/ztDSBry02MrTezUAIKGGlTYdAyMsU=; b=1J129G/ULN6LNLFKv13WICQw1nUTp9KqXn0dXC/JedqeofsWB5CNr79CSmCUriqnqX 95IPtEA0iJDRBnt37rnP1V4FWt/SgYHOQ8+nORHCPH+W0fjijXB+qbZ1EywK5fkpHB1m hUmuIxnxGxYuI7KN/1E6JQMRuWV9BF1KeKIcLiRrPAE6dKneMLxwc9urhe1NF8adPkQa yfFQTi4xMQp4PO2ZseJmIaeaQc8/LR30HLm0v9XxOeqy6SJeEgDmXJVtd4dZgpgj8B1p gL8VeyIJ7gkNdnyrQQvM8pRegep1tM64I4arzeDNRvU518A9TEikXTLG8sq9cU7r0wpO 9STg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=XBlrAiCJ; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=QTvvfs9q; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u12si553455otq.51.2019.12.05.01.38.28; Thu, 05 Dec 2019 01:38:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=XBlrAiCJ; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=QTvvfs9q; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729352AbfLEJi1 (ORCPT + 27 others); Thu, 5 Dec 2019 04:38:27 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:26934 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729215AbfLEJi0 (ORCPT ); Thu, 5 Dec 2019 04:38:26 -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 xB59bCNV023610; Thu, 5 Dec 2019 01:38: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=svAMmrkoHYpj9/ztDSBry02MrTezUAIKGGlTYdAyMsU=; b=XBlrAiCJJAOMfN0+bbF8ROOgye+WIJze4H0NBmIIvEI+jxyHj0I+pSfFlgyoCCGBmRAU 1HRGgu8v16ravns/uE/PI3VV9o0rskJ99Mr2Q5etc90icjca7D4rYxnQlnE2VTTnfwGT zbbYo4dWRYd2bqDt5Wc94Y2IbH/Olnp03HUni53/Hgdq8YnMdVRvzK+OMt3rV+hsQD0q 4JWrlsh6h9qE9Xb91Xg1Tut1NIBo6pT11DD1dASQpkZct+jgiOj36jLl3O77ySgdQSFN CcnYT/V71uwWQwv3Oj939Rme9bH31HE3895QNDYXhphs2mnyMIoClDY4pbjxnvhyRAh1 2g== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2wnvgvrd0n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 05 Dec 2019 01:38:18 -0800 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 5 Dec 2019 01:38:17 -0800 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.50) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Thu, 5 Dec 2019 01:38:17 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H9kJd5riS3jFrrnxXblyt9fZdi2xMGu3q8WIzSOxjwFzHHhfClrWehMy2mJQdQqeOiJP1EhaXjNQ6g2hzb/DShumorcnLyIHVEoeep58Q1SQZLPali2aJeNTyYxORggA9t1iqfWtlR1d78UyxbBoKLUgN03nyc15Mi4U1azhydMMUEqOu5/Nrer86TlKyS5OvrBaXXHY8MNa/VT9qhneggccdwdaXj+UC7UpF2/kuQeTwqy/JRW5Zk6qEKhKBQtBQ6z0HkKzDbtEjfVHi1C0tle5ejzVvwzg8i6p55c50xErwH+xkH8wrYeXgBKR8CzNUzhiJfgaABkcnIhtL/qKJQ== 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=svAMmrkoHYpj9/ztDSBry02MrTezUAIKGGlTYdAyMsU=; b=X+U0h7/9n0ir/PU+KeOS1zgEdSXiH+Z+/1Tu+naya+gczwQb6LaIRYqMvpe3fAznTXZGTD6IBsyb01kEfwu6yca2UeBb4cQsAkVIhGsJmnuXuQuFZPWo8o99FbihvlnWyFDZYm4ZAb8iHtrFZLbUCSGyLQiVXtVpy7tiT23DnL/MurKcD0KFc7zLK/n+8B5yn2V+i98fkIqtOi+DmpuaeZ8DobY5jKIHZMD+XxjykMF0/tiQVEu6Raa3r98OU44HpSbxrxf+e4nbrSmEBl508tTypz8e1gi1k+Drs1vODv+fbhTXvTDxGFTiisBkxximUs4RoGRg/ESzSDt+6+TyQA== 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=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=svAMmrkoHYpj9/ztDSBry02MrTezUAIKGGlTYdAyMsU=; b=QTvvfs9q0ITFbSXkfozleqjqba1NSNj8PZ2P1/wwHB26MiDuQMNdAzh6vZqKSEn/HrPx43zHWnOldeKJI3cmI3O0JvU0WWe/E/gi3za4P6haJwADXBjb7HgROj2G3ZIpm/Eae3ensXskSCbbg+zQ3wuXBcAsx2S2Pv+zZ2oB5gU= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB2367.namprd18.prod.outlook.com (20.179.80.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.21; Thu, 5 Dec 2019 09:38:14 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::657c:6c81:859d:106]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::657c:6c81:859d:106%7]) with mapi id 15.20.2516.014; Thu, 5 Dec 2019 09:38: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" Subject: [PATCH v2 09/10] EDAC/mc: Remove detail[] string and cleanup error string generation Thread-Topic: [PATCH v2 09/10] EDAC/mc: Remove detail[] string and cleanup error string generation Thread-Index: AQHVq0+3Tp0059QzO0qu+SjsVfgAlA== Date: Thu, 5 Dec 2019 09:38:14 +0000 Message-ID: <20191205093739.4040-10-rrichter@marvell.com> References: <20191205093739.4040-1-rrichter@marvell.com> In-Reply-To: <20191205093739.4040-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0170.eurprd05.prod.outlook.com (2603:10a6:3:f8::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: d8c8da47-77c8-4c3a-dea0-08d77966d9a5 x-ms-traffictypediagnostic: MN2PR18MB2367: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2331; x-forefront-prvs: 02426D11FE x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(376002)(136003)(346002)(366004)(396003)(189003)(199004)(81166006)(14444005)(14454004)(36756003)(6512007)(316002)(478600001)(54906003)(5660300002)(110136005)(186003)(8936002)(50226002)(6486002)(26005)(99286004)(66556008)(66476007)(81156014)(71190400001)(86362001)(66946007)(66446008)(64756008)(25786009)(8676002)(2906002)(71200400001)(6506007)(4326008)(2616005)(11346002)(102836004)(305945005)(1076003)(76176011)(52116002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2367; H:MN2PR18MB3408.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: 7FXLKQE11Ni0fY8gGTxO2w8qloysu4CVgT50/dRYVdxydIz3cPMQBO4ziRhWzXQbpC2FtH2z35DXjMAL+krk1mX7gsHsX5j84Cz6oIcBVfgbwhji08PhOWw/HFx+GTuEGC85h+4frh9QQsNaXVyZpUPqnDa9F3psbd/aICk3P46jsZlXgwqI2a/Dif/nDLt0/FFa8G8zZy7o4FCJPsIvMzABtKsHMypQNdVYUabzycj8CTRXQXgjN6LzhppDLjZU4a+oaV3khzalkN/fPVAjOkxOXVLJNrVlDhtVfm9tb9g/eLVz3hZ/5jlJGO1tMB3TuW+3bHsJbytdFIutz78NZz1O05iqp7f86D0ktGRWqGAd2pw9yyYhizRKgYojqFwvA+BNijI3VCUJqn2zsAA9EhOWvDniyQAtTimd5eNmbKsuX7P08FftPVT6157VnjIv MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: d8c8da47-77c8-4c3a-dea0-08d77966d9a5 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Dec 2019 09:38:14.3374 (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: racIcUNVEK/4hAAR7HaOUfYRF3KIXK6ZtcPE4Wp8KGBthhOtJhIY23AFr/HTC+4FLv+jYdgVHzPL+TTWx15Qyg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2367 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95, 18.0.572 definitions=2019-12-05_01:2019-12-04, 2019-12-05 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The error descriptor is passed to the error reporting functions, so the error details can be directly generated there. Move string generation from edac_raw_mc_handle_error() to edac_ce_error() and edac_ue_error(). The intermediate detail[] string can be removed then. Also, cleanup the string generation by switching to a single variant only using the ternary operator. Signed-off-by: Robert Richter --- drivers/edac/edac_mc.c | 83 +++++++++++++----------------------------- 1 file changed, 25 insertions(+), 58 deletions(-) -- 2.20.1 diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index 545d25c8654e..5ea834fceb50 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -993,27 +993,18 @@ static void edac_inc_ue_error(struct edac_raw_error_desc *e) } } -static void edac_ce_error(struct edac_raw_error_desc *e, - const char *detail) +static void edac_ce_error(struct edac_raw_error_desc *e) { struct mem_ctl_info *mci = error_desc_to_mci(e); unsigned long remapped_page; - char *msg_aux = ""; - - if (*e->msg) - msg_aux = " "; if (edac_mc_get_log_ce()) { - if (e->other_detail && *e->other_detail) - edac_mc_printk(mci, KERN_WARNING, - "%d CE %s%son %s (%s %s - %s)\n", - e->error_count, e->msg, msg_aux, e->label, - e->location, detail, e->other_detail); - else - edac_mc_printk(mci, KERN_WARNING, - "%d CE %s%son %s (%s %s)\n", - e->error_count, e->msg, msg_aux, e->label, - e->location, detail); + edac_mc_printk(mci, KERN_WARNING, + "%d CE %s%son %s (%s page:0x%lx offset:0x%lx grain:%ld syndrome:0x%lx%s%s)\n", + e->error_count, e->msg, *e->msg ? " " : "", e->label, + e->location, e->page_frame_number, e->offset_in_page, + e->grain, e->syndrome, *e->other_detail ? " - " : "", + e->other_detail); } edac_inc_ce_error(e); @@ -1038,36 +1029,24 @@ static void edac_ce_error(struct edac_raw_error_desc *e, } } -static void edac_ue_error(struct edac_raw_error_desc *e, - const char *detail) +static void edac_ue_error(struct edac_raw_error_desc *e) { struct mem_ctl_info *mci = error_desc_to_mci(e); - char *msg_aux = ""; - - if (*e->msg) - msg_aux = " "; if (edac_mc_get_log_ue()) { - if (e->other_detail && *e->other_detail) - edac_mc_printk(mci, KERN_WARNING, - "%d UE %s%son %s (%s %s - %s)\n", - e->error_count, e->msg, msg_aux, e->label, - e->location, detail, e->other_detail); - else - edac_mc_printk(mci, KERN_WARNING, - "%d UE %s%son %s (%s %s)\n", - e->error_count, e->msg, msg_aux, e->label, - e->location, detail); + edac_mc_printk(mci, KERN_WARNING, + "%d UE %s%son %s (%s page:0x%lx offset:0x%lx grain:%ld%s%s)\n", + e->error_count, e->msg, *e->msg ? " " : "", e->label, + e->location, e->page_frame_number, e->offset_in_page, + e->grain, *e->other_detail ? " - " : "", + e->other_detail); } if (edac_mc_get_panic_on_ue()) { - if (e->other_detail && *e->other_detail) - panic("UE %s%son %s (%s%s - %s)\n", - e->msg, msg_aux, e->label, e->location, detail, - e->other_detail); - else - panic("UE %s%son %s (%s%s)\n", - e->msg, msg_aux, e->label, e->location, detail); + panic("UE %s%son %s (%s page:0x%lx offset:0x%lx grain:%ld%s%s)\n", + e->msg, *e->msg ? " " : "", e->label, e->location, + e->page_frame_number, e->offset_in_page, e->grain, + *e->other_detail ? " - " : "", e->other_detail); } edac_inc_ue_error(e); @@ -1096,7 +1075,6 @@ static void edac_inc_csrow(struct edac_raw_error_desc *e, int row, int chan) void edac_raw_mc_handle_error(struct edac_raw_error_desc *e) { struct mem_ctl_info *mci = error_desc_to_mci(e); - char detail[80]; u8 grain_bits; /* Sanity-check driver-supplied grain value. */ @@ -1113,22 +1091,10 @@ void edac_raw_mc_handle_error(struct edac_raw_error_desc *e) (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 (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, - e->grain, e->syndrome); - edac_ce_error(e, detail); - } 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(e, detail); - } - - + if (e->type == HW_EVENT_ERR_CORRECTED) + edac_ce_error(e); + else + edac_ue_error(e); } EXPORT_SYMBOL_GPL(edac_raw_mc_handle_error); @@ -1164,8 +1130,9 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, e->page_frame_number = page_frame_number; e->offset_in_page = offset_in_page; e->syndrome = syndrome; - e->msg = msg; - e->other_detail = other_detail; + /* need valid strings here for both: */ + e->msg = msg ? msg : ""; + e->other_detail = other_detail ? other_detail : ""; /* * Check if the event report is consistent and if the memory From patchwork Thu Dec 5 09:38: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: 180870 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1728260ile; Thu, 5 Dec 2019 01:38:37 -0800 (PST) X-Google-Smtp-Source: APXvYqzWjXEn8svDQf7nl7/Fp9bm3dQWcs15mhUhsd/W7nuM4wV5h5BrrR/Zv8hORJw9z2W3I4MT X-Received: by 2002:a05:6830:10d5:: with SMTP id z21mr6095946oto.30.1575538717274; Thu, 05 Dec 2019 01:38:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1575538717; cv=pass; d=google.com; s=arc-20160816; b=i7aNn7NpbrXJlmiPZDnYLJZ/lVCpIo8ELfV8w7pkkiAAnyrVKFzsE1PIIubJv9g+nk vaac8Hn2w0KN/JeNXQgt81aR90iuK3tFC3I658GVthMBDh0S218s+VO/j/iqBft9ANet EK8wMKTr1KJ//jSWbFJLDD5rY7A403P1s01L+NW4YCOpjmlQAFdeiNdYLQ6wQPbmf68K B+pGsSP19z/S8HuH9CKh4KAxGbNlqZLom1YJMCIZ6BO8VsRmbWbtu+SKepGhZWAuiWx8 BP7QV1yHmtaA+lhzNhU1QHJTNJzkVd3lxEyOfFSOxsqMbuySYu/evmxxWGhq5PTokCR1 FwyA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature :dkim-signature; bh=3tdpFpv3ZBKv1Ksv8LHJfN2lvKqPAq4IheciwUcOxEM=; b=09QCTgnCbPfagg2byocMkeMuWTuRxZp7F1r4ZRNU5HNVo1SmxZZAjts2Yja7oOk3G4 MnXRRRWaUzLlA7ry4qoEElar0ggy9X8YqyhuU+hmGrCJQCahjW9j78bDebNYRj60IIyp 73p4T5KXdt1MQc79I6KXXq5uXHSfW2iK9XasnT5eM31I7m/rU8eHCosSTysPC7lJUeww ulh9T7CQdvtHeLEAhWe8gWZbrHSxDcYH0G4hvlC6cZ7iFLlNsQ05xl1NGV1NLMINqAOu 5AGwveqZC2DBCrdAUEsNUqoe5RQIaodytSBCcyLSFcUwHFy63d/2dJcUYPkYtbOIY+Es gocg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=xvCl0HrS; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b="i5DYS75/"; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u12si553455otq.51.2019.12.05.01.38.37; Thu, 05 Dec 2019 01:38:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=xvCl0HrS; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b="i5DYS75/"; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729388AbfLEJif (ORCPT + 27 others); Thu, 5 Dec 2019 04:38:35 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:33878 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729334AbfLEJi1 (ORCPT ); Thu, 5 Dec 2019 04:38:27 -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 xB59avmE023516; Thu, 5 Dec 2019 01:38:21 -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=3tdpFpv3ZBKv1Ksv8LHJfN2lvKqPAq4IheciwUcOxEM=; b=xvCl0HrSASP+Lzt5qxmQIze+KJQTVSBDVCL6HiXlYeYBfz2XmNbJC+o57Dtz8jvofSKv 2IvEy80N+17jhBBeee/S3ZR0Lo3KcCO1LjKVQvjYShQEiUzMvPM9CiLsZkis5xYewDWz XoR8cCIF5lE/EnvYvhfr8aH20wGmno2JRAoZ2qRRcdrAXRDqbu8mlC7+gwdLr2HzHO+B REd2Jr0rNN2fFS+lEYxP0XJqbGpZL8S1MrpRvT/Sc70QDYiB1xYUP5FylLlcIWYr42Sp xYYsoUVyQmz37UbQW3LEi9PR60fnSzlsrmCqRTo+z3JMRZTAq0WDuo0bWMyMIHQ0xIKm tA== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0a-0016f401.pphosted.com with ESMTP id 2wnvgvrd0u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 05 Dec 2019 01:38:20 -0800 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 5 Dec 2019 01:38:19 -0800 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.50) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Thu, 5 Dec 2019 01:38:18 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f9F0kCgQm/SbrGgtWieeFkQLt0/CRlZDE3dF7o0Q0i8yP6G5YXiXCnqoXDRvneKkCZ4LgBjNh0MeGXfU7hepjspZp9Gt8kePVzEk8iLko7xulw1oLsTkckgasxBP3XipKwr6fER8nlEwF5IxWKDWPhzFlUCMpTtkt8UoyBFrxgjBDVatHzU2DTJF6auRZef9sUxoaf1v6h2afsPY5n/31vHDBojhz9iIxmf76HMpMl9A/6c42W2ZgnX9S7fu8dq+COhT46Cp0t7fTkLQoycB5eapFXW5pU5ojebHR1BHjBldUtsHFfcpO0KAMBuj8BoxHqQuU8oEWAgLl4PCApa6sg== 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=3tdpFpv3ZBKv1Ksv8LHJfN2lvKqPAq4IheciwUcOxEM=; b=V8/M1mOlpPJ5MLdq7FO3ZTC9XJmHvkGtSrpyNydLIH3griGNQxMoXKaR/fs6CIrH8a7M0mNVq/9/drJetldEru0VWlBvk/Lgho+en8JD4SRfdC7TTw4z5wIzYy74R12Onm/6KwAAXG5Lc4KwkxPx4ebdeoTdhLJU+88hCwyE46G2gQjh9Y2mNARpNvDN1iyhclQlLyNmhuxMcqF3lX8IwPMmUTS7SVeXATuA/S+sq9q+maP66xxaEBy8voG19/0n2uSpmB+qEZMHvTrEcJ2RsywvDMepsC+4z0Rpx6v9lZEHkoGSknlFH1+icpnVkjJGEEaXGjAOFj5cBqPoR59+ag== 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=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3tdpFpv3ZBKv1Ksv8LHJfN2lvKqPAq4IheciwUcOxEM=; b=i5DYS75/PxVnQCNgy5bcLaDrRDfmI+9SnLgfnryfpKnM8vwgnvDqK5BBbEE6gBdxlpZZz6dsuxu+PG6eoIQ0XpgeFYO/wA9P3ILBmgu7V5mqB67FTdwtaOSYilBH4W+fk2RTDGuwW8NhdWdFJ9vU1+ZSaK/EJiSdrEXCsfrwUx0= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB2367.namprd18.prod.outlook.com (20.179.80.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.21; Thu, 5 Dec 2019 09:38:16 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::657c:6c81:859d:106]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::657c:6c81:859d:106%7]) with mapi id 15.20.2516.014; Thu, 5 Dec 2019 09:38: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" Subject: [PATCH v2 10/10] EDAC/mc: Remove per layer counters Thread-Topic: [PATCH v2 10/10] EDAC/mc: Remove per layer counters Thread-Index: AQHVq0+4oLwVZKl/g0Gb4piwHzHE7g== Date: Thu, 5 Dec 2019 09:38:16 +0000 Message-ID: <20191205093739.4040-11-rrichter@marvell.com> References: <20191205093739.4040-1-rrichter@marvell.com> In-Reply-To: <20191205093739.4040-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0170.eurprd05.prod.outlook.com (2603:10a6:3:f8::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: cc51215d-78e3-476b-a927-08d77966daee x-ms-traffictypediagnostic: MN2PR18MB2367: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2089; x-forefront-prvs: 02426D11FE x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(376002)(136003)(346002)(366004)(396003)(189003)(199004)(81166006)(14454004)(36756003)(6512007)(316002)(478600001)(54906003)(5660300002)(110136005)(186003)(8936002)(50226002)(6486002)(26005)(99286004)(66556008)(66476007)(81156014)(71190400001)(86362001)(66946007)(66446008)(64756008)(25786009)(8676002)(2906002)(71200400001)(6506007)(4326008)(2616005)(11346002)(102836004)(305945005)(1076003)(76176011)(52116002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2367; H:MN2PR18MB3408.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: gRdDI2yEgogOfsyjJIEIoeYaCu7AVY+Z0nV+aPT3vF7jQsyVBeGTFA2PEG3WzMSnS2pa1qtnyhk33d6xYtge5LGPMKIdHp+pLALLtqp3A8DxC7gmx/l8KLr7tOdzrlO8epYB/cnq5OBVhU7UiLkX9oMzLf9Yqxl4TjNPYCOoGdKicE3sLz8b9FK56Nd3iBUIxw/TENo1Mh5vI4IDnBmSW0EfRMckF11N5bVuKkv0ordPwcpobJUQKiMzLW8SX/PWmR90OEYXhgB8S0bMs/yjwWyIr5vUF7dG1XdjtqeEyRBAYGQ9I0BzLX4QbuEcNiRL56GhcWPXvl9/qRHBc1bGPc32PT2v9fSE8srsbvKuIlVMK+Thu7trHLkPpm3W72pQOuUp7V/a7NxZOHWqNwEP5bVXzwlIoPIjmXlwQzrFNfepODyDZDKJmE8V57SsYuuS MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: cc51215d-78e3-476b-a927-08d77966daee X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Dec 2019 09:38:16.4852 (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: 40+6m1feOgKrPRMSYcKU9KHbm93lI3mUHmFXxuZL1EkPC0V/hie3XDNsiAxcW28rTnMAWV0L/6oSi8Wk4OnVhQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2367 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95, 18.0.572 definitions=2019-12-05_01:2019-12-04, 2019-12-05 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 | 65 +++++++++--------------------------- drivers/edac/edac_mc_sysfs.c | 20 +++++------ include/linux/edac.h | 4 ++- 3 files changed, 26 insertions(+), 63 deletions(-) -- 2.20.1 diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index 5ea834fceb50..3d43b9fe8171 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -445,11 +445,9 @@ struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num, { struct mem_ctl_info *mci; struct edac_mc_layer *layer; - u32 *ce_per_layer[EDAC_MAX_LAYERS], *ue_per_layer[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, *ptr = NULL; - int i; bool per_rank = false; if (WARN_ON(n_layers > EDAC_MAX_LAYERS || n_layers == 0)) @@ -476,19 +474,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, @@ -504,10 +493,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 */ @@ -949,48 +934,28 @@ static void edac_inc_ce_error(struct edac_raw_error_desc *e) { struct mem_ctl_info *mci = error_desc_to_mci(e); int pos[EDAC_MAX_LAYERS] = { e->top_layer, e->mid_layer, e->low_layer }; - int i, index = 0; + struct dimm_info *dimm = edac_get_dimm(mci, pos[0], pos[1], pos[2]); mci->ce_mc += e->error_count; - if (pos[0] < 0) { + if (dimm) + dimm->ce_count += e->error_count; + else mci->ce_noinfo_count += e->error_count; - return; - } - - for (i = 0; i < mci->n_layers; i++) { - if (pos[i] < 0) - break; - index += pos[i]; - mci->ce_per_layer[i][index] += e->error_count; - - if (i < mci->n_layers - 1) - index *= mci->layers[i + 1].size; - } } static void edac_inc_ue_error(struct edac_raw_error_desc *e) { struct mem_ctl_info *mci = error_desc_to_mci(e); int pos[EDAC_MAX_LAYERS] = { e->top_layer, e->mid_layer, e->low_layer }; - int i, index = 0; + struct dimm_info *dimm = edac_get_dimm(mci, pos[0], pos[1], pos[2]); mci->ue_mc += e->error_count; - if (pos[0] < 0) { + if (dimm) + dimm->ue_count += e->error_count; + else mci->ue_noinfo_count += e->error_count; - return; - } - - for (i = 0; i < mci->n_layers; i++) { - if (pos[i] < 0) - break; - index += pos[i]; - mci->ue_per_layer[i][index] += e->error_count; - - if (i < mci->n_layers - 1) - index *= mci->layers[i + 1].size; - } } static void edac_ce_error(struct edac_raw_error_desc *e) @@ -1137,7 +1102,7 @@ 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, the DIMM(s) label info - * will be filled and the per-layer error counters will be + * will be filled and the DIMM's error counters will be * incremented. */ for (i = 0; i < mci->n_layers; i++) { 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/include/linux/edac.h b/include/linux/edac.h index 815f246e0abd..0f20b986b0ab 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; }; /** @@ -559,7 +562,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;