Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp785602ybp; Fri, 11 Oct 2019 04:27:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqzeXdmDOhciJfTLuXyL5Pj0JX5Jx1EzM1UhTr32QwYMN0bdZ5gXcprsCiKLbZZDIpvGSiyV X-Received: by 2002:a17:906:7202:: with SMTP id m2mr13003210ejk.138.1570793238897; Fri, 11 Oct 2019 04:27:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570793238; cv=none; d=google.com; s=arc-20160816; b=Q70vAwgVbDWd3rLX/U9Y0kvPF9Qv8zc/znfxSYJT2rESUaMCSRT8DDYGZdKbaPmrQ1 8hMo3vxJqed2L3w+jNEBNrxAxQ4mtiE41IjUXWoB0Q9QrvzF7fxtuJbqdy/AEdRJdFzt zg9UmajlnrQJX0+KP/WaaljUrHzv5xJYSq+wWv6fjx4Hgok4219+z4qrpDT62IFN4t3u AP90yPio8bsZQmfRSSAXeOznbAgZIJVO52L/hkPGiJpHZEePn1r5o4KazTMC/Z03+fRe ZFGXGLtRYLO6gUv2HnN4ER8IWwGuoCbXt/LeuMCgHpzOYbAsfJwOTL9kREkda/44a/Pb jSxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=dsaS+us45ZwRJKtxMVnmPBirfa55ePd+K+QsxKfNims=; b=GPE308iBzwBvENjN0u6dkp0n+PsnyIFAKhodBw9UZJ8ZZ7XmToMoBxJpqMjEMs3R9X 7kY5SVQ27c3CJcBIZLg0eS5o+isjRQOGXsBzAYeyYULtxvVb3hpXDs++zHvKz+SiFqE+ Ntg9q1LdZ2zzEuRyvoSxHZ+b+iBiYZDjjXQOUsg7sa0yjUJFZ6T1FHPNUnp6jzimcQId WfsrIDPHdj7hn72G2Af2w5DGtbwLVIE8JMcgZMqEiiugbF3h96qsHEpLbO/+uIo/VsE0 mYGK61dj0H2SXEX3p0vce6p4m0SdD5LUsoDNCqqDTDVZ4v2AWAGcrcDGs+RZSSKCunMx EF0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=M+9x6KXT; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t16si5415769edd.269.2019.10.11.04.26.55; Fri, 11 Oct 2019 04:27:18 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=M+9x6KXT; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728120AbfJKLXc (ORCPT + 99 others); Fri, 11 Oct 2019 07:23:32 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:33936 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727226AbfJKLXb (ORCPT ); Fri, 11 Oct 2019 07:23:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Sender:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=dsaS+us45ZwRJKtxMVnmPBirfa55ePd+K+QsxKfNims=; b=M+9x6KXTQEC5pNJJj0PEEnCT/ eNIz6yP2H1CP+41JaDqT7OsU2Eb1V2OH3aHcm2ad+cq5Ngpm7/86a1NUu8PKg+DXifsJR1+tSJ3Ka d38fDJxg26jGxYsLkTAeSjb8UkdHAprao45qOZbKQkT6hgd12Y7XX/bjcvsU86qdu8oB+iT/n6HpM 6VGEWRnj5PEpb4fD8O+X8NMc34cm37//Lnh5Kl6ruvgKxmPO6uCEXyVcfxffW+d9aFUmmqCrRw82p 5Cgbo+c/cTsKjiZ+WTga6mpQpZv6Ey5ozpnNF90+SVugIhn553oC4RM/oq4JzlFG5qhLpLo0Ejxx4 jbhuYH0Ww==; Received: from 177.17.141.107.dynamic.adsl.gvt.net.br ([177.17.141.107] helo=coco.lan) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iIt16-00009Y-1q; Fri, 11 Oct 2019 11:23:28 +0000 Date: Fri, 11 Oct 2019 08:23:24 -0300 From: Mauro Carvalho Chehab To: Robert Richter Cc: Borislav Petkov , Tony Luck , James Morse , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 18/19] EDAC, ghes: Unify trace_mc_event() code with edac_mc driver Message-ID: <20191011082324.4289a2d2@coco.lan> In-Reply-To: <20191010202418.25098-19-rrichter@marvell.com> References: <20191010202418.25098-1-rrichter@marvell.com> <20191010202418.25098-19-rrichter@marvell.com> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, 10 Oct 2019 20:25:40 +0000 Robert Richter escreveu: > The code in ghes_edac.c and edac_mc.c for grain_bits calculation and > calling trace_mc_event() is now the same. Move it to a single location > in edac_raw_mc_handle_error(). > > The only difference is the missing IS_ENABLED(CONFIG_RAS) switch, but > this is needed for ghes too. > > Signed-off-by: Robert Richter Reviewed-by: Mauro Carvalho Chehab > --- > drivers/edac/edac_mc.c | 30 +++++++++++++++--------------- > drivers/edac/ghes_edac.c | 13 ------------- > 2 files changed, 15 insertions(+), 28 deletions(-) > > diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c > index 3779204c0e21..e6c6e40dc760 100644 > --- a/drivers/edac/edac_mc.c > +++ b/drivers/edac/edac_mc.c > @@ -1070,6 +1070,21 @@ 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. */ > + 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(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 (e->type == HW_EVENT_ERR_CORRECTED) { > @@ -1110,7 +1125,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; > bool any_memory = true; > > @@ -1242,20 +1256,6 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, > if (p > e->location) > *(p - 1) = '\0'; > > - /* Sanity-check driver-supplied grain value. */ > - if (WARN_ON_ONCE(!e->grain)) > - e->grain = 1; > - > - grain_bits = fls_long(e->grain - 1); > - > - /* Report the error via the trace interface */ > - if (IS_ENABLED(CONFIG_RAS)) > - trace_mc_event(type, e->msg, e->label, e->error_count, > - mci->mc_idx, e->top_layer, e->mid_layer, > - e->low_layer, > - (e->page_frame_number << PAGE_SHIFT) | e->offset_in_page, > - grain_bits, e->syndrome, e->other_detail); > - > dimm = edac_get_dimm(mci, top_layer, mid_layer, low_layer); > > edac_raw_mc_handle_error(e, dimm); > diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c > index 8d9d3c4dbebb..17d5b22fe000 100644 > --- a/drivers/edac/ghes_edac.c > +++ b/drivers/edac/ghes_edac.c > @@ -198,7 +198,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; > @@ -430,18 +429,6 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) > if (p > pvt->other_detail) > *(p - 1) = '\0'; > > - /* Sanity-check driver-supplied grain value. */ > - if (WARN_ON_ONCE(!e->grain)) > - e->grain = 1; > - > - grain_bits = fls_long(e->grain - 1); > - > - /* Generate the trace event */ > - trace_mc_event(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); > - > dimm = edac_get_dimm_by_index(mci, e->top_layer); > > edac_raw_mc_handle_error(e, dimm); Thanks, Mauro