From patchwork Wed Nov 27 21:54:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 180355 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp6699660ilf; Wed, 27 Nov 2019 13:55:10 -0800 (PST) X-Google-Smtp-Source: APXvYqwIlyeLxie9C60d8lEHyfaJuphGI3LyEIFjRaNRVm+oah5QnpT0x61ZYo6tPHmBBrZylDeM X-Received: by 2002:a17:906:cc98:: with SMTP id oq24mr7820780ejb.170.1574891710334; Wed, 27 Nov 2019 13:55:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1574891710; cv=pass; d=google.com; s=arc-20160816; b=pu4eFqh5ZTnZxxoqJB8dphCR9YbIJekxKoh5lnQV9pI9XOvkkkmhH/73IKabvFIjjq 0lM66x9Oq/enRWthNfnNPLYo8ljakJiUFtvfZ2vtSjTrpg89ARZztjm9+kMXZfMXp0Ox orzzRLtArynu2ZhnjyfGFgBZFKmEu6lv8LQ9dU4ts9QfRRIfzfuQB1zYlldV/CYtxl8w EjyHKGGxN3BYHr2n++qsciTa+A5F2Dl6eIvsUAUFFabsk0DhQIK7AJVVxRIU3CyuMJFm x3O8Wd1bQON8CEsb7IfJjIB5QAdpYO9oJnO7zEbBgclqWKK0O569aSlFifi/SwgedV99 G1tQ== 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=NI8CP1FNvVsSTU9ig2gBICZySDmrwOKgWEXPZBaGfJvrAQKTTFc0U2jv6slTgpZKuk g0xat/cGuLliMnoZO77CXlHyG0MwsmDgcm+Ht1mWyPm2qMcCDF8nTyT6MdLr1eVE2Hlb X1wK4ub0uNQS3rqSwcO35D3oM6yAaaRFNd8S/o8wz9NlgOLLakQH0n7vt8wX3cY2XvMT eLj5oIFXM5WX3niFu2mkdSjD4HkxHlMcT6TLUu1uGTGAmw5RHgZ9l1jAEBHr/tCU+etW OMNygvdBNr08fgG0z+LfwQt08eEpIz+dNDoNnnVvxAULdlxIVdzAsaXUxqmzEBAMepcP MQLw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=QYfqDFRV; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=eVFNcJBq; 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 f27si420784ejc.185.2019.11.27.13.55.10; Wed, 27 Nov 2019 13:55:10 -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=QYfqDFRV; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=eVFNcJBq; 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 S1727605AbfK0Vy5 (ORCPT + 26 others); Wed, 27 Nov 2019 16:54:57 -0500 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:21030 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727194AbfK0Vy5 (ORCPT ); Wed, 27 Nov 2019 16:54:57 -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 xARLniuP004627; Wed, 27 Nov 2019 13:54:49 -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=QYfqDFRVU0HIaql/xBOYatUp6hQX5bczO3QH2laZHV0ZFDe3eobGBdKNkLuBrZ+yzlQr ZPiukDVFwm2FjgoyD69ueHhBVQJUxiF1pkVRykSf3zobwXaWGn6tSlVJtM8kxqqEVIxS CckimnL8CpSYg2prW5hBkbYpXsKnJrwdAEdnykQf8f/yPr02sl+3WCqzY/knJtQ9X7Xa 0rllu8mRDerKQaRp0+fBFO1944Y+v/o8uZ/0K3KqqIjm6zK2NugU/rcmYxqaMw6aqCBD YgUOhZm32ka92e5uDMQ6jfO4fGbVh6cn7CddwRYSsuA5ojgutpYlFIAXwj5nwNYuw86c Tw== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 2whd08mrcq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 27 Nov 2019 13:54:49 -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; Wed, 27 Nov 2019 13:54:47 -0800 Received: from NAM05-DM3-obe.outbound.protection.outlook.com (104.47.49.57) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 27 Nov 2019 13:54:47 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JLfHguYMkk4P3g/enm/ARHG0nckZG4plArSXmdB8WP8ERB0wxaeHgmN7g4m1hi2J1FyN2HRTHlExIg12JaNEliZs97isTTc/JLoILlQNi3277tqNXeuGkiqukE5vPwsNkPEmbrYf4UvSCkv7h0kvJD1U5TZWvsbvKfxWv/y2u/T8D+6Dk6T6yX+Fy2vIkRJaMo7doCh58pO1YyMY/41AJ4zTxvBuaHueFNUx9s2ydhfgG6IWIHKOwsS2xvtj7egKpmuHWxKdndJpy62fSLb/Lp3azy5ljK2hGNgG6Su39Biv2Pj+GUTz4mOZcC4VyFGqGs7EZBs1DB9uQuFUiFZykg== 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=AWCfdpgs+58/CwGZK1jaTWqAIdahUVTZfdZKmL05PT0l2qoq1RIUTrYqiEGPx4KLmGKAdb9aZ7UwRwP9P8j+aMm9UKFP4QP3IT9vqwxQ8Z0fyKIMFIMXjfnr8paF5lJ+nrI+taGOjV0RqvoaTWGiIZiV7oo/VB6oLR6csVdHV5c5RLq/pYRt0Rmzz5kjJTFJrrLBGnp9fEQARCBHwgbY8zAvqd0lMQKMUGmwOCwzSW50/+cNhPSUlT1tIetlkFc6F5BAtMfeWAGWAutTQZjA2+GcsICIIFlL2vlH9T0ke9UhSDKnVzE/vwNJVIg5qjAdS0JjMWyfsKZWcvpJpad/UA== 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=eVFNcJBq+l5DmQI1Br8t3U03Bg3g4O+FfaCM3pqJorp6zYasiUydeQ1uaH2C7rnPAu01NKxZ1AciBRYqta7iD4a03N+c1TdehKpjkmzgbdEKYqeUIV/qXVY7MJHcGdAREqy1Z02NQLvZZIzcmOedZ1lT6zO+jt4lAYzZSeCJ2X8= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB2477.namprd18.prod.outlook.com (20.179.81.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.22; Wed, 27 Nov 2019 21:54:46 +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.2474.023; Wed, 27 Nov 2019 21:54:46 +0000 From: Robert Richter To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck CC: James Morse , Robert Richter , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Mauro Carvalho Chehab" Subject: [PATCH 01/10] EDAC/mc: Split edac_mc_alloc() into smaller functions Thread-Topic: [PATCH 01/10] EDAC/mc: Split edac_mc_alloc() into smaller functions Thread-Index: AQHVpW1IhZ77l4wd9kmwY7w9uUFS9Q== Date: Wed, 27 Nov 2019 21:54:45 +0000 Message-ID: <20191127215415.11230-2-rrichter@marvell.com> References: <20191127215415.11230-1-rrichter@marvell.com> In-Reply-To: <20191127215415.11230-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0102CA0017.eurprd01.prod.exchangelabs.com (2603:10a6:7:14::30) 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: d3fcb794-a4f5-4a30-030e-08d773846a96 x-ms-traffictypediagnostic: MN2PR18MB2477: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1923; x-forefront-prvs: 023495660C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(366004)(376002)(136003)(346002)(396003)(39860400002)(189003)(199004)(14454004)(305945005)(110136005)(256004)(186003)(1076003)(4326008)(86362001)(11346002)(6436002)(8676002)(6486002)(81156014)(2906002)(81166006)(386003)(6512007)(478600001)(76176011)(54906003)(99286004)(52116002)(8936002)(25786009)(7736002)(66946007)(6116002)(26005)(316002)(66066001)(50226002)(36756003)(71190400001)(3846002)(66476007)(66556008)(64756008)(66446008)(71200400001)(102836004)(2616005)(6506007)(446003)(5660300002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2477; 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: jjJ/eOy+Mqce08CAggWe4KceXZasQetPs+t5PNzt4aajVwEjcVkIwA9a2cM/8Ot5fhXSRvgyALWJWAPdGhHlLvLn4TRPob3A05/Ggex874Vp4jnKNf/fXsQ+v3ty7pY0jfcJ0e+TMv0U9Hl1ZE7QsgcOWX8wMs267zfYbD8Jt3Ti//cvm40He7Ykn6kl5jSm5NCcEeXt1Cny+7a0ndUplygcJ+oXLleXAwuscR1CorKl3NwBdOmPeOS177EjX8U/Z5+jo0HbcvWocNVLCz1QSztAtBEF97qEpwdAjR5qJSX73oigGtNkrTLcQyxXwvFcBuJUQPyeevSDN6RrqTPkZ/PTLdQvUbHMJZ62atkd8JWFejDUnt5sfjpRfo3z3AMN+2YD1q4GYMv4t89FOJOBcYk3lbMftPbM+i9qil9ycLCJASBcXrpbhR5cugKad98c MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: d3fcb794-a4f5-4a30-030e-08d773846a96 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Nov 2019 21:54:45.8707 (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: pmXtjXT14TlPocBmGSFXp8aDhvTn2yxihQ3R9h1QLMOaXNGxH1oSqv7dClHANXzKZoRuvL94dimOscMrGAp8Iw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2477 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95, 18.0.572 definitions=2019-11-27_04:2019-11-27, 2019-11-27 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 Wed Nov 27 21:54:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 180356 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp6699672ilf; Wed, 27 Nov 2019 13:55:10 -0800 (PST) X-Google-Smtp-Source: APXvYqx0IcLhUG3h9fmczGZc9bUa4o85vdg3t77cQRHeI7MKV9sqO2jX9DBT/b3lBDTBPuGtpPai X-Received: by 2002:a05:6402:308f:: with SMTP id de15mr5209154edb.69.1574891710743; Wed, 27 Nov 2019 13:55:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1574891710; cv=pass; d=google.com; s=arc-20160816; b=NySPKSbhSSTJEPjmPkOeZ/iyP8/wdHwI+Re/DMGTrzkj9OhY8i1ZdRdykBILczDsUr NAge1JR7c67X/zibebay5wRn5BIM1wp7EYNN0fN3X7Dhrxs13zpB0413OsnFoQyx/wxM r1LUhIMxGyLKnnjtnTQFWNzQiQ9mwhs2Tqd3KGJnLOeuIXRvY2ibVFYHzDSDR7eWhc1C 0apCbELgUl6RuQtsz/Pn7pol2czJIdIUlYFsRX6HenHNPo8kg4uudQz0cPwdxEmzdmbK 29V1Y/K88+48p6fS4OQfLNfHQ9SsoSOtiqhbTq+TnesC4AcocGuP93Nc8/NkYVzfo55O +vpQ== 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=iPjveiR0mucuJxzxzX3PcaDt/F4K+FiH2KiIOZb0QiPb8doxFhEwDm2FarIjo/PlNl e5XHN/i8LPcSJvNPe8GZe0O0uSoIFq6gztMsJMX7nJqXOPQkPEFLDmPhOnlwxkeaxyRy 9x5mPsHceKPrlH6kbSZ2XNmuFUUcA8csfkPJ/cBOdEMMq3fqJ9oPd1eKE/zN1c/iqANo 0ujsV4pOEX7p17WAVFAZ9rzRBNAtfSY6VQUclvkKLpKaMSQIrQVIhTdMUMb9y1CxEpaX C0Le3lA8TVWwPu/Ewebzd2goSmI9I16lN6GKWNIt+j7RgQgbLranioumAT8tb4JdFDnn yv7A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=kZdYYbZk; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=LYltI8IM; 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 f27si420784ejc.185.2019.11.27.13.55.10; Wed, 27 Nov 2019 13:55:10 -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=kZdYYbZk; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=LYltI8IM; 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 S1727727AbfK0VzA (ORCPT + 26 others); Wed, 27 Nov 2019 16:55:00 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:47660 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727105AbfK0Vy6 (ORCPT ); Wed, 27 Nov 2019 16:54:58 -0500 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xARLq7Nc027003; Wed, 27 Nov 2019 13:54:50 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=VLw/rMyY0DRRcoTdhPTeXFSd28qQbBSgE+KDk2nrgWw=; b=kZdYYbZkMCLpz3kz/qtGuhjADLMuwt3qtjcjjio9W3095IsefqsNIiz3xEVz8BcTly5a YKsG0w8+lv0IKyqviVzYmye7BhzIYqwgJf0m4TpuxPeFWPZMnMU0Ses+DCQE4MD4ztSP PdqVVfz3ShIocuSp4yXDrOfqmp2+E9qts5ddaLuXOECTGLcoZLzx4WVoBqSXlEQRygQd WJ7aaBpJvxZfadrTRl4uP1+RJOGo0BZMuT5pYipNAdIRX79eMvbT25aI/+AGNl+J+eNQ Mc0fwPppJvXc3idWEFNuk9b3mgBroXOcFDX5ChgpOEddrkG6iL/4WLc2HkZvGed8Okvy 2w== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2whmdyb5s5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 27 Nov 2019 13:54:50 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 27 Nov 2019 13:54:49 -0800 Received: from NAM05-DM3-obe.outbound.protection.outlook.com (104.47.49.54) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 27 Nov 2019 13:54:49 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UvAyms6j/M6gsXVOCzRrLfyy2tB2ipapCEhVI11gYAXNv0f9w7+gRXLj4VuFh9JqOsUBaNl9AafHG9cU8qijmrPKf4PhlCG0mE0+Ny0xJn7rMlqaIjG/JOL2qGdYAiFNVZvfwqAo6f3JQl+KjwzBj3AJRCOSu6vSZBUJvnwQIxiNG0uCZiVkTB1AQHPYqYeIzva8J5CkPJu46pkdv5ZUGijgpH8v3GydOENMXwcLwr+biy2q0DAIEQqt7T6X0mSqqXyvop5a2Cxjxn4QnHdTMJvBkq16dcuh8QkYfkvi4NVEDUupWtEr1PwRRRMfVYHL/fgIrwnLsi89dcJ8ItAibw== 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=aMgoDc6W+cPiznX8RL78UgJzBvsSnn6X1NhNy4lyKmjQV5Q8bSZF27ff0bgdgSypJpyMu8ZUoMoNWd6w2bad7W6pN5rr9XBmNNaD4kmQ9NyxROeckhpgWUTFP2lV4/je85Z6oAco8qcWxcGr+KpbV7LUwOLZzqX4KAq1un/owAkmeEc5sfznQK2/IMyxgIDzbYJMLQQvYtdmY+wIq7wd5I6OXyQVZPtN21hCMZ31L/DWrauVWCpePjPp8SQtt1VA1/2JyuarP4tZFW/BUU6nQJYJU9XSOEHR3cIZ4M44duf2ggtcJvlbCYiQtRiPX6j+wvihIp98+dWjcwLjO8kLYg== 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=LYltI8IMZAeiJ8eQSIhCrLzjPB0YiprjLuiPDL5RpP2qK34pPl2cOYn/GsCbRUl/+lKRGMQO5Q57XPJbtEukogWlKfG+j3GOKhQSZ3MZds4qV64Ebaa6wt0SANJ9ltDTM2NpKA+BBWY1KvWXZQCk7xQ9bK3FKgEf5QGf9DwCZ1k= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB2477.namprd18.prod.outlook.com (20.179.81.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.22; Wed, 27 Nov 2019 21:54:48 +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.2474.023; Wed, 27 Nov 2019 21:54:48 +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 02/10] EDAC/mc: Reorder functions edac_mc_alloc*() Thread-Topic: [PATCH 02/10] EDAC/mc: Reorder functions edac_mc_alloc*() Thread-Index: AQHVpW1J4lRhq3cBmEygQISOk20h0w== Date: Wed, 27 Nov 2019 21:54:47 +0000 Message-ID: <20191127215415.11230-3-rrichter@marvell.com> References: <20191127215415.11230-1-rrichter@marvell.com> In-Reply-To: <20191127215415.11230-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0102CA0017.eurprd01.prod.exchangelabs.com (2603:10a6:7:14::30) 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: f2073e40-f268-44c6-23c6-08d773846bd2 x-ms-traffictypediagnostic: MN2PR18MB2477: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1303; x-forefront-prvs: 023495660C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(366004)(376002)(136003)(346002)(396003)(39860400002)(189003)(199004)(14454004)(305945005)(110136005)(256004)(186003)(1076003)(4326008)(86362001)(11346002)(6436002)(8676002)(6486002)(81156014)(2906002)(81166006)(386003)(6512007)(478600001)(76176011)(54906003)(99286004)(52116002)(8936002)(25786009)(7736002)(66946007)(6116002)(26005)(316002)(66066001)(50226002)(36756003)(71190400001)(3846002)(66476007)(66556008)(64756008)(66446008)(71200400001)(102836004)(2616005)(6506007)(446003)(5660300002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2477; 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: k2UG5iWNFs6oDs3XAcygm/aCEoAyWQ2qzvkRiTWm2+IsxYsciegF9AjUGH5MOsdzVOQUo4npNx6rGPXqPq7L5rOD1AFJJF98yGGzfmRUhU3QVZgPPHDH+dEkv0C+VLR74vijEhOnGZh/QYWBHFGiY6D6dtjPqS9fNvw/qO0d2viU9Y4+kFekhFoy0dQYOY4w7yMReTlS+L1dmrJAZ45LuaAeagUrYaDtfhdhWKinfxneuX2YVL7D2+GhmNN1pgd/33x/BI5KXz4a8HXD8prnRGmHjombx9PQ/vEm7TIhjAjzHIVkiBe60bqcxt0yW+ehJfOrA0akQ7DK167VluRu4mpPzZf71AvHmVceL34nPoefUk+8m9dClpA2kD9GvOgGe7vJTejshfgw2JUWezB5a5sud8HpDuC4FGrGhQ9yAABQq0OfZFc8JUB1ScdJiJg+ MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: f2073e40-f268-44c6-23c6-08d773846bd2 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Nov 2019 21:54:47.9454 (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: e+kHqy9oy2jG+8SLoMtrKKe4px+M0YzAXxhLxlwECUFN0O0M5omG1Drbz9Tb7d+XRzCFWkC5OEVZzojCG8p5zA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2477 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95, 18.0.572 definitions=2019-11-27_04:2019-11-27, 2019-11-27 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 Wed Nov 27 21:54:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 180357 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp6699677ilf; Wed, 27 Nov 2019 13:55:11 -0800 (PST) X-Google-Smtp-Source: APXvYqwA49HIYDJTWXy+roluZgezFq/p3F+KUAxfelsCcYSramTrKYEUlRRHucFiukARL8JQSqK8 X-Received: by 2002:a05:6402:282:: with SMTP id l2mr35542530edv.187.1574891711155; Wed, 27 Nov 2019 13:55:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1574891711; cv=pass; d=google.com; s=arc-20160816; b=s+PTJClMusbblmBK9+M3KMG/kQg4CGfMRrWcBdhQJdDBO6i0+fiwzFw/o+2+9aFKci 0nrjRReO0mr7871ryoA4KXzgmlhdux9cDnToPHbmMGDAzSCUhrFkpcsgJons5dxtcjk2 bcLBymF8IeQLGL8AJ4RUUkXQXKcWPfJnh8kODNMrGl2WqyKhN+RyeaexvnZUaeb0mAYA Lvo0910Jcj6yl+oX2sH1BjNrVZSnhlUPN64gxjJBJhACKOsLHaEB7VtZecxazk+G4npi q7HQ4C4c6M5/LW5nnufR9aB3WG6yPUrmVwsXKNToPwIvg9yVCidm/1M5Y911aTm+YvMS YbaQ== 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=R+NmB3CHIrIyT8pz2/5npFRUY8xFJoKcObHAousD6aA=; b=Jgm7HbfZWLoDP+YhWA8TdC29Br+pA84FiO74LOqMsJ9yAeNi+JY75Zp+MTWCXdlVj4 FsXRV6fhfuQA8kv8fzUkcxEVdaXjWQvOvptN8eHrVg+lQXf5nSsQVOI0xFWzMG8jpCLU 9qIH8AXu4F70J60Ldmc6jjPcGGIRFmKqFL8C3bPdCM+pWRzoDQRl7fpDrO2pEW8hZw/U IW/pL/lF7oKMPXVY1VwFQjsIHEAvoXku4T69Up7wSnpfGzhxoNfZb6Uf66mMn4TCnKX9 jdlu1o4f3bXqTGjlS1XVz7HITQEr84fOqtxDqa6ihOGrRDbjOPxGZRJZZaUcGsF3Y3h8 4Yxg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=iXThzT3J; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b="qiL3/rmW"; 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 f27si420784ejc.185.2019.11.27.13.55.10; Wed, 27 Nov 2019 13:55:11 -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=iXThzT3J; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b="qiL3/rmW"; 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 S1727793AbfK0VzD (ORCPT + 26 others); Wed, 27 Nov 2019 16:55:03 -0500 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:42454 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727194AbfK0VzB (ORCPT ); Wed, 27 Nov 2019 16:55:01 -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 xARLo17P005224; Wed, 27 Nov 2019 13:54:53 -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=R+NmB3CHIrIyT8pz2/5npFRUY8xFJoKcObHAousD6aA=; b=iXThzT3JckANbDqdnQHgan7FI8TcxVVc2XoZ0scOH3NEdovvftUQSPM03FRrXgnbCvll w5JmY1nXzS9bRP+ZGN7r2KiTRQWybw6MzAXy6WMTKmGl0DMrtZrEhwvcoQXQxiRO6nms Y/hCnyAiO96wft+bVzvyNzJHg66WzRYDkjzI/DZteBQZbU09pH4zU5uZFvgCjo15z9yV rMvXCVvadj3MZgl3el6pQUPo1aSuE+sIUmSQw8Jjvatcr7nXdRbRJX5Bg5szO9h+zMPj vmVBy8VM5nvwJj2RoQCz6UIRFChlHymAIGhnxD+inUkEQxbHfC/bZm3U1/HAnY5qkRN7 uA== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 2whd08mrd0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 27 Nov 2019 13:54:53 -0800 Received: from SC-EXCH02.marvell.com (10.93.176.82) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 27 Nov 2019 13:54:51 -0800 Received: from NAM05-DM3-obe.outbound.protection.outlook.com (104.47.49.58) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 27 Nov 2019 13:54:51 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PWhCmyXnkqtGk3ZZk/htec8Y0DbsDj9PxDcgs9+HOYf1UBU9Z2XdqvrtypgLI6j4W3Xqo93zBzqFXl+Rdt8D8cF27eJKYtxM11QtxEsSHX8O2elGGizyzg1xRwXjZiiIUivzhz4zZrWyQFa14+8e5aoGOTOyWQAxcPEjecv+P55LqeXVrKgMV+FdjJwsGpvcNhSKoEMpzMfbrexL6ArEZjFmeA4BtGD+OrCtfiVtdJsd1IfjfbtuV4h0GaRxEAHeX5q0FEstO3pulpwQVr379obHeVEFGCNn0vvfFEK1jj9dWS9n+coaaKX5cum1D4iolEFGqAkV1/vZiwflCVbVhw== 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=R+NmB3CHIrIyT8pz2/5npFRUY8xFJoKcObHAousD6aA=; b=CLH2OhQNF5IiHmzfhwKF6NnU6lF3Rw6hOvEP8Dqgt52KKtUA9FW5yWMr8jiWywfw1YkK6lcElGIWcC29s8GBROxRNwtr2gqpVMEIli0iSS7RK6p4VwYvLQhi+lmQ3oASVRuUjHcQb5SJkBiaIZbcOuMaa3F4E9b3vyQX2hoTDs9qyysJE+APtzuChZElrxY7rvV4GVA71GVoIJva5fno4Ra1E5EpdzZh0le6d5USDeGIHCZn2h4CzFHXemVEBWKLJdX0HS19fXtGI64zQD5MPB2NL3yG42MOV3t8bcAchdt1wfpV6xPSzs2RUgY+QsmLwYOM0PmiNVgQnyM5P949cg== 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=R+NmB3CHIrIyT8pz2/5npFRUY8xFJoKcObHAousD6aA=; b=qiL3/rmWbboo9wwPd5iCIWm/nT0S39dFvIfDrrLwwnQXCQ4QhFEf+pfOonHY/aijZLi88uDAjYkkNf49OGZusrYkpB5jEgpSKFxZtGrFOCf3fIrmSXrKjBRNlBvNwVIQzAsaQmzdh1F6dq7Qnc2eDVXb6RVzF6mcvbh7+OIHZ/0= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB2477.namprd18.prod.outlook.com (20.179.81.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.22; Wed, 27 Nov 2019 21:54:50 +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.2474.023; Wed, 27 Nov 2019 21:54:50 +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 03/10] EDAC: Store error type in struct edac_raw_error_desc Thread-Topic: [PATCH 03/10] EDAC: Store error type in struct edac_raw_error_desc Thread-Index: AQHVpW1KlAZxbPSPEU+s5QRyNfxu4Q== Date: Wed, 27 Nov 2019 21:54:50 +0000 Message-ID: <20191127215415.11230-4-rrichter@marvell.com> References: <20191127215415.11230-1-rrichter@marvell.com> In-Reply-To: <20191127215415.11230-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0102CA0017.eurprd01.prod.exchangelabs.com (2603:10a6:7:14::30) 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: 8b716797-77d1-4e45-46f9-08d773846d27 x-ms-traffictypediagnostic: MN2PR18MB2477: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 023495660C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(366004)(376002)(136003)(346002)(396003)(39860400002)(189003)(199004)(14454004)(305945005)(110136005)(256004)(186003)(1076003)(4326008)(86362001)(11346002)(6436002)(14444005)(8676002)(6486002)(81156014)(2906002)(81166006)(386003)(6512007)(478600001)(76176011)(54906003)(99286004)(52116002)(8936002)(25786009)(7736002)(66946007)(6116002)(26005)(316002)(66066001)(50226002)(36756003)(71190400001)(3846002)(66476007)(66556008)(64756008)(66446008)(71200400001)(102836004)(2616005)(6506007)(446003)(5660300002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2477; 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: umS2Mj0iyJ5mluk5jezLYRYJPxTIAFYqF/JrkuhpKH6EAowvW4X269Vad2L/PpBxIpkf0JDpGkhAPzm75TPx4jP0noEAsfUpCjDiemZuRR0YMMFghqXgmquMWEVnoQsJiXzaUT1ns3mdsyhDgdc+rhSNI+pp7K238xCbhdazk2wjyJHZcQMJRqOt1eTkxwkjNX83UT2/FHQP8eSU9ee4mP9lsK7Sp+9pLPRLYYodMcDHWvHNnQ2o0CvNb0+ymr7Wfn79TqjzJTQzgHDSlZ9ViyV67GHhaO3erPMzm2fICzs4rM2j6taNU/Gq2KNNcuBnd9w4STIIz2r3irEXeUYlKn7EQipv0kt5F3Ed3tjTxcJX3ml1NeqDyyKaEJ4ZH9xtNgtdxRa2Wpl4OgbwAvhHvj43F3NSHt4pj68wC3PMjTBWh6so1n2upWiLiAro481Y MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 8b716797-77d1-4e45-46f9-08d773846d27 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Nov 2019 21:54:50.1901 (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: xfBNtWawneGDb9q2qMwEW93h4RARj6Bjty5kDawFaHvrW0CYUQPx9c+XVju5jEsfJ39obo0IWFdUU4ZXVaHK1g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2477 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95, 18.0.572 definitions=2019-11-27_04:2019-11-27, 2019-11-27 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. Signed-off-by: Robert Richter Reviewed-by: Mauro Carvalho Chehab --- drivers/edac/edac_mc.c | 10 +++++----- drivers/edac/edac_mc.h | 4 +--- drivers/edac/ghes_edac.c | 11 +++++------ include/linux/edac.h | 1 + 4 files changed, 12 insertions(+), 14 deletions(-) -- 2.20.1 Reported-by: kbuild test robot 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..5c1bdef30757 100644 --- a/include/linux/edac.h +++ b/include/linux/edac.h @@ -462,6 +462,7 @@ struct edac_raw_error_desc { long grain; u16 error_count; + enum hw_event_mc_err_type type; int top_layer; int mid_layer; int low_layer; From patchwork Wed Nov 27 21:54:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 180358 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp6699783ilf; Wed, 27 Nov 2019 13:55:18 -0800 (PST) X-Google-Smtp-Source: APXvYqxfnr6ZU3LxI6hCGjJ/Rpn512snl7o4MMIhoqfoxYvsxMYsk9Jo7/SstoGpbugWHx/USfY+ X-Received: by 2002:a17:906:d210:: with SMTP id w16mr51645189ejz.86.1574891718532; Wed, 27 Nov 2019 13:55:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1574891718; cv=pass; d=google.com; s=arc-20160816; b=RYXgmre3miDJXELjLwOkhpX5J0xauglf3XQU8wc3i8z8VA2+5LXqA7V+271Q7zI0oV YBXWrVZT0Lh7AIO5LIgnDJQ7EnWiVq1fL/dfVN+B8xbeyFgRIvjjtr0ABgp5JIJRPGMc aTLOF/YchGtzmZA0yuw1nx/SbPPtcarowDPWEIGctOF4c0DNj74MevM2kWuiKYbr6Klj 2FjS8/ceo+1hRdNjkdL3mNCiXr8H75a4eMqaJxHDBZ4gbSe/vf69ysbt8y2arFpv5Atm Cjkqjw6K/mrBOfxXxLzA8AH16g8i4s52maY5G/7tBcsZkBWyF943SE4Fidxohs2BvWfx Y/7A== 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=CJvy9yLTWS2Tro30Sg0722aoYM/4ujhMqac/MAavZLlay7RlzlGh7bF87gborxyUtj QNjnK6PwfcWp4mP99pded8IytUNoCLuFeTaqzaWqSmk8FV18GezaTAMt/AaViYfNP/+L ysrq9ivxIeFC4PCuvMyfavNqvUd7dPb1tbqwF9/YoCpNuwdX7HlRy0Yb6zED4MaW25Go 7ULbdM18MvABrsfxlwf//oXesTh7OXbcaGq+e8BTTb1I2v23xAgCjTIxhpa7ilVav2+4 KLcGDCuJEXrzQoO6RLKOIkxExJBwrDeAuA9UXc7lK1qwFTIARRibrw5vH8iNX20x+6Zt 9u9g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b="d/rMw82f"; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=CRgNgw+Z; 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 l15si11165361edb.81.2019.11.27.13.55.18; Wed, 27 Nov 2019 13:55:18 -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="d/rMw82f"; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=CRgNgw+Z; 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 S1728015AbfK0VzN (ORCPT + 26 others); Wed, 27 Nov 2019 16:55:13 -0500 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:60860 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727764AbfK0VzD (ORCPT ); Wed, 27 Nov 2019 16:55:03 -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 xARLnq0D005146; Wed, 27 Nov 2019 13:54:56 -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=d/rMw82f0tiW93zfSD8G2aQoXunQVlKfsb/2wxSQJTfbL2doeGmpDGv0PJF+0Vvq+oLN T55R3F/S15bDHrYv5zfFIJjk17BW2XUrUWILVr5Y+5o1onmy4Vub7/9EJBRfc5En5FfT DVDRrHM/SRryoli8xhlAVScQP7B0PnIcYaf5baqhK1WfLgSImHN4k8e5x1xuTSLs/tj5 SRX3jCsthQvyqAQQJ4C2t1y8qlv15VuiN2fjpoTZ+/5k7e9aty1hRKNmQciOLolfPdAR JhHEwXHn12wLginlmr75Xko/wAYNuMoarAgqDHjEbEeA9K57T6ZYqsi2F2cQ0lsvL4Wz /Q== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2whd08mrd3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 27 Nov 2019 13:54:55 -0800 Received: from SC-EXCH02.marvell.com (10.93.176.82) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 27 Nov 2019 13:54:54 -0800 Received: from NAM05-DM3-obe.outbound.protection.outlook.com (104.47.49.55) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 27 Nov 2019 13:54:54 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QAtLQ0HxshJmXHeyq03bI1zlKn+J8uboDGDcXLUZJDfbrUH4mo+yHn0TbJegwNPTE9iaw+LZYj1AOnyyvA5bPo4c7xOgyxFvmWBwb8iau+WzFA242QLTPF3BXtIe2ZIgPDGFTJ0QA1XwsYj7tGFZfiKIAbSLe4tUWg8ZS4YClLkeaXK7IPlRY4m/GVqLiYo9OBRQ5pEycX+CvDLmxykcLF1JaqNT2o6X9lGx1lIzNhsxUyW7cCLEAG5Pi6QFCWMyt4LjL0zBrGqbkZWiPPnM7lkn3HAuR0eWXdwsQp2b+XNp3r4NaOTyD6J6x5wQF2XYCenZwepscd+RVvZU4ZKRLA== 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=U5AeYhPjZyePIvix1d6fjTmF1qCMUQp/DEJrnpMTVeh1djEFkZRd18RPmBua/MQ/5ClW8jBDdP2IH3rlruwfJwX4zFlpQwW/aNOFAH0cnCZSVMV6hGtYjVwhOqu/7VWD5RQ20gJ25AKiqTWhR+p2rB7wHYZkyvkRhs6gWpovB8TZaWCMeWCwHln3vuIlSsL91KRpMPl+JtroY0vcU9vDcVmhwjeUK0EGGJijjCqQy7T6UpxPC4qaxO7lAIabR3tVKH0aNLKTcXFYpRdnxePmsKvXxcdLFMQLRITLhTOxBbcWBTiWuaiYtviaqIeYkmzJZN2QkDBExNXpVGXZclf5Sg== 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=CRgNgw+ZKHrF0isHrvakTfP/fffNmzBpeU1BejKcGpJrInT+DVYkj/JVXEh2LlCo9V2zrHHl7w35Wg0/YYNKZ57RMNf3+/ZoP4xMpRcHcCscSeZeB19nDWp3R4Sq8/LEXv5alB/N7i3D2U3PT001TIh9F0Rr6ab5ldat/PN7kYc= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB2477.namprd18.prod.outlook.com (20.179.81.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.22; Wed, 27 Nov 2019 21:54:53 +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.2474.023; Wed, 27 Nov 2019 21:54:53 +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 04/10] EDAC/mc: Determine mci pointer from the error descriptor Thread-Topic: [PATCH 04/10] EDAC/mc: Determine mci pointer from the error descriptor Thread-Index: AQHVpW1MO7+hOyRLkUWGA+BbCNV3mw== Date: Wed, 27 Nov 2019 21:54:52 +0000 Message-ID: <20191127215415.11230-5-rrichter@marvell.com> References: <20191127215415.11230-1-rrichter@marvell.com> In-Reply-To: <20191127215415.11230-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0102CA0017.eurprd01.prod.exchangelabs.com (2603:10a6:7:14::30) 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: 0b29edcb-87f4-471b-78c9-08d773846ea1 x-ms-traffictypediagnostic: MN2PR18MB2477: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-forefront-prvs: 023495660C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(366004)(376002)(136003)(346002)(396003)(39860400002)(189003)(199004)(14454004)(305945005)(110136005)(256004)(186003)(1076003)(4326008)(86362001)(11346002)(6436002)(14444005)(8676002)(6486002)(81156014)(2906002)(81166006)(386003)(6512007)(478600001)(76176011)(54906003)(99286004)(52116002)(8936002)(25786009)(7736002)(66946007)(6116002)(26005)(316002)(66066001)(50226002)(36756003)(71190400001)(3846002)(66476007)(66556008)(64756008)(66446008)(71200400001)(102836004)(2616005)(6506007)(446003)(5660300002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2477; 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: aNZzDIdHhflH7tNEFqs3Ix0mQvIrVMmHrlWT3IRR1DHNwJqVydNQdnw5ORLcS4kOn9ibd5xfepxn/WgIflmOQAcwkX/gPHvw6mRe2ryqwJw6NVuGQmtgF2CSX4LOCfA1TXhRT30ogopQtXModhdvPAFJ3znBUDAG5nI71q0qgnhVQX6BwSXRCUwO7Vdjd4uG5ebh4Exgu4y6Zv/aFOiL1602N2Z2pg/TEE/mu//Rzx0pUHElkSNnsToWEzu/fYcPs0hFYiu4rv/Y5aEqLzyb/WCequfL/Eablzx7dWjbTPD3AsAYABnUogJRump04vWqF606vPNkzOPB7us/tVhMTHwO9HjpYjx1JN/GgvYwmotCGtYIx4thS6DAASfOwHf6IixIxejvin2MSB0Js/ODv/iuiT5NB6zd//eJJmcZbtChG1SknP31Cnq3JlOeekgm MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 0b29edcb-87f4-471b-78c9-08d773846ea1 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Nov 2019 21:54:52.8995 (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: Nxt7eY3yMthUys7V/I4gpqO3FT8ARaCjssJ7o8CD611xCvRk9kV4gRqC4DUnf8yhrDcgLtwBX/cqi95tcVW/bQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2477 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95, 18.0.572 definitions=2019-11-27_04:2019-11-27, 2019-11-27 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 Wed Nov 27 21:54:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 180362 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp6700007ilf; Wed, 27 Nov 2019 13:55:31 -0800 (PST) X-Google-Smtp-Source: APXvYqy0ia2JsWbSF14Sn8XOrz5cbXUfS587IupQvDBSX0cuA9T0I/6x4JpCTz4A+cWBXXTh5Zyc X-Received: by 2002:a17:906:16d1:: with SMTP id t17mr4326123ejd.41.1574891731824; Wed, 27 Nov 2019 13:55:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1574891731; cv=pass; d=google.com; s=arc-20160816; b=DChU/g9+cqZtL6u7DajfStGhfjTgh7wHEHFySKAK4TyKLHP75BvOVn8mWgIB7x8ymN szcRRfeL8Z3xVloxsFOq9P+OQIsAzZmC/qtmiJahi74zjXt9u7w6qoEF0O9YsAcr1CGA kClSHxSBGF3qgiij7+BHaRi1goh+4fdkDe5XapvuT6LDrjaJpRE26MoqCZz5QdGS7CJo XsDvmsmrSo0Pqd6Q/Ucr9F9bxEgAjnmkI1eYY9AaApEbUBozYMQVT6EYt5EAxKX4kmMr MDni1YTXkpvN81TZ2vOs7wyCjZKdwBY0dpJZICDdxMF8+AXivfMQQSNtCdiP+j/03dZg BhYw== 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=xrecaxxBb51siBK/nvBFcFIcTyqWOv48wcL3MIeWJSMYqbLXxQh8h7csHk/6YIMozt /xU2roVjuTdj8pQQzF3hPjClGz+ramHp1BEFPUFNNMOpW6Cyon/qiSZhANeBDf2SMIg1 1+hKHh1eLrhbqCS0Axfq1kRtYDhzr2b69FAK8kVDH90+VYZ1rWKTipCwynCGsyuzpDLW 7quKzGVGHC3y/hvihTbOcp+HeALEXj//O04MhSNhWMxK0q06hj5/fjFw/4YkrQR0OStz IxFIiiCfl51RfOH4NnGOg7nwlifTEnmNj+BrkTa1os/PMv0zX9QgUXniAO1hDeWjQkFC 1z1g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b="kH0N/NCO"; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=sL69lhVB; 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 gz20si10608178ejb.335.2019.11.27.13.55.31; Wed, 27 Nov 2019 13:55:31 -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="kH0N/NCO"; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=sL69lhVB; 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 S1727935AbfK0VzJ (ORCPT + 26 others); Wed, 27 Nov 2019 16:55:09 -0500 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:54632 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727773AbfK0VzE (ORCPT ); Wed, 27 Nov 2019 16:55:04 -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 xARLo1gX005174; Wed, 27 Nov 2019 13:54:57 -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=kH0N/NCOcYLT4xJoD0VdVxYovCzmGtrsO/cP3BZIVubiM1Iv8WiyzeKOB2QJGfAZU2ga P9P/f2PthbCqokGAFegCXyxMy8J84AGiXGX3cM/FeZ0Wgraf2IZI0bdeaPp2pG8t+HtD HQYJMClIb3KYaY82THXUabbU2JnNfJboc4heTyIiJZmAo1xd/0K86LaAfsjeiUsvgDQ4 YCDjRkRgVaBus3ahOSim5I95zrwTBQffs0vOQ8dSdE9BrdsiFxSa95VQJUVjRjvmUclN LTdQeFfPeLYBYx8lTecqWn2VHji6guuC054VfqEg8N18Yo2oQA0NCuB7qDUzW7ao5TyU wQ== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 2whd08mrd6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 27 Nov 2019 13:54:57 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 27 Nov 2019 13:54:56 -0800 Received: from NAM05-DM3-obe.outbound.protection.outlook.com (104.47.49.57) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 27 Nov 2019 13:54:56 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RpYa/4vA8sP2x2lU5vm53OBpPRHY6hftRWlc751TW8JKuUo242x0Yf7A/hnvnPSW2fE0M/z1M3TmXn2JqgumQ9G46IGzFqiIJkfVLlACUA3N0RwLWeLVdIk6YkQEaENLCj6vtqOpcQJUaMTZQzUyg+vEJ2NoY2yhmvPjxWLCDBm8lquyTvli+uBPWtfkE+ZKCv4HTfbdPOcS8CWoYNFI0e1V2gqNVIZ2uaJhVy5jNMkL5SuJJ7EX0atxoegg61AVJiwBLoBKsHtSWa6zXuuUmfQFVZt/0zTRZ+8AX51GwaQKJTjOavOvsiWs/6U1LHtEQs1VRme/pAhaEcKgis8pAQ== 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=IuRslh2NYMcM6AXEmyKFw+dgLjqRM59a2R92cL9vFH6D4NEoDh1fdKCvl9dOpnDcEwQGMPXOGG7ZUbV/OlBwgsI7MuBb7B5HemAPxr547SMdE0OpKx204b30fzeexytb6ggRn+numFtO5myV3ZZHxXiXjKbn9/CPNutVAjCIHLC+RFw1IeMZZWFKdvQ36bjEB6i3MCxFkvedKVRCDCl2cBfrN91d2ZwiU/tnE3ULn4w0n8DU+coGeF1UzGC9ib/sAgWBcFM8Z4u55EXPl247Ir3Bmk8EEMJpkxBuxCb8z0BEzw2D99E1K4GiRtBVYwMyMEtPbhxMsgMPoRSoRm01vQ== 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=sL69lhVBt10kE+xeTzjsiKCsaTjUi12FCxsVbliYBAryUfE64RqT216shD7z2wJ2huxSVkREG9DprjEqmwx7Vyi24m5GLvl4YB62N24totaCbETteJSiPYn2qknhvJoBjz+1FgxZC0ixRy8ph5IFWdFtPtE+ecQeW+3p+cai6Xw= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB2477.namprd18.prod.outlook.com (20.179.81.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.22; Wed, 27 Nov 2019 21:54:55 +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.2474.023; Wed, 27 Nov 2019 21:54:55 +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 05/10] EDAC/mc: Create new function edac_inc_csrow() Thread-Topic: [PATCH 05/10] EDAC/mc: Create new function edac_inc_csrow() Thread-Index: AQHVpW1Nlibqv9x5pUut5Ig9LljS+A== Date: Wed, 27 Nov 2019 21:54:54 +0000 Message-ID: <20191127215415.11230-6-rrichter@marvell.com> References: <20191127215415.11230-1-rrichter@marvell.com> In-Reply-To: <20191127215415.11230-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0102CA0017.eurprd01.prod.exchangelabs.com (2603:10a6:7:14::30) 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: 33fafad8-0734-4c61-5cc3-08d773846fde x-ms-traffictypediagnostic: MN2PR18MB2477: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5516; x-forefront-prvs: 023495660C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(366004)(376002)(136003)(346002)(396003)(39860400002)(189003)(199004)(14454004)(305945005)(110136005)(256004)(186003)(1076003)(4326008)(86362001)(11346002)(6436002)(8676002)(6486002)(81156014)(2906002)(81166006)(386003)(6512007)(478600001)(76176011)(54906003)(99286004)(52116002)(8936002)(25786009)(7736002)(66946007)(6116002)(26005)(316002)(66066001)(50226002)(36756003)(71190400001)(3846002)(66476007)(66556008)(64756008)(66446008)(71200400001)(102836004)(2616005)(6506007)(446003)(5660300002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2477; 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: z/BrNi42onYNJlmRnla2K25NAZYpcaNtcRP//2kJ57JT+xLjHUa9mLF65WYWC6egEXfIFyZGMMTXRIuaqMLGVq1dVkO/nTpDC9pdpN1O5iP1wepjiP9FM7SwpK72jI8tx+ZpaxQwbxPlfUTAwr0l2+Il463/O8HfYHpfwGprzSM7acQfre+UqgaXTgYO+lEAVM6DKhaHg/cuR1evE9piGPLC7AvOKXU7TC0OhGRY3QvZZcbfLaduqXhM4ppLoPPtwZGAQekQ9ZAH4hoceu/S6BhizrYjiFK6jWwtcaIve1EZw84YtYhR782h5tZD50tyWDGTYXVCRqLoxhZ6k2qnB/teufAZexKFdDrml+CKHssVj0bd/3pQuojbCUfDTARnMXtX6aY6to+bn1MLOw8lCToBFCqpI8RWazfCH2Um+51+f4Yh97cwpHuWMN/sLiUO MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 33fafad8-0734-4c61-5cc3-08d773846fde X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Nov 2019 21:54:54.8324 (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: rBTC6XGTLtre6XWw8FBr33GiVpAcC5q1KEHLByOOVmcksg5S6xCR7mCcXaGQ2FxMK6UTFcYTTiWwHXEBsjbsZg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2477 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95, 18.0.572 definitions=2019-11-27_04:2019-11-27, 2019-11-27 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 Wed Nov 27 21:54:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 180364 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp6700243ilf; Wed, 27 Nov 2019 13:55:44 -0800 (PST) X-Google-Smtp-Source: APXvYqwrcnOJfZj/3UYtrZb20ppo8dwHfxVnod7ss3Z/QSHg3MvDbPyPzcNihzrINjfVMugwAVNZ X-Received: by 2002:aa7:dc0c:: with SMTP id b12mr34415233edu.186.1574891744745; Wed, 27 Nov 2019 13:55:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1574891744; cv=pass; d=google.com; s=arc-20160816; b=FYoYa8fg/bntQLD2bjrDm2BDsFfLdeeesY/uI7nElvOrvPbiwLSlKj4VSGgY25/HTP FUej9SgYcNNOdzIVq8bkQ7yIxNj4+k2ESMmxfJb5ctY7dcTapoS/4G8w+5Ig2+DKp5JG NKcuBN0AaK9SvmtAQkOSHaz6V8IC+dLe7ix8aO93Kzr/LrgDXhceSRN7SmGs0M9Oi5Dt vrwms+do0F/LlRoxV4GC6fRSz90zs5rUeOLW7/ZZrCZ9RyEcxp6DlAdfuUSnge5kwTVw A1a1VVlDL1d1QUDgpSRHSIMRTAlQO6jFv60hQw9ob/S63QpCbP4TgyixZN1VGeVESXjy 7QAA== 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=XrXKxV/SrlI4scRyrb97STAkji0TDzhcT4JPxLRTBTKaiYhVS3zzUnQTfhcjow9T49 6KYEfWA3TYJNsRHOpX3UJqaCcC5q+D0B5Tph13QP0C3PhITLjpS4SFV/ctr2NV4x8pme bhv0DS7Ms3PRyXsmquCkvpfx5iBdhhqBsV06gmOLv3p/LnDjB+ZjNbp+nr1sPkxqkidq UrK3Q1s6heEYU2QOiKv0pX644rZ/UEuPdkjbUesHvH29Bti0xdU/Tu/osJFDDXITBjGo LVR8SOoGfWhteo1i98930O0BCXhEHs/JDyZjBLzDPhUzRHqvpQ6WWmovQmMNfEJyWgOj xpXQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b="m4/wmDpD"; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=KrNFTylf; 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 h36si11869362eda.206.2019.11.27.13.55.44; Wed, 27 Nov 2019 13:55: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="m4/wmDpD"; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=KrNFTylf; 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 S1728326AbfK0Vzk (ORCPT + 26 others); Wed, 27 Nov 2019 16:55:40 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:44034 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727798AbfK0VzF (ORCPT ); Wed, 27 Nov 2019 16:55:05 -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 xARLpk5P026852; Wed, 27 Nov 2019 13:54:59 -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=m4/wmDpDyK496+S6jX+bkd9v+H427sAr5Q2hxa9sLgEKiX+d8V4psa7sCZemuCRdVKr6 D5XoQk+fGvBxLECDoK0x22weXa6SUUtmXHS1mro52kanKdqN9eLgAGhyMLJlMZRyfBmJ HKjhJcv9FB1gcjFxcXFC3QiWxez/ckhjtP10Rr0hX7EASSF8FEhl9gizmIUZxbAgT/2F +7RWnJFM/QSrKEnYf0XwyU4F73puC9bPhF7m5EDbcgQ2MlfhBul8m+cMjCoAPeTGDsIg PB7VfIBlTWG6srdboj3oGtMjiVTyRCfJQv1o804DN4BAbqEO9Jndk3gZTYS/zDJLP1NT JQ== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2whmdyb5sa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 27 Nov 2019 13:54:58 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 27 Nov 2019 13:54:58 -0800 Received: from NAM05-DM3-obe.outbound.protection.outlook.com (104.47.49.51) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 27 Nov 2019 13:54:57 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gsW597vioH5Xj6oPALepuUiZRz+QW865JG0V7oKCeNim/Ou4VWd/fb8XpFrq1wyXjQm6A3xIZ1j8tk/tRytsPy61e42z6m3kRmrKAy+8xKaUfgyiP+mfPVlgcnQEZgv05nB3rUgvsr4+yGlk4gj+ndcQdp3m80PhqTUxxIF1u+r67F5yaWdVpa8yRzmJDqs7rdFV+RFoqf7wFj8CFM9OkqYJn3FB3SkQKwJ3MBevbqXC6YRVIuZDWxKMC7XyZ3i3E6AO1ahUW1NJ0JtLCL40MoJ9COoUjJKCWXlfJaycE0LJvqeuMH77Q059vhGDknaMLiopqPt8lsbVhGKK0NBsCg== 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=Mo0kV3H/H3N/84uD0JisfAoIFR5AManoIHrS9QvjpYnvblipCxBHZrVfLiq8CaNQBV6fSjwGgZhA0Nqjz5dSItxKfF+Nej4UAGynKogFep9qdhisOWNYOXGawsZ61k1azO36b81GwsDB/EZCx11hZL8riYUA2+2W9acU3giwu8ISN5xIAwszm2NCsOBdW4WOqr8LURJ6SUKbLJVtfK1vlJPBdR6D7jh1G0/wtGkHVMkBrJ24EdxggYjS5OA0c8t0MfawjXE8xO89v0SIA1MjoScX5Sb29TaU89oXbcU3zPEvQZVoGc5yr3j6B58+OTHQjIDo1HkH30pH5IvS4b3ebw== 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=KrNFTylfxqCwm7DC3mamhRs5cQkRnSZQ27ICvS5nmPZQcE1t/4ZLWCYef9q7+GzZaD9ix3t4JQWYw0pg9wvgwOrwIBN04Xtb/l32OtTSPJYUj7hGO7rB7oTD9g3eDi5B8cKmwXc3Qfe3u8nwQqmb2t2cRVKsbqcOnkii53xSHDw= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB2477.namprd18.prod.outlook.com (20.179.81.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.22; Wed, 27 Nov 2019 21:54:56 +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.2474.023; Wed, 27 Nov 2019 21:54:56 +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 06/10] EDAC/mc: Report "unknown memory" on too many DIMM labels found Thread-Topic: [PATCH 06/10] EDAC/mc: Report "unknown memory" on too many DIMM labels found Thread-Index: AQHVpW1OH6J9ngfh/0quQkcd0wFb0Q== Date: Wed, 27 Nov 2019 21:54:56 +0000 Message-ID: <20191127215415.11230-7-rrichter@marvell.com> References: <20191127215415.11230-1-rrichter@marvell.com> In-Reply-To: <20191127215415.11230-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0102CA0017.eurprd01.prod.exchangelabs.com (2603:10a6:7:14::30) 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: 4f7a0990-a986-4112-7edd-08d773847108 x-ms-traffictypediagnostic: MN2PR18MB2477: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 023495660C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(366004)(376002)(136003)(346002)(396003)(39860400002)(189003)(199004)(14454004)(305945005)(110136005)(256004)(186003)(1076003)(4326008)(86362001)(11346002)(6436002)(14444005)(8676002)(6486002)(81156014)(2906002)(81166006)(386003)(6512007)(478600001)(76176011)(54906003)(99286004)(52116002)(8936002)(25786009)(7736002)(66946007)(6116002)(26005)(316002)(66066001)(50226002)(36756003)(71190400001)(3846002)(66476007)(66556008)(64756008)(66446008)(71200400001)(102836004)(2616005)(6506007)(446003)(5660300002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2477; 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: axu9XjyfSo/xpmnqkr61MWhNrpQWibxJYVlMu2iGdSnv5IDsojYmnXlDUI8T3Xpju8CG4mrmV8tjToGBhzfgtyMp3g31U+8L75L3tkcGj915rcb8NNcHbJI288j5z6IT5HEwOHaftxqWbQK9NojYCJRhaP8CjxS/KAnGNGqutt7r8Zp5RKNHmTqNFmRtWGVZrKMAfaGm7lMGsg1QTqeRdH/29bzTVOcPOfVAapg/q9TcU8e5hvhTKd40yQnxlOsQBR0puxZ0vAX1asaTxDyoaPOkRR1Lm/oef24ZZtpLpYZ0hM0BCdYmOyGTP+xFPwiC2N5jk1WZU6RAmJjHzSyCoJWJDUEETkogianswwK4j0uKiQBVQOUcff/IgmBsgPAyTGFOeM1zp7CMeapLk5vEtzFweCVvCH1CUTyno3TI4T2d9rCkn1xWiInXRhnk8EmP MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 4f7a0990-a986-4112-7edd-08d773847108 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Nov 2019 21:54:56.6843 (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: O6QTuZzQdIM/80N/WvENvOp41PVmMz8ALO48EzsNjBxu6ogbLfBUqTlNrDiR7pQeSh+yJ4ZAGwYdHr6OsCvYuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2477 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95, 18.0.572 definitions=2019-11-27_04:2019-11-27, 2019-11-27 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 Wed Nov 27 21:54:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 180359 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp6699793ilf; Wed, 27 Nov 2019 13:55:19 -0800 (PST) X-Google-Smtp-Source: APXvYqzq9makdn6WF239GXaRdOnJ2fHCiWhoVgTghOvHFXfkBhk9altD5+CxXfu7Ctr7Q7zZmMod X-Received: by 2002:a50:eb91:: with SMTP id y17mr34644330edr.216.1574891718976; Wed, 27 Nov 2019 13:55:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1574891718; cv=pass; d=google.com; s=arc-20160816; b=v/NifKUuv4aIXUEXNZ+01CmVYLdRE/x7UOTcd0teBuG6TlkHK+UhHAsRLuzVIxc/25 hXPVrAEk+35+TkCVaq8QI6Urlppkiy5jdepTmjbNc/SuDZQCbVLgHDHut3oGTJMwTZ0G ZxMU3IuJuTPW16yYwPvYR+81A/VoA1DjBxgjvmw5F4QBqXlmN07QD8OI+LS4PCnibkhb qfVptpqpV/C/3peKjw6bGgRP2qiPhOkJwZYeUKjmrfvI4ETzf+2CzYCj38zPZIXnntzV AZpWl+wlkd4q/4iGUkDQBkTuKNno7RgGiTgz6Od/B0cptPCTi1rKnPzn4ylBkj1UtlFM jUkQ== 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=zblNwhgK943Hgha95nwD0IXT3BeNX7wq9g2d3FpPA5Y=; b=TxysxnwXh3GTniapsUfmwGa67HLIU5Ca/8PMR07YBr6LJJ59Fo3x1NKELDGUtXtFxm zPmmvFisSFUTSVIjfzaILfOHAzpC4WuVkG1o3JLvYep9y5hs9LQwqieS2UEqmd/3J/sy W2uOHQjnWC9vu8SLvNOAIGmehppCmARDHd1EZR0zoh+gI5mL8D8mVqkCqR9p0KnGDicJ KdWPEAwMbobhSEruL2yb8Ffupza/WqoDW2O7rCVCB1U+XVeNelKSItzI/4qdTGilpJcK ArAgo9KmRyTY1rNLHIDZmm0HlfpA8abaGInjuFIQPgXM+XRVbxMykJ5fiEDRI4QyhtPb Bc3w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=bRwJa9Mi; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=ZrOMFi4H; 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 l15si11165361edb.81.2019.11.27.13.55.18; Wed, 27 Nov 2019 13:55:18 -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=bRwJa9Mi; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=ZrOMFi4H; 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 S1728078AbfK0VzP (ORCPT + 26 others); Wed, 27 Nov 2019 16:55:15 -0500 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:21434 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727900AbfK0VzJ (ORCPT ); Wed, 27 Nov 2019 16:55:09 -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 xARLnjjZ004644; Wed, 27 Nov 2019 13:55:02 -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=zblNwhgK943Hgha95nwD0IXT3BeNX7wq9g2d3FpPA5Y=; b=bRwJa9MihSWbyhJegGD9ki9+urRF1BDiHN7auzO69AVr4rmvq8t2YtftCXzULtSEF7Dw t/ApT2gvQcLcVsTakrEl+ixD8U+jp2wdfX6bOfk0of3S7bbeBa+hFu9vQFSHYHqmnyYr J22DFbjzVQyyJZQaisRZ7T4T+xz5yZI8KS9XErKf3ttn/UH8xkuHMlVpkGBBwbU3IYd0 gdXl7L8PM5keBKY8quNK0/X5Y6NVn5987PewrrVIzz9qans52A3jU6L5JB4XDI7Uq+pF 8/nF6iosZAOMX2l10TJVr71dgJvbSVWN5g7CMVvoCpifiontTpJzQ6/eZTOBugCqAwJu cg== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2whd08mrdf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 27 Nov 2019 13:55:02 -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; Wed, 27 Nov 2019 13:55:00 -0800 Received: from NAM05-DM3-obe.outbound.protection.outlook.com (104.47.49.53) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 27 Nov 2019 13:55:00 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NOuuZqBMGiQG4bfV0JLmaBILB+CAdWmyI/UzjPJSwe12IoGT+qREhaJRgPP3Yyx6IfcerFbvBpA1N4FYgO5pfTkEVga9eAotyjnqKICzVZfUqObO2g0okIIGiTZ4Z7pzAs3lVm61pkY/whT5WTnOnlkfEkz4txX+jWOxZjAtgY8U42J8uJXQENMejnIzKv4vjZIzg8phcLVxPoSgC8SY5QuC5KMIAccifrlTvGT07oskleyT6DikGZEZbv0lWo2IwFtu683/QcctBv8pJS+pI+dgH3pVuVFTRrPtoieJ0vKe2+4HWHlLPuOxoQl9+0JZDwG5mkJLRl57kWj078mFAA== 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=zblNwhgK943Hgha95nwD0IXT3BeNX7wq9g2d3FpPA5Y=; b=EqkRNO3kyWDDvQpN5Qz3wZN35jaCsDsxzi3CZGvAE0Uh/dKh0JM2+BdeXkJ6pbpAk07GRQEvRDUEAPhCohPW40owe1ANxV9MDhsTJX9K1/xxh/qDABEGHJWm7iTRvfLGXio6tTK0UDofUyk+W8mbYFfdvGV+pL9x2x6OPn2mCdqJsC+j/tAjWMjZqwRNujOeXEA/df6THWLRj6fsWxobin2FX5K4LBfGlwAS2Y9l90zwgy5EPU4rtkFAf06/eqHbGCib/dQuigwROX+LtsXUokZTU8O0TjNW7kP/SdY4TdLOCubf6JjKawHwjhPzg0Q9oq0++PUmB95DRn5JdM/82Q== 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=zblNwhgK943Hgha95nwD0IXT3BeNX7wq9g2d3FpPA5Y=; b=ZrOMFi4HHYwr9DQnePCArh+Visaa4jckd1nlD655DPkZLQcmtYGVFTK8rVoJltV4pMAY7+0dSo+8FFPCotYHZBir9ttA1D43QaAGWE42EsBdxQDjgSZr43bKdUJkVRshJl4cs9wEvMFPricLYqi+q/vuDWv9z/u7TwMh4UydEZU= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB2477.namprd18.prod.outlook.com (20.179.81.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.22; Wed, 27 Nov 2019 21:54: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.2474.023; Wed, 27 Nov 2019 21:54: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" Subject: [PATCH 07/10] EDAC/mc: Remove enable_per_layer_report function arguments Thread-Topic: [PATCH 07/10] EDAC/mc: Remove enable_per_layer_report function arguments Thread-Index: AQHVpW1PPv76c8WWxkmI+Jh3f+ItfQ== Date: Wed, 27 Nov 2019 21:54:58 +0000 Message-ID: <20191127215415.11230-8-rrichter@marvell.com> References: <20191127215415.11230-1-rrichter@marvell.com> In-Reply-To: <20191127215415.11230-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0102CA0017.eurprd01.prod.exchangelabs.com (2603:10a6:7:14::30) 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: 44a15a19-9db7-4969-dbc8-08d77384724c x-ms-traffictypediagnostic: MN2PR18MB2477: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1728; x-forefront-prvs: 023495660C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(366004)(376002)(136003)(346002)(396003)(39860400002)(189003)(199004)(14454004)(305945005)(110136005)(256004)(186003)(1076003)(4326008)(86362001)(11346002)(6436002)(8676002)(6486002)(81156014)(2906002)(81166006)(386003)(6512007)(478600001)(76176011)(54906003)(99286004)(52116002)(8936002)(25786009)(7736002)(66946007)(6116002)(26005)(316002)(66066001)(50226002)(36756003)(71190400001)(3846002)(66476007)(66556008)(64756008)(66446008)(71200400001)(102836004)(2616005)(6506007)(446003)(5660300002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2477; 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: CIinO73FivnfZreF8yKdR8jHfHl73meQMgp77b+ySpOeCURvOfPE7r0esW6rLeb66yBPEW9/OEoWYerlF/TKJRFr8Q8qqg6+7XGOqaDUQTIIH0/1zNHD1QfzMwINeLkfa0uAsMe/NEV57aHp506sqRAnUgWzfcAkhsz0EqKutgtwDDYR266yZzX3wxV/MWGcvkfmnJvzYNgXkl3nC/gEsq5fl0t0daRvZ/MEyWCKSrFXYgZE9VZicaKeunAt1ZBq/RMcibsH/+Culjkv4BqNVtkD7h2It4vRlc+BNaQWXARryPcl6oQP/bt5dtDGa3dv2NFOEs2RkNmN7cOnyWnkHhBx7bQfKyL3Gz8srphiauV06UsXoqgIA3zVxYxDQV1hVoVNCQT4qhm3C2WFHnJGl7KF/rIh7xLcPVMxqRtWzmEvDovAi4Jn0oHY19ytsFV6 MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 44a15a19-9db7-4969-dbc8-08d77384724c X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Nov 2019 21:54:58.9030 (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: z51N19HePrV86CZ3fCnQtM0VFKmgK6uLxG8VM9g5KOqxwnUmZcwbsOHSiBHl+u2vc8fIw9GZnLzXo9wouAB+2w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2477 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95, 18.0.572 definitions=2019-11-27_04:2019-11-27, 2019-11-27 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 5c1bdef30757..d441026eeb1c 100644 --- a/include/linux/edac.h +++ b/include/linux/edac.h @@ -453,8 +453,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]; @@ -471,7 +469,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 Wed Nov 27 21:55:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 180363 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp6700069ilf; Wed, 27 Nov 2019 13:55:36 -0800 (PST) X-Google-Smtp-Source: APXvYqxJgCv0AWuFW4NVwrPY9A2cgXHsHqijjAxZQZdoPlpLUd5GwgEuNzukCQWC81ZGTpwlGLgO X-Received: by 2002:a50:b626:: with SMTP id b35mr34735519ede.183.1574891735867; Wed, 27 Nov 2019 13:55:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1574891735; cv=pass; d=google.com; s=arc-20160816; b=THKSDxLtKmls0YU1z/Pfitc/bpbdg37W65G1dh0hjVPWZ+uvJ/DtYqmlL6nKuFrwuj wfr248NDmr240qA/DQl1KfI01Fv62pYwl5epP0oFXwkcMK5wAJa4A32Ro7QB3/MrTkny lUyL++qCJca9TiawXa1e/BX+Jnenqfzfc07J2DuLnFi3F2UjP8QCRCswcYEscJBvz4bs qnukENnFzLDMm/JKtGCBr6Nv8JENu3jOnwEBu8e83MLgMoFmS5RBecNe8tBF1Zr8HDGD C9MRRWl/4sq0vzalSb5CcTjylQ9SZcO66jCH62C0WtU2/czj4PjKGvXSZC+xlox2+6bw mY+Q== 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=oYLODk163Zco4vlJKQRjXYFLN52VbcVwS3B+vMY8NzO9M5GTWOCNQBxG6GY1srwPJ6 ZhEQ/JsjsKywLJbbEHGEI0Ff90WIQi6HC7FbDHWSam/64F0FzoCzX/jQWbxs6aN9Oed1 IEGHv+AgpO+BIhhYib6nW1jGLuGDSEAZV+5IZmxu/k33KDNmfAZbi4CtrOlbrPxem/S+ knuFy7OEt793oLyVDgkml6Asb4yeGPZpR7iBY5/5bMNnz2p4oMWc19scFeM66h7UJkdD fPvDvuXAnTmMm274+6m3penREV824gwpf3fEWqV80ZlbTxtbT307c7HCcmLhEHXRv38Z kQAg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=NTl8ol5a; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=C3RIqpsM; 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 r18si10132483eja.211.2019.11.27.13.55.35; Wed, 27 Nov 2019 13:55:35 -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=NTl8ol5a; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=C3RIqpsM; 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 S1728255AbfK0Vza (ORCPT + 26 others); Wed, 27 Nov 2019 16:55:30 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:47830 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727923AbfK0VzK (ORCPT ); Wed, 27 Nov 2019 16:55:10 -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 xARLpJ9a023352; Wed, 27 Nov 2019 13:55: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=g1gwTQlHy1wvorIqQq7F4OyXokTTiOv4CbtXHcDzafA=; b=NTl8ol5aR/x5J7IVYVstQMbW53Ws2+b6WzzPf2+VF/XVntddzQXbGCZrAYDO8WwOfZx5 81V9zIA2RC7X+EHJNVxtVLvZubBvegCD1FPozDBIJFvelLXNtoU5CvUhzBeNV7GVTn5s LO3556Sfp2L17nIrEYt+e8nA3h22kyLPvJe2rmWpkkVMkQGE3lFa8nev/7n6zIOO3162 BF0ZfBmwkEzYZursYWg9s+Hk9FmH2ySHZV0UG1X+q+2bajTaFz3Ic3MpAjvhaS9wye0p qxcvezvlbg/CrJi7iGuutdp0AUXxLh0MGckSyby3A4/BnvylfG6D0KWQZBF63lpFG3pq 8Q== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2whmdyb5sc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 27 Nov 2019 13:55:03 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 27 Nov 2019 13:55:02 -0800 Received: from NAM05-DM3-obe.outbound.protection.outlook.com (104.47.49.58) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 27 Nov 2019 13:55:02 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=idgsT5wmBILCq6Ynigdg/6c87TuVHE+SqCe/em35HimYRLa3MgaeAQreqrWpC5cXBVbPAVEVuxOP2BZyh1Mv34HKlzKSgznUYrN7TyIKBCqYVUHDF+VBF4oTySY1kg/hN0AJsPP1FClZpo999pxoGxqrCNVQ44AOmIARsKDuX9O5djqSjQAD1H/qjf0tDcuhdBFFzOqIgpvTGd8Km60HjAkXo+MnOX9rzmZz7+W3jeusZOVZuWQlAjVaTWa+5cj34+az5XdUetoxOUOVeNJX6Q774UvaDSSdXELWbZimViSop+IfXqGrdwIn+pIo2X0DC0+RKMjSkcSNC5Vvs0m8zg== 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=VjaWQ7Xb5vMXR2aZIP811cy79DwggxGRcV0Woh4sOGB8XnijRD/f8qBepr6xCAvVBZt+lyhS6uFW3yQ1eaGLva4Z1QwiQlVA2kiWscZvcce2KhbpNZBVqaUQyvx0Z/23Uy/sPKV3o5aNgrk84lyOeyUfDmk9Z1rVJW1dk8v+KNGmJtWibRmnHasfMq8zoGyiHV8cfDCDIcOMtWrVfBiA5OhvVFDtCGlhzF3IrbocR7vgRGAxHSDcpqU1gv1/lFcYPIopMV4nO5BXM0mydkdkrTnW4gRJthF22/WRv5Gp5ECnY2BzikViCb9pYqVlZrebNCxQeRp/BQSvoH/0RfiYBw== 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=C3RIqpsM0FD4DIADP5HAxt7F8Z2M1r10AbHBGM4+Ra0QbDiQRWZ+pQL7wl8h4AK5vMzLf/DkBNPnoXsV3YxcQkbLEV5vhJpNl/CPrAeNSf5kNfqLTz9v8FxLYNBOluEq8cZoU2D24tR9SbOqzNOwOGUODgg95rVO3GEm8iCj/2M= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB2477.namprd18.prod.outlook.com (20.179.81.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.22; Wed, 27 Nov 2019 21:55:00 +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.2474.023; Wed, 27 Nov 2019 21:55:00 +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 08/10] EDAC/mc: Pass the error descriptor to error reporting functions Thread-Topic: [PATCH 08/10] EDAC/mc: Pass the error descriptor to error reporting functions Thread-Index: AQHVpW1RM6DOVbMlwEuImzrZCxNAuA== Date: Wed, 27 Nov 2019 21:55:00 +0000 Message-ID: <20191127215415.11230-9-rrichter@marvell.com> References: <20191127215415.11230-1-rrichter@marvell.com> In-Reply-To: <20191127215415.11230-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0102CA0017.eurprd01.prod.exchangelabs.com (2603:10a6:7:14::30) 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: 10b54e80-b6b3-45bf-d263-08d773847378 x-ms-traffictypediagnostic: MN2PR18MB2477: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:439; x-forefront-prvs: 023495660C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(366004)(376002)(136003)(346002)(396003)(39860400002)(189003)(199004)(14454004)(305945005)(110136005)(256004)(186003)(1076003)(4326008)(86362001)(11346002)(6436002)(14444005)(8676002)(6486002)(81156014)(2906002)(81166006)(386003)(6512007)(478600001)(76176011)(54906003)(99286004)(52116002)(8936002)(25786009)(7736002)(66946007)(6116002)(26005)(316002)(66066001)(50226002)(36756003)(71190400001)(3846002)(66476007)(66556008)(64756008)(66446008)(71200400001)(102836004)(2616005)(6506007)(446003)(5660300002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2477; 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: qNWbAThFqA3MC00VKq3PJWXrvlOp6hkyQZPCjDEh/NYMiefXCcRbO5ZQH+45GYoa9FAre9bdgKuAKtCSagD2GOytO+yoT+7/V5jIr4okp9aVHd0BR2VW3Hcr90nFfC3RCprrcRwnmeG8CvmchdFlwmxCmK6CKZUwcn2E3r5BrK4qK0BGVWvB1d34mtNfLP0CR/DlqUhNraGAD6zhILVAK1cnvgKPU/ANk+tzRR1wsILqGeIdXRJsoL13OkLULppg2YhZoVR9LLiw9t90RvDPo2QW94ZpY10VzVOUd9KQu1WrY06TZNCaOyprRk2JTJSmEmv65cCGtdS4f+tjKgyUVhwkQWXkXWmcxxfN3RvEiw15GcnSlzFrNkfjo1ff5AnTnLtc339YL1wmqBTHoSPyGkGLI9Sk8p6W1ZNal445RJjMgIOn/BOqk+VyYBXk99gB MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 10b54e80-b6b3-45bf-d263-08d773847378 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Nov 2019 21:55:00.7858 (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: IuDcCXJzkwYbnHU41X3ImlkTm1BpadU5XzyfVotJEwwQaWuWJoL01ddD4QUd0JbXrBKZF8uh6MatzRHBkqxfvA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2477 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95, 18.0.572 definitions=2019-11-27_04:2019-11-27, 2019-11-27 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 Wed Nov 27 21:55: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: 180361 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp6699943ilf; Wed, 27 Nov 2019 13:55:28 -0800 (PST) X-Google-Smtp-Source: APXvYqwIxeibea8K3kE1iB2g0rq0eChnFEECMo8ObKSfuSdUyRscBlJ0j7yCfZ8P/+l1ILZonQNE X-Received: by 2002:a17:906:52d7:: with SMTP id w23mr4079844ejn.74.1574891728070; Wed, 27 Nov 2019 13:55:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1574891728; cv=pass; d=google.com; s=arc-20160816; b=ORFnQgupDOE6uU/gCkAgJC83wgBy3B30KoLkTvV0A3hcKc1N2gSFMl/mxbgURgsNLr NrLbokFg13VVzNjTKeUbyg6m3RSzwhs76vas30BjKY2ZWqJjMmA41iVfGhrlio0i2d0u Qk9aZi23oyvd5tiq2SphAEUwXYNipc0C0BsodpAvqTNWF4FLQcuiKz+7xSm9EDbu9RZA 5/jFy9bwcBj01zV4oOIpLXgA6+8zWUIZuWi00lbOGd349olpxcrgn7qaObqiTv53FPGq P0PLXpjOPLG1JlwBH6nGzq+kGMRtUN719Nvw0GX188moumg28bYAY6MuZINmM/8gN5yN ZMCA== 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=IXdpKcqd7wPMtExpkIlFPkboiqLKXOEYHRUM6VBhDFYxwFfWvXPLaCv+zWS4A9gE+8 +IdzCVKe+Q0QF/7miAuVyHu7iP/Y34PuIZkWQos+aTAFfel28dLw4CYYJPveGLYo1MKZ INygv7vblKWijiyVsxdtJUlRamyYTufXQdZWb7zyzcfUgyFqpWFwCjT8jeJOOedqAR4V DHWTqhXhRPaqD2XedFownqY0rBNy31W6b9pKJqOg7INQoC7bE1ZiE5KQCF7YlXEAUipH JIFuiJRbdeI03W41iNeQfKX0mR5RcZKVOATzZRlloZj4BNxq7bf3UXo9qCSK41G1mS2d 1yVg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=AjnZgceC; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=pXG0V4aV; 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 l24si10888902edw.352.2019.11.27.13.55.27; Wed, 27 Nov 2019 13:55:28 -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=AjnZgceC; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=pXG0V4aV; 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 S1728190AbfK0VzY (ORCPT + 26 others); Wed, 27 Nov 2019 16:55:24 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:29768 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727990AbfK0VzM (ORCPT ); Wed, 27 Nov 2019 16:55:12 -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 xARLpgUi026844; Wed, 27 Nov 2019 13:55:05 -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=AjnZgceCjsv0paP/hF67GZC5AHrT4Fj2xSp4bHZjN+XutJLqt7v0JvgFEfBbtd5cPbr5 KsQGfBOnPGr8L2PG/uWtWqIC/QseOJAP3fAY1SCqpLE+DAPZKMoxxZIr5ucYSCfaDp5B TI5ITs3B7szEVZdhh/sCm5RxqkBPJTCP89ofh9rJJIErIXSdbNaRZAuVhrX0nDk2g44M CX8tj0AXgK3zKuT9D7U/HSnVzToUXGPnqHVQ1YmEztJowrC5PTC1WBHdgRunZKbagjxX FE80PIgCkwEqXKM89KsjJaLvzGjCVLH0OdgJNm8JvtxQ6o3m+6+uYBSw6uDBgLucHT78 KQ== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2whmdyb5sg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 27 Nov 2019 13:55:05 -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; Wed, 27 Nov 2019 13:55:04 -0800 Received: from NAM05-DM3-obe.outbound.protection.outlook.com (104.47.49.58) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 27 Nov 2019 13:55:04 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jW0VX+O21nLZH9divZxsJIzecGufZnLCfQLF0Dxr1ZtTlbm4MWVuJetXJTd6hTMkdlsdk+BPJSHd3DpX2TP9LAM8w8pQMSe5aNoBoQYjpPBPozr17NhJNkLB0o0ytBVmfNjzbc5rxWCBVJIGqEc0UbDHF/VDcXSJH/nOBmek3RZd7H/5iU8ixczTVwh8uoRhYtrSngxXNldZ+o5gJu5qQC28LD9D39U77xvi3cnPPl6fRzaxFuYZwYgT6Xb53ZY558amYc/1S/sXem4jo277Up67nn0Wj4wkNrCvCjyPnx95C9vmOlJifkHRKJGeAXuLpTHoCKT74gtCaN0RuSYs3Q== 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=PF9Ow61E2XNgtMRrGw70vC5IRGda9qWqaLUa5HH6WnxndcmLaEW84ivZjsmD3NN3I4pSterCedKyxwTqyuriXF2i8ACqET/i/JYK9RUBR8Q3bEK61ow1GnaLlPVMwh/RbpvOTHLJa/gbjLV2gQGayfXwDbboDcmBvhjPiKwYcFxexbOoVpYwdHVcn4wPxQbTmS/RTjcRvbGRnr8nEtzpBKo2DbUjROdxPAd/cX85NeYH1KlD+AxNOk0/NZMZSzGDazuOjCPx44cAPmVYVqe/ynM+t60BadcqV45gBNBuBCK99vJ9Z5A2Xv/KVkS6xqE1tdJrYUDjPXIEjizcQJ1y9g== 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=pXG0V4aV+unjmFyb0tySjEEvyj/NNf9H8AzfdDTN4IrAGkimSWAsBxA8jcLCv3pbCBZwacSquuSvKJ3mLdZlVE4VM1C5PDwD63OJH746/IMbO+cOfTBvtqx0DIduyTIYeiIG+vgjF2npZbXbLfyS6KhxMuEIG5mYUGTtg4S01rE= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB3197.namprd18.prod.outlook.com (10.255.239.205) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.21; Wed, 27 Nov 2019 21:55: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.2474.023; Wed, 27 Nov 2019 21:55: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" Subject: [PATCH 09/10] EDAC/mc: Remove detail[] string and cleanup error string generation Thread-Topic: [PATCH 09/10] EDAC/mc: Remove detail[] string and cleanup error string generation Thread-Index: AQHVpW1S4eaK7Sm7SU+tRFH77sEi0A== Date: Wed, 27 Nov 2019 21:55:02 +0000 Message-ID: <20191127215415.11230-10-rrichter@marvell.com> References: <20191127215415.11230-1-rrichter@marvell.com> In-Reply-To: <20191127215415.11230-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0102CA0017.eurprd01.prod.exchangelabs.com (2603:10a6:7:14::30) 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: b7e6903d-2424-4afc-ab9d-08d773847497 x-ms-traffictypediagnostic: MN2PR18MB3197: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2331; x-forefront-prvs: 023495660C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(366004)(136003)(376002)(396003)(346002)(189003)(199004)(52116002)(3846002)(66556008)(66476007)(6436002)(36756003)(11346002)(4326008)(102836004)(386003)(6506007)(316002)(54906003)(6512007)(2616005)(6486002)(99286004)(446003)(110136005)(6116002)(86362001)(25786009)(14454004)(1076003)(478600001)(14444005)(256004)(66946007)(305945005)(7736002)(66066001)(76176011)(81156014)(8676002)(186003)(8936002)(50226002)(81166006)(2906002)(26005)(5660300002)(66446008)(64756008)(71200400001)(71190400001); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB3197; 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: KdmDfzj3GtyEL8fb3goVE96gFbezLCezg2eCLnn6hv5HV3WYQz8Hl31nc1Xann8gtJAANwT8JO1J95xOQDdMDEEPSKJuEF0Y4ABu69skeX2/ezwFbypL6k1VTIUOO2wAZETqoVhuS7sJTqqUrXLMfR4ZMPz60xxMYfA5yW9dZv+7KvoGoqIAtCk59ZrjGgNfRbbiUJiUqdBsPDhJzk2vQH2+JgK3OZzFj3HaMw4oLavTRY0EkcHD7kHH3N7YRmZUw1AN6Gu+4VKbZ+I389AcVNSZmCb0z8o0ArwjPhP4nBbcFdwUgmNox+gQ6Wc4u/x3eUB1ueW+iCE0C4bTWDjdVF33/hCOuf+PMWe4Ehl4rORDMBwx6YpxSnZ1Q5KJT+UKtE00adZRH2o/bBlmozIH8eKokpJYMTigE0Al8TXk7Xe9fIlUYJ+UHWSp2VzKYNa4 MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: b7e6903d-2424-4afc-ab9d-08d773847497 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Nov 2019 21:55:02.6927 (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: xSbZbNFmxFz95hDjFC4MQsGB1aGpJAfTvWGP98pMFeHjNrAoq5ZT7DwewkAYTb5FVuBapKddNS0xQAOF62Dd5w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3197 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95, 18.0.572 definitions=2019-11-27_04:2019-11-27, 2019-11-27 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 Wed Nov 27 21:55: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: 180360 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp6699847ilf; Wed, 27 Nov 2019 13:55:22 -0800 (PST) X-Google-Smtp-Source: APXvYqy6A12hhZ2cimdYqBi3/3qiemiw4SPr0FnvgQ4Q+SGEQN/23K4ytJOzClo+ILLHzAviXV6g X-Received: by 2002:a17:906:7c4e:: with SMTP id g14mr50857621ejp.150.1574891721974; Wed, 27 Nov 2019 13:55:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1574891721; cv=pass; d=google.com; s=arc-20160816; b=Mnm6fD1taiRi912wN0dIYkjUgGub81nFs0relbUXDP4JkY8ioSRuSG3lu/LkpFI/qu xWaGKAEK4F3muQ/6wq53hT+M7H7rxY2V1zV0r+CBe897Yt1jsepyZYMabhSf0jbI9tB1 LlEqEIPxYL+rxQnZq+oZoW0MmPwwYww0wHvlsya1N0Ew8ptccqdC7FRRup8bu+OwlpnA HxenIwLmc2URcvixb2BVNVlwkVM/XqWMZ1TCrnteZtyhXB6ZIunjlM/KsSjN6t/jlXWa MhbO2LuDIR+bypnqUOhwh6ZXf4FKxQ+c0Sa+ggC54x+yeYAOaRNY/oCf0VFG6uwV+czO Zt2A== 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=InJ5N6vRnP5n3sIEIV8kG7wCRQpHrDln1wBQos3mQ9Y=; b=y2hXz76yKFoN8wWLQ/WNX8FUPRw1zSGiKV9loLT5orwD8nezaFV44qGNrfFpQUPUHF nYpr4d+bzcIEE4JHm3K+/cJpqE3Jbcgb9Ez4xJWGVKi5bv62t6/+H5A1CrIRS7Jh94U2 WDbnXKR7w52szA3Ulo0Z/kYYtf+XzhFtNh/M6MSMrEvjuP0aQCswpVQukPc5eXVop2oZ e5ONiX4oZW767kk/4LiuvyYAclFwfIBfKYd47CiuWAoBN5r+Itp3ZwH46LfrNiyuvI4T FxQbGNpFneWU2da0AsAy5W9vQh4CtCfFL0b8866G7hmUqha2IfzhezaSFFJzs1mEJu3v hh3A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=MMXW1nXt; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=h5kplN4n; 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 r5si597359eja.414.2019.11.27.13.55.21; Wed, 27 Nov 2019 13:55: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=MMXW1nXt; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-onmicrosoft-com header.b=h5kplN4n; 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 S1728141AbfK0VzS (ORCPT + 26 others); Wed, 27 Nov 2019 16:55:18 -0500 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:1364 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728027AbfK0VzO (ORCPT ); Wed, 27 Nov 2019 16:55:14 -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 xARLo1ga005174; Wed, 27 Nov 2019 13:55:08 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=InJ5N6vRnP5n3sIEIV8kG7wCRQpHrDln1wBQos3mQ9Y=; b=MMXW1nXt8xoU2p6vbIdOp8FyUZcbHAhfHT+69Y/7Tk4DDLxOtxfl52SFjhK+ylQyTLqo kKYPBhh87+Mq5C4c/O7yrSd9EF0luLqgB2OeQna7WFmA4HlA5vte1gCyuyUuYS7R7p9y mnRUmaEjf8HE/jEZfAKQbc0kmzyhpOZJEMbikpFyHn2h7U186wxERdtq2XWxgropA3t8 mGTLnb062lxCxGDIgoKdi+Nk1CXZ+7A4O9ZqHhbPN82I1Hqz3drkiAyiXh6qbKMSyZ5q Yy5+x+dbcoyuqPi+i3NOPjEF9Ga2n75Tr0xyh0Ncey9KgXpDwhuA9rMMlzyfaj5Iu7SJ cw== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2whd08mre9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 27 Nov 2019 13:55:08 -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; Wed, 27 Nov 2019 13:55:06 -0800 Received: from NAM05-DM3-obe.outbound.protection.outlook.com (104.47.49.57) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 27 Nov 2019 13:55:06 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=geNSD0etXjNVmaRc6PofxH2ofvpm1MsEmfuhqFz7QbobH28b2I8ZBiNPkvAqdHtdfodRnYPUxPWqe5px4/8BIRbD37SowRX/UJSfHX6uEAgloFYwAF/TFY5vYgB//jYaoPFhcCqhCAq8N6oeIotXqgo/ZNU3SP5gviv7HCNThI0QoyrI7dbIko5d17Wwf/3q5zq1ZyxKAv+I/wzpNxnfFsD9m4hCb77FMmW+JbLkycXWTg19zo+XBxh51K8QZmylK42ikQdQNysVgb/1YMNRaJuHC8C4sOYvubGtTaWduKTWFsciq8lS0CGj5VrpSXIV8/M2Nuj7vR8b51/OOmkhiA== 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=InJ5N6vRnP5n3sIEIV8kG7wCRQpHrDln1wBQos3mQ9Y=; b=nT2gQay5rdBVZ+sLYAUIFkOADzmMAYvsmhH1gy2twNouM9bHjD8FY+sEzgi18rlumn5sAXj4urYwNt38ZAK0iAd+22CVN5u28Xa+DzpDl/Aci1PXz+vMoC39CkHgbsuLJ7dT3PEuLA3zDxkwvbqvJFjc2WlEVdLVlKRJzupOUK/8AZRiUe8WShEhgdD13zi6bKo+ix/GzN9D+/k4w3Zz5JBTJwHqqu3zMwma+oZac6hcawlPerldgoBnU0J7b0ahgPj0OiW4ELcNW/cBmcqj6Y0XqAjoh99noO5TL0OLE85F3LRNsVgvWQSrN0oL8Ya2vZCzYSGrSsZnRWE4SyKXVQ== 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=InJ5N6vRnP5n3sIEIV8kG7wCRQpHrDln1wBQos3mQ9Y=; b=h5kplN4nhQ9+eKJSjFM8z1XJiByclrDRsKQ8YBd2gx7TCBYOIOMaSNcf69ERI90J+r48xXkwmoSasrCmD918zOdKCviBXd9zBpqR7hA/n8oKmAPf0eyXZGLskTXhB5R9dX8SircOZnl79QKvKPxkkY9ARZ53dRjEXjYurqapTbY= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.237.10) by MN2PR18MB3197.namprd18.prod.outlook.com (10.255.239.205) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.21; Wed, 27 Nov 2019 21:55: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.2474.023; Wed, 27 Nov 2019 21:55:04 +0000 From: Robert Richter To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck CC: James Morse , Robert Richter , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH 10/10] EDAC/mc: Remove per layer counters Thread-Topic: [PATCH 10/10] EDAC/mc: Remove per layer counters Thread-Index: AQHVpW1T0iJ1g8BX90a0UOYHABW8HQ== Date: Wed, 27 Nov 2019 21:55:04 +0000 Message-ID: <20191127215415.11230-11-rrichter@marvell.com> References: <20191127215415.11230-1-rrichter@marvell.com> In-Reply-To: <20191127215415.11230-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0102CA0017.eurprd01.prod.exchangelabs.com (2603:10a6:7:14::30) 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: c6ea83aa-a3bc-423f-3410-08d7738475da x-ms-traffictypediagnostic: MN2PR18MB3197: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2089; x-forefront-prvs: 023495660C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(366004)(136003)(376002)(396003)(346002)(189003)(199004)(52116002)(3846002)(66556008)(66476007)(6436002)(36756003)(11346002)(4326008)(102836004)(386003)(6506007)(316002)(54906003)(6512007)(2616005)(6486002)(99286004)(446003)(110136005)(6116002)(86362001)(25786009)(14454004)(1076003)(478600001)(256004)(66946007)(305945005)(7736002)(66066001)(76176011)(81156014)(8676002)(186003)(8936002)(50226002)(81166006)(2906002)(26005)(5660300002)(66446008)(64756008)(71200400001)(71190400001); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB3197; 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: Oil/lCuQJkOrsauDaxiFzWZEts33fPfLVCvSDW52geveLUQC7eQt3ftv/BisXqxzOtynE8S33NNzmFY8bciSAhfXG+PwVob/auXwuEZZdl5AX454Ika3hYYuJc4+WwgzABUalFR/n/WUKkCZvZJKi0/uJcZb883ZY6I6ClGjkJJEshMF7tub9i4rDHWzYQRtZF9s17aElL4l3ue5sdb5ZXOtKapmurzC/qUH8GpURhZMu4uwx6hmA2bqXkKu24TMCz++m1XGJOt3p7hYE3OD+mIcieq0Bhsoj+3653Imo1LL8dT+8PtgvqYdGqG9BomzCH8qiB9IhkLGViK/1GjUCwyhLUO7wURna+2sTSHZE0fZ1SVY3Mi/zMwoTmlKb65qhKFUyCqLF2XbYPpe3uqul6VcfbxQx1yArXv9RIXyplzfviqJ8cH0JKfailXdzJYf MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: c6ea83aa-a3bc-423f-3410-08d7738475da X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Nov 2019 21:55:04.7605 (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: dX9KCRmSEtjL97SYIoX1wztixqrmsG2GzYz3b2Sd8X67m79ZSwYnFXPjUAbEAcF8E1z6VvhGRCqEyJkc6nSQ9A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3197 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95, 18.0.572 definitions=2019-11-27_04:2019-11-27, 2019-11-27 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 d441026eeb1c..76e2c099463b 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; }; /** @@ -558,7 +561,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;