Linux EDAC development
 help / color / mirror / Atom feed
* [PATCH 1/1] EDAC/igen6: Fix the flood of invalid error reports
@ 2025-02-12  8:33 Qiuxu Zhuo
  2025-02-12 12:08 ` [PATCH] " Markus Elfring
  2025-02-21  1:14 ` [PATCH 1/1] " Luck, Tony
  0 siblings, 2 replies; 4+ messages in thread
From: Qiuxu Zhuo @ 2025-02-12  8:33 UTC (permalink / raw)
  To: Tony Luck
  Cc: Qiuxu Zhuo, Borislav Petkov, James Morse, Mauro Carvalho Chehab,
	Robert Richter, Ramses, John, linux-edac, linux-kernel

The ECC_ERROR_LOG register of certain SoCs may contain the invalid value
~0, which results in a flood of invalid error reports in polling mode.

Fix the flood of invalid error reports by skipping the invalid ECC error
log value ~0.

Fixes: e14232afa944 ("EDAC/igen6: Add polling support")
Reported-by: Ramses <ramses@well-founded.dev>
Closes: https://lore.kernel.org/all/OISL8Rv--F-9@well-founded.dev/
Tested-by: Ramses <ramses@well-founded.dev>
Reported-by: John <therealgraysky@proton.me>
Closes: https://lore.kernel.org/all/p5YcxOE6M3Ncxpn2-Ia_wCt61EM4LwIiN3LroQvT_-G2jMrFDSOW5k2A9D8UUzD2toGpQBN1eI0sL5dSKnkO8iteZegLoQEj-DwQaMhGx4A=@proton.me/
Tested-by: John <therealgraysky@proton.me>
Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
---
 drivers/edac/igen6_edac.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/edac/igen6_edac.c b/drivers/edac/igen6_edac.c
index fdf3a84fe698..595908af9e5c 100644
--- a/drivers/edac/igen6_edac.c
+++ b/drivers/edac/igen6_edac.c
@@ -785,13 +785,22 @@ static u64 ecclog_read_and_clear(struct igen6_imc *imc)
 {
 	u64 ecclog = readq(imc->window + ECC_ERROR_LOG_OFFSET);
 
-	if (ecclog & (ECC_ERROR_LOG_CE | ECC_ERROR_LOG_UE)) {
-		/* Clear CE/UE bits by writing 1s */
-		writeq(ecclog, imc->window + ECC_ERROR_LOG_OFFSET);
-		return ecclog;
-	}
+	/*
+	 * Quirk: The ECC_ERROR_LOG register of certain SoCs may contain
+	 *        the invalid value ~0. This will result in a flood of invalid
+	 *        error reports in polling mode. Skip it.
+	 */
+	if (ecclog == ~0)
+		return 0;
 
-	return 0;
+	/* Neither a CE nor a UE. Skip it.*/
+	if (!(ecclog & (ECC_ERROR_LOG_CE | ECC_ERROR_LOG_UE)))
+		return 0;
+
+	/* Clear CE/UE bits by writing 1s */
+	writeq(ecclog, imc->window + ECC_ERROR_LOG_OFFSET);
+
+	return ecclog;
 }
 
 static void errsts_clear(struct igen6_imc *imc)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] EDAC/igen6: Fix the flood of invalid error reports
  2025-02-12  8:33 [PATCH 1/1] EDAC/igen6: Fix the flood of invalid error reports Qiuxu Zhuo
@ 2025-02-12 12:08 ` Markus Elfring
  2025-02-12 13:44   ` Zhuo, Qiuxu
  2025-02-21  1:14 ` [PATCH 1/1] " Luck, Tony
  1 sibling, 1 reply; 4+ messages in thread
From: Markus Elfring @ 2025-02-12 12:08 UTC (permalink / raw)
  To: Qiuxu Zhuo, linux-edac, Tony Luck
  Cc: LKML, Borislav Petkov, James Morse, John Audia,
	Mauro Carvalho Chehab, ramses, Robert Richter

…
> +++ b/drivers/edac/igen6_edac.c
> @@ -785,13 +785,22 @@ static u64 ecclog_read_and_clear(struct igen6_imc *imc)
>  {
> +	if (ecclog == ~0)
> +	if (!(ecclog & (ECC_ERROR_LOG_CE | ECC_ERROR_LOG_UE)))
…

May these condition checks be combined without repeating the statement “return 0;”?

Regards,
Markus

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] EDAC/igen6: Fix the flood of invalid error reports
  2025-02-12 12:08 ` [PATCH] " Markus Elfring
@ 2025-02-12 13:44   ` Zhuo, Qiuxu
  0 siblings, 0 replies; 4+ messages in thread
From: Zhuo, Qiuxu @ 2025-02-12 13:44 UTC (permalink / raw)
  To: Markus Elfring, linux-edac@vger.kernel.org, Luck, Tony
  Cc: LKML, Borislav Petkov, James Morse, John Audia,
	Mauro Carvalho Chehab, ramses@well-founded.dev, Robert Richter

> From: Markus Elfring <Markus.Elfring@web.de>
> [...]
> > @@ -785,13 +785,22 @@ static u64 ecclog_read_and_clear(struct
> > igen6_imc *imc)  {
> …
> > +	if (ecclog == ~0)
> …
> > +	if (!(ecclog & (ECC_ERROR_LOG_CE | ECC_ERROR_LOG_UE)))
> …
> 
> May these condition checks be combined without repeating the statement
> “return 0;”?

Thanks for the suggestion. Yes.
However, I think that using separate "return 0" statements makes the
code more readable.

-Qiuxu

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] EDAC/igen6: Fix the flood of invalid error reports
  2025-02-12  8:33 [PATCH 1/1] EDAC/igen6: Fix the flood of invalid error reports Qiuxu Zhuo
  2025-02-12 12:08 ` [PATCH] " Markus Elfring
@ 2025-02-21  1:14 ` Luck, Tony
  1 sibling, 0 replies; 4+ messages in thread
From: Luck, Tony @ 2025-02-21  1:14 UTC (permalink / raw)
  To: Qiuxu Zhuo
  Cc: Borislav Petkov, James Morse, Mauro Carvalho Chehab,
	Robert Richter, Ramses, John, linux-edac, linux-kernel

On Wed, Feb 12, 2025 at 04:33:54PM +0800, Qiuxu Zhuo wrote:
> The ECC_ERROR_LOG register of certain SoCs may contain the invalid value
> ~0, which results in a flood of invalid error reports in polling mode.
> 
> Fix the flood of invalid error reports by skipping the invalid ECC error
> log value ~0.
> 
> Fixes: e14232afa944 ("EDAC/igen6: Add polling support")
> Reported-by: Ramses <ramses@well-founded.dev>
> Closes: https://lore.kernel.org/all/OISL8Rv--F-9@well-founded.dev/
> Tested-by: Ramses <ramses@well-founded.dev>
> Reported-by: John <therealgraysky@proton.me>
> Closes: https://lore.kernel.org/all/p5YcxOE6M3Ncxpn2-Ia_wCt61EM4LwIiN3LroQvT_-G2jMrFDSOW5k2A9D8UUzD2toGpQBN1eI0sL5dSKnkO8iteZegLoQEj-DwQaMhGx4A=@proton.me/
> Tested-by: John <therealgraysky@proton.me>
> Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>

Applied to RAS tree edac-drivers branch

Thanks

-Tony

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-02-21  1:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-12  8:33 [PATCH 1/1] EDAC/igen6: Fix the flood of invalid error reports Qiuxu Zhuo
2025-02-12 12:08 ` [PATCH] " Markus Elfring
2025-02-12 13:44   ` Zhuo, Qiuxu
2025-02-21  1:14 ` [PATCH 1/1] " Luck, Tony

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox