From patchwork Mon Jun 24 15:09: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: 167604 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp4347303ilk; Mon, 24 Jun 2019 08:09:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqwA2GgGCwAcnkqSFc+q+tgfIYoyaG3X867Vbg6Pz0cS5uV5vJsEPKleEszFCIwkYMzfi+aj X-Received: by 2002:a65:4cce:: with SMTP id n14mr33529824pgt.246.1561388957350; Mon, 24 Jun 2019 08:09:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561388957; cv=none; d=google.com; s=arc-20160816; b=NgfcuHkmR6gly4xYfUklU9hYlEynk3MrY8MYacP92FRSyV3Fnn80x/92uFRjXwMpSL 9czjBQy3ZyQCtnmtlMSbVuPUwt/s4HfmyN2MTYjTQHBx0NWzpQVO9rc5bCmig/72DDHZ Cul0GLAXMTr2dFwzPCAt4J54BRGnRuKw0O23uHRbUO1eS+R45KOxa8C79ZNEXN0FDQzd q6FQIjpEDw9bKyTHwHliXiWfxnc9hnuSnIEhQL/sxCyr73DzRHAJrrRn+J1i1Cig3ssi YoECpj9eXIbjH9DmkBaEu53/2SIws7j4TjzylVKl9r0CbOctKrLOotfSOAs5rSzQQOKm Pirg== ARC-Message-Signature: i=1; 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=XzkIXlo2AUzfgtRQG3BbJZmCvL+GYLS9DAmwQTt4JcQ=; b=Ksep32jV+2vX0ruiXdXSvt9Hc6X72MScrh5m80QJzZirkRbbWPc7T6O40y4Ot+313m w0XokwBhIUMd1Oii8+w1Caj65uyj/tiugImBFs6alW32+xuE8GrPpv/4fHu1oxRUCjvR s3rmE25qL9exf2Z8ukR0gYrbscKq4YDZIAOjr7tfTE5DGqoHXXAmqlW2nTW01sbnztHH Q2cfnZjA33LcQmQZlmPW1amhIz2xg7fBTAEyPI+U/l2qiNx/TiR+OSJZwgMXuurDWpVV 7X+sT1F1k6F05Te8/t+8OERZw+gtcjKQFm2qa/4zQmcYnbXhSaS9ve+Z/CE8b6pynpIY nQ+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=VJeU+hYn; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector2-marvell-onmicrosoft-com header.b=pWrcx9Pr; 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 g10si10697753pjp.74.2019.06.24.08.09.16; Mon, 24 Jun 2019 08:09:17 -0700 (PDT) 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=VJeU+hYn; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector2-marvell-onmicrosoft-com header.b=pWrcx9Pr; 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 S1730466AbfFXPJP (ORCPT + 30 others); Mon, 24 Jun 2019 11:09:15 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:16188 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730401AbfFXPJL (ORCPT ); Mon, 24 Jun 2019 11:09:11 -0400 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5OF8CWL025874; Mon, 24 Jun 2019 08:09:05 -0700 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=XzkIXlo2AUzfgtRQG3BbJZmCvL+GYLS9DAmwQTt4JcQ=; b=VJeU+hYnVTavU2FKRkKJ4yZwOhTXWDBTj9pOehJBQAh4bkV1RQ4APeo+UC5SZHktWe9X UAdOh1fKDPLxId25QaAq9s5Dm+L3Lre2WuirsFKVnF70J4kTHUP0lyPh4iGAnQY9Vjn1 MBG4sxfVngaWU4NG/CTnjMPCPqyowigV4qcIWivAulnJ6zv3PCKVsCtP+zQ/XoCzMgBH /Ss51bIY7g8XlC99p0EunlLcZ3bHN2S4OihJiF5MrS2dgBNz0Eqtynz1gt1x2upAMiPA MEIoMK5/3tiyyU0RDoUyQCj/g6k5p6A/I6p45u8lvauk/p54fiIhQ9avAIT1OugGsI3u 0A== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 2t9kujf7rf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 24 Jun 2019 08:09:05 -0700 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; Mon, 24 Jun 2019 08:09:02 -0700 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.51) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Mon, 24 Jun 2019 08:09:02 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XzkIXlo2AUzfgtRQG3BbJZmCvL+GYLS9DAmwQTt4JcQ=; b=pWrcx9PrkA/2ZBj3xu8WxvGzHtkAYai4UkC5beQc7yxhhRbUZuQed+smn35T2srpWFqlkpk9lrK1Xzcs7k5of385y7aURuz0LHCYfy3UUFqpMp9xI6bHTwTHA/gB4Xsqm090wqK23zGYskwiI0JsyXG5V5B1PARVSsvVeMUaVkA= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.238.217) by MN2PR18MB3197.namprd18.prod.outlook.com (10.255.236.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.13; Mon, 24 Jun 2019 15:09:01 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::d3:794c:1b94:cf3]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::d3:794c:1b94:cf3%4]) with mapi id 15.20.2008.014; Mon, 24 Jun 2019 15:09:01 +0000 From: Robert Richter To: Borislav Petkov , James Morse , "Mauro Carvalho Chehab" CC: "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Robert Richter Subject: [PATCH v2 04/24] EDAC, ghes: Unify trace_mc_event() code with edac_mc driver Thread-Topic: [PATCH v2 04/24] EDAC, ghes: Unify trace_mc_event() code with edac_mc driver Thread-Index: AQHVKp7BHx6v+XRJ/ECy94o4MVS4fg== Date: Mon, 24 Jun 2019 15:09:00 +0000 Message-ID: <20190624150758.6695-5-rrichter@marvell.com> References: <20190624150758.6695-1-rrichter@marvell.com> In-Reply-To: <20190624150758.6695-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1P190CA0035.EURP190.PROD.OUTLOOK.COM (2603:10a6:7:52::24) To MN2PR18MB3408.namprd18.prod.outlook.com (2603:10b6:208:16c::25) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [92.254.182.202] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: dbb61737-e45a-4cd1-3bd8-08d6f8b5e361 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:MN2PR18MB3197; x-ms-traffictypediagnostic: MN2PR18MB3197: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4714; x-forefront-prvs: 007814487B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(366004)(136003)(396003)(346002)(376002)(199004)(189003)(36756003)(110136005)(107886003)(54906003)(81156014)(81166006)(68736007)(8676002)(25786009)(5660300002)(8936002)(305945005)(7736002)(4326008)(1076003)(186003)(6116002)(14454004)(476003)(486006)(2616005)(11346002)(256004)(14444005)(446003)(3846002)(50226002)(26005)(2906002)(52116002)(76176011)(71200400001)(71190400001)(99286004)(386003)(6506007)(102836004)(478600001)(316002)(86362001)(6512007)(66066001)(53936002)(6486002)(73956011)(66946007)(66476007)(66556008)(64756008)(66446008)(6436002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB3197; H:MN2PR18MB3408.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: UXqjk+nBSRtH13VjFwvtHzshExLWNqUZHSXbJIK2kdOZlYDlGtyMKUiUv47/2OcRi9wRtWQ3RGNi3TL+SluEQhZKeUVU4IReBnigTKBwrZPlKG1eHAGqZFz+GUaTuZfU/N/qSdionpIvBQdSrqxZWB+k07wK/z44oymlqSVjkJvMAcvTf+5YA+SwVduEjdjdx9/cp7d5k/TGoPURSrdivANZ0lw8LQGJ9orv8A1sycRAaa1HAHRwAoPQ2UjgBYRa/Y/t2y2//g3M8/gvgRObZy1//k8piXmJpQkBsEPgH4ds6kmi4yX6xUpEknncihoYv+NbHlr6cjZxC2vKOjoDre46k7VibeUuPtH/f9WkcCBYQbu2vXVknWHmomqLA2EXBkFPrxjmiqTR1U1aldlXoXTkGkulCVR5k1skmPWy4oc= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: dbb61737-e45a-4cd1-3bd8-08d6f8b5e361 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jun 2019 15:09:00.9801 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: rrichter@marvell.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3197 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-24_10:, , signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Duplicate code, remove it. The only difference is the missing IS_ENABLED(CONFIG_RAS) switch in ghes_edac which we will need there too. Signed-off-by: Robert Richter --- drivers/edac/edac_mc.c | 34 +++++++++++++++++----------------- drivers/edac/ghes_edac.c | 16 +--------------- 2 files changed, 18 insertions(+), 32 deletions(-) -- 2.20.1 diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index 45cac74ab833..4bbc8aeddf30 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -1056,6 +1056,23 @@ void edac_raw_mc_handle_error(const enum hw_event_mc_err_type type, { char detail[80]; int pos[EDAC_MAX_LAYERS] = { e->top_layer, e->mid_layer, e->low_layer }; + u8 grain_bits; + + /* + * We expect the hw to report a reasonable grain, fallback to + * 1 byte granularity otherwise. + */ + if (WARN_ON_ONCE(!e->grain)) + e->grain = 1; + grain_bits = fls_long(e->grain - 1); + + /* Report the error via the trace interface */ + if (IS_ENABLED(CONFIG_RAS)) + trace_mc_event(type, e->msg, e->label, e->error_count, + mci->mc_idx, e->top_layer, e->mid_layer, + e->low_layer, + (e->page_frame_number << PAGE_SHIFT) | e->offset_in_page, + grain_bits, e->syndrome, e->other_detail); /* Memory type dependent details about the error */ if (type == HW_EVENT_ERR_CORRECTED) { @@ -1095,7 +1112,6 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, int row = -1, chan = -1; int pos[EDAC_MAX_LAYERS] = { top_layer, mid_layer, low_layer }; int i, n_labels = 0; - u8 grain_bits; struct edac_raw_error_desc *e = &mci->error_desc; edac_dbg(3, "MC%d\n", mci->mc_idx); @@ -1235,22 +1251,6 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, if (p > e->location) *(p - 1) = '\0'; - /* - * We expect the hw to report a reasonable grain, fallback to - * 1 byte granularity otherwise. - */ - if (WARN_ON_ONCE(!e->grain)) - e->grain = 1; - grain_bits = fls_long(e->grain - 1); - - /* Report the error via the trace interface */ - if (IS_ENABLED(CONFIG_RAS)) - trace_mc_event(type, e->msg, e->label, e->error_count, - mci->mc_idx, e->top_layer, e->mid_layer, - e->low_layer, - (e->page_frame_number << PAGE_SHIFT) | e->offset_in_page, - grain_bits, e->syndrome, e->other_detail); - edac_raw_mc_handle_error(type, mci, e); } EXPORT_SYMBOL_GPL(edac_mc_handle_error); diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c index 049de73c3bad..bd3be25d0d3f 100644 --- a/drivers/edac/ghes_edac.c +++ b/drivers/edac/ghes_edac.c @@ -200,7 +200,6 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) struct ghes_edac_pvt *pvt = ghes_pvt; unsigned long flags; char *p; - u8 grain_bits; if (!pvt) return; @@ -436,21 +435,8 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) if (p > pvt->other_detail) *(p - 1) = '\0'; - /* - * We expect the hw to report a reasonable grain, fallback to - * 1 byte granularity otherwise. - */ - if (WARN_ON_ONCE(!e->grain)) - e->grain = 1; - grain_bits = fls_long(e->grain - 1); - - /* Generate the trace event */ - trace_mc_event(type, e->msg, e->label, e->error_count, - mci->mc_idx, e->top_layer, e->mid_layer, e->low_layer, - (e->page_frame_number << PAGE_SHIFT) | e->offset_in_page, - grain_bits, e->syndrome, e->other_detail); - edac_raw_mc_handle_error(type, mci, e); + spin_unlock_irqrestore(&ghes_lock, flags); }