public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yazen Ghannam <yazen.ghannam@amd.com>
To: Borislav Petkov <bp@alien8.de>
Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
	tony.luck@intel.com, x86@kernel.org, avadhut.naik@amd.com,
	john.allen@amd.com
Subject: Re: [PATCH 4/9] x86/mce: Move machine_check_poll() status checks to helper functions
Date: Fri, 26 Jul 2024 10:00:30 -0400	[thread overview]
Message-ID: <20240726140030.GA193170@yaz-khff2.amd.com> (raw)
In-Reply-To: <20240603173727.GOZl3_V9eVbm0184Wi@fat_crate.local>

On Mon, Jun 03, 2024 at 07:37:27PM +0200, Borislav Petkov wrote:
> On Thu, May 23, 2024 at 10:56:36AM -0500, Yazen Ghannam wrote:
> > @@ -709,48 +747,9 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)
> >  		if (!mca_cfg.cmci_disabled)
> >  			mce_track_storm(&m);
> >  
> > -		/* If this entry is not valid, ignore it */
> > -		if (!(m.status & MCI_STATUS_VAL))
> > +		if (!log_poll_error(flags, &m))
> >  			continue;
> >  
> > -		/*
> > -		 * If we are logging everything (at CPU online) or this
> > -		 * is a corrected error, then we must log it.
> > -		 */
> > -		if ((flags & MCP_UC) || !(m.status & MCI_STATUS_UC))
> > -			goto log_it;
> > -
> > -		/*
> > -		 * Newer Intel systems that support software error
> > -		 * recovery need to make additional checks. Other
> > -		 * CPUs should skip over uncorrected errors, but log
> > -		 * everything else.
> > -		 */
> 
> You lost that comment.
> 

Sorry, will keep it.

> > -		if (!mca_cfg.ser) {
> > -			if (m.status & MCI_STATUS_UC)
> > -				continue;
> > -			goto log_it;
> > -		}
> > -
> > -		/* Log "not enabled" (speculative) errors */
> > -		if (!(m.status & MCI_STATUS_EN))
> > -			goto log_it;
> > -
> > -		/*
> > -		 * Log UCNA (SDM: 15.6.3 "UCR Error Classification")
> > -		 * UC == 1 && PCC == 0 && S == 0
> > -		 */
> > -		if (!(m.status & MCI_STATUS_PCC) && !(m.status & MCI_STATUS_S))
> > -			goto log_it;
> > -
> > -		/*
> > -		 * Skip anything else. Presumption is that our read of this
> > -		 * bank is racing with a machine check. Leave the log alone
> > -		 * for do_machine_check() to deal with it.
> > -		 */
> > -		continue;
> > -
> > -log_it:
> >  		if (flags & MCP_DONTLOG)
> >  			goto clear_it;
> 
> Btw, the code looks really weird now:
> 
>                 if (!log_poll_error(flags, &m))
>                         continue;
> 
>                 if (flags & MCP_DONTLOG)
>                         goto clear_it;
> 
> i.e.,
> 
> 1. Should I log it?
> 
> 2. Should I not log it?
> 
> Oh well, it was like that before logically so...
>

We can rename the new function and add comments. What do you think of
the change below?

Thanks,
Yazen

@@ -797,9 +797,11 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)
		if (!mca_cfg.cmci_disabled)
			mce_track_storm(&m);

-               if (!log_poll_error(flags, &m, &status_reg))
+               /* Verify that the error should be logged based on hardware conditions. */
+               if (!loggable_poll_error(flags, &m, &status_reg))
			continue;

+               /* Clear a loggable error, e.g., one leftover from boot time. */
		if (flags & MCP_DONTLOG)
			goto clear_it;



  reply	other threads:[~2024-07-26 14:00 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-23 15:56 [PATCH 0/9] AMD MCA interrupts rework Yazen Ghannam
2024-05-23 15:56 ` [PATCH 1/9] x86/mce/inject: Only write MCA_MISC with user-set value Yazen Ghannam
2024-05-27  9:00   ` [tip: ras/core] x86/mce/inject: Only write MCA_MISC when a value has been supplied tip-bot2 for Yazen Ghannam
2024-05-23 15:56 ` [PATCH 2/9] x86/mce: Remove unused variable and return value in machine_check_poll() Yazen Ghannam
2024-05-27  9:00   ` [tip: ras/core] " tip-bot2 for Yazen Ghannam
2024-05-23 15:56 ` [PATCH 3/9] x86/mce: Increment MCP count only for timer calls Yazen Ghannam
2024-05-24 14:53   ` Borislav Petkov
2024-06-03 14:22     ` Yazen Ghannam
2024-06-03 15:24       ` Borislav Petkov
2024-05-23 15:56 ` [PATCH 4/9] x86/mce: Move machine_check_poll() status checks to helper functions Yazen Ghannam
2024-06-03 17:37   ` Borislav Petkov
2024-07-26 14:00     ` Yazen Ghannam [this message]
2024-08-01 13:04       ` Borislav Petkov
2024-05-23 15:56 ` [PATCH 5/9] x86/mce: Skip AMD threshold init if no threshold banks found Yazen Ghannam
2024-05-23 15:56 ` [PATCH 6/9] x86/mce: Unify AMD THR handler with MCA Polling Yazen Ghannam
2024-06-03 18:04   ` Borislav Petkov
2024-08-16 14:01     ` Yazen Ghannam
2024-05-23 15:56 ` [PATCH 7/9] x86/mce: Unify AMD DFR " Yazen Ghannam
2024-06-04 11:05   ` Borislav Petkov
2024-08-16 14:08     ` Yazen Ghannam
2024-06-04 11:18   ` Borislav Petkov
2024-05-23 15:56 ` [PATCH 8/9] x86/mce/amd: Enable interrupt vectors once per-CPU on SMCA systems Yazen Ghannam
2024-06-04 15:46   ` Borislav Petkov
2024-08-16 14:17     ` Yazen Ghannam
2024-05-23 15:56 ` [PATCH 9/9] x86/mce/amd: Support SMCA Corrected Error Interrupt Yazen Ghannam

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=20240726140030.GA193170@yaz-khff2.amd.com \
    --to=yazen.ghannam@amd.com \
    --cc=avadhut.naik@amd.com \
    --cc=bp@alien8.de \
    --cc=john.allen@amd.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /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