linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: "Ghannam, Yazen" <Yazen.Ghannam@amd.com>
Cc: "linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"tony.luck@intel.com" <tony.luck@intel.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"rafal@milecki.pl" <rafal@milecki.pl>,
	"clemej@gmail.com" <clemej@gmail.com>
Subject: Re: [PATCH v2 1/2] x86/MCE: Add function to allow filtering of MCA errors
Date: Fri, 22 Mar 2019 18:24:05 +0100	[thread overview]
Message-ID: <20190322172405.GJ12472@zn.tnic> (raw)
In-Reply-To: <20190321202505.5553-1-Yazen.Ghannam@amd.com>

On Thu, Mar 21, 2019 at 08:25:17PM +0000, Ghannam, Yazen wrote:
> From: Yazen Ghannam <yazen.ghannam@amd.com>
> 
> Some systems may report spurious MCA errors. In general, spurious MCA
> errors may be disabled by clearing a particular bit in MCA_CTL. However,
> clearing a bit in MCA_CTL may not be recommended for some errors, so the
> only option is to ignore them.
> 
> An MCA error is printed and handled after it has been added to the MCE
> event pool. So an MCA error can be ignored by not adding it to the pool.
> 
> Create a function pointer to filter MCA errors and use this when adding
> an error to the MCE event pool.
> 
> Install a default function that does not filter any errors.
> 
> Cc: <stable@vger.kernel.org> # 4.14.x
> Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
> ---
> Link:
> https://lkml.kernel.org/r/20190307212552.8865-1-Yazen.Ghannam@amd.com
> 
> v1->v2:
> * This is a new patch replacing V1 Patch 1 which is no longer needed.
> 
>  arch/x86/include/asm/mce.h        | 3 +++
>  arch/x86/kernel/cpu/mce/core.c    | 6 ++++++
>  arch/x86/kernel/cpu/mce/genpool.c | 3 +++
>  3 files changed, 12 insertions(+)
> 
> diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
> index 22d05e3835f0..0b0b797a959c 100644
> --- a/arch/x86/include/asm/mce.h
> +++ b/arch/x86/include/asm/mce.h
> @@ -253,6 +253,9 @@ extern void mce_disable_bank(int bank);
>  extern void (*machine_check_vector)(struct pt_regs *, long error_code);
>  void do_machine_check(struct pt_regs *, long);
>  
> +/* Filter MCEs from the decoder chain. */

That should be something like:

/* Decides whether to add MCE records to the decoder chain or filter them out. */

> +extern bool (*filter_mce)(struct mce *m);
> +
>  /*
>   * Threshold handler
>   */
> diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
> index b7fb541a4873..effb40581f08 100644
> --- a/arch/x86/kernel/cpu/mce/core.c
> +++ b/arch/x86/kernel/cpu/mce/core.c
> @@ -1771,6 +1771,12 @@ static void __mcheck_cpu_init_timer(void)
>  	mce_start_timer(t);
>  }
>  
> +/*
> + * Don't filter MCEs by default. Install a system-specific function, if needed.
> + */

That comment is kinda obvious.

> +static bool default_filter_mce(struct mce *m) { return false; }
> +bool (*filter_mce)(struct mce *) = default_filter_mce;
> +
>  /* Handle unconfigured int18 (should never happen) */
>  static void unexpected_machine_check(struct pt_regs *regs, long error_code)
>  {
> diff --git a/arch/x86/kernel/cpu/mce/genpool.c b/arch/x86/kernel/cpu/mce/genpool.c
> index 3395549c51d3..64d1d5a00f39 100644
> --- a/arch/x86/kernel/cpu/mce/genpool.c
> +++ b/arch/x86/kernel/cpu/mce/genpool.c
> @@ -99,6 +99,9 @@ int mce_gen_pool_add(struct mce *mce)
>  {
>  	struct mce_evt_llist *node;
>  
> +	if (filter_mce(mce))
> +		return -EINVAL;
> +
>  	if (!mce_evt_pool)
>  		return -EINVAL;
>  
> -- 
> 2.17.1
> 

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

  parent reply	other threads:[~2019-03-22 17:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-21 20:25 [PATCH v2 1/2] x86/MCE: Add function to allow filtering of MCA errors Ghannam, Yazen
2019-03-21 20:25 ` [PATCH v2 2/2] x86/MCE/AMD: Don't report L1 BTB MCA errors on some Family 17h models Ghannam, Yazen
2019-03-22 17:34   ` Borislav Petkov
2019-03-22 19:24     ` Ghannam, Yazen
2019-03-22 19:32       ` Borislav Petkov
2019-03-22 19:33         ` Ghannam, Yazen
2019-03-22 17:24 ` Borislav Petkov [this message]
2019-03-22 19:05   ` [PATCH v2 1/2] x86/MCE: Add function to allow filtering of MCA errors Ghannam, Yazen

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=20190322172405.GJ12472@zn.tnic \
    --to=bp@alien8.de \
    --cc=Yazen.Ghannam@amd.com \
    --cc=clemej@gmail.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafal@milecki.pl \
    --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;
as well as URLs for NNTP newsgroup(s).