linux-edac.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert Richter <rrichter@marvell.com>
To: Borislav Petkov <bp@alien8.de>
Cc: James Morse <james.morse@arm.com>,
	"linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Toshi Kani <toshi.kani@hpe.com>
Subject: Re: [PATCH] EDAC, ghes: Fix grain calculation
Date: Fri, 14 Jun 2019 08:39:01 +0000	[thread overview]
Message-ID: <20190614083853.zsh7jycfnp5dnj2l@rric.localdomain> (raw)
In-Reply-To: <20190614072139.vzet6t5erl6uz6st@rric.localdomain>

On 14.06.19 09:21:39, Robert Richter wrote:
> Correct for edac_mc is:
> 
>  grain_bits = fls_long(e->grain ? e->grain - 1 : 0);

I have this fix in mind + patch 11/21 (unify trace_mc_event() code) on
top which merges ghes_edac and edac_mc:

diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index 64922c8fa7e3..0f8d983dd35f 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -1236,7 +1236,7 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type,
 		*(p - 1) = '\0';
 
 	/* Report the error via the trace interface */
-	grain_bits = fls_long(e->grain) + 1;
+	grain_bits = fls_long(e->grain ? e->grain - 1 : 0);
 
 	if (IS_ENABLED(CONFIG_RAS))
 		trace_mc_event(type, e->msg, e->label, e->error_count,
diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c
index 7f19f1c672c3..ee65ff43ab6a 100644
--- a/drivers/edac/ghes_edac.c
+++ b/drivers/edac/ghes_edac.c
@@ -317,7 +317,7 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err)
 
 	/* Error grain */
 	if (mem_err->validation_bits & CPER_MEM_VALID_PA_MASK)
-		e->grain = ~(mem_err->physical_addr_mask & ~PAGE_MASK);
+		e->grain = ~mem_err->physical_addr_mask + 1;
 
 	/* Memory error location, mapped on e->location */
 	p = e->location;
@@ -434,7 +434,7 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err)
 		*(p - 1) = '\0';
 
 	/* Generate the trace event */
-	grain_bits = fls_long(e->grain);
+	grain_bits = fls_long(e->grain ? e->grain - 1 : 0);
 	snprintf(pvt->detail_location, sizeof(pvt->detail_location),
 		 "APEI location: %s %s", e->location, e->other_detail);
 	trace_mc_event(type, e->msg, e->label, e->error_count,


-Robert

  reply	other threads:[~2019-06-14  8:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-29 15:22 [PATCH] EDAC, ghes: Fix grain calculation James Morse
2019-05-30 16:50 ` Kani, Toshi
2019-06-12  4:34 ` Borislav Petkov
2019-06-13 17:06   ` James Morse
2019-06-13 19:18     ` Borislav Petkov
2019-06-13 21:07       ` Robert Richter
2019-06-13 22:41         ` Borislav Petkov
2019-06-14  7:21           ` Robert Richter
2019-06-14  8:39             ` Robert Richter [this message]
2019-06-14 10:09             ` Borislav Petkov
2019-06-14 14:40               ` Robert Richter
2019-06-14 15:06                 ` Borislav Petkov
2019-06-14  6:32         ` Robert Richter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190614083853.zsh7jycfnp5dnj2l@rric.localdomain \
    --to=rrichter@marvell.com \
    --cc=bp@alien8.de \
    --cc=james.morse@arm.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=toshi.kani@hpe.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).