All of lore.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@amd64.org>
To: Tony Luck <tony.luck@intel.com>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Chen Gong <gong.chen@linux.intel.com>,
	"Huang, Ying" <ying.huang@intel.com>,
	Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Subject: Re: [PATCH 2/2] x86/mce: Add quirk for instruction recovery on Sandy Bridge processors
Date: Fri, 20 Jul 2012 14:18:48 +0200	[thread overview]
Message-ID: <20120720121848.GA29183@aftab.osrc.amd.com> (raw)
In-Reply-To: <180a06f3f357cf9f78259ae443a082b14a29535b.1342723082.git.tony.luck@intel.com>

On Thu, Jul 19, 2012 at 11:28:46AM -0700, Tony Luck wrote:
> Sandy Bridge processors follow the SDM (Vol 3B, Table 15-20) and set
> both the RIPV and EIPV bits in the MCG_STATUS register to zero for
> machine checks during instruction fetch. This is more than a little
> counter-intuitive and means that Linux cannot recover from these
> errors. Rather than insert special case code at several places in mce.c
> and mce-severity.c, we pretend the EIPV bit was set for just this case
> early in processing the machine check.
> 
> Signed-off-by: Tony Luck <tony.luck@intel.com>

Looks ok, just minor nitpick below.

> ---
>  arch/x86/kernel/cpu/mcheck/mce.c | 43 +++++++++++++++++++++++++++++++++++++---
>  1 file changed, 40 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
> index da27c5d..e65e738 100644
> --- a/arch/x86/kernel/cpu/mcheck/mce.c
> +++ b/arch/x86/kernel/cpu/mcheck/mce.c
> @@ -102,6 +102,8 @@ DEFINE_PER_CPU(mce_banks_t, mce_poll_banks) = {
>  
>  static DEFINE_PER_CPU(struct work_struct, mce_work);
>  
> +static void (*quirk_no_way_out)(int bank, struct mce *m, struct pt_regs *regs);
> +
>  /*
>   * CPU/chipset specific EDAC code can register a notifier call here to print
>   * MCE errors in a human-readable form.
> @@ -649,14 +651,18 @@ EXPORT_SYMBOL_GPL(machine_check_poll);
>   * Do a quick check if any of the events requires a panic.
>   * This decides if we keep the events around or clear them.
>   */
> -static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp)
> +static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp,
> +			  struct pt_regs *regs)
>  {
>  	int i, ret = 0;
>  
>  	for (i = 0; i < banks; i++) {
>  		m->status = mce_rdmsrl(MSR_IA32_MCx_STATUS(i));
> -		if (m->status & MCI_STATUS_VAL)
> +		if (m->status & MCI_STATUS_VAL) {
>  			__set_bit(i, validp);
> +			if (quirk_no_way_out)
> +				quirk_no_way_out(i, m, regs);

Maybe define a default empty quirk_no_way_out() on the remaining
families/vendors so that the compiler can optimize it away and we save
ourselves the if-test?

-- 
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
GM: Alberto Bozzo
Reg: Dornach, Landkreis Muenchen
HRB Nr. 43632 WEEE Registernr: 129 19551

  reply	other threads:[~2012-07-20 12:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-19 18:38 [PATCH 0/2] Fix machine check recovery for instruction fault on Sandy Bridge Tony Luck
2012-07-19 18:21 ` [PATCH 1/2] x86/mce: Move MCACOD defines from mce-severity.c to <asm/mce.h> Tony Luck
2012-07-19 18:28 ` [PATCH 2/2] x86/mce: Add quirk for instruction recovery on Sandy Bridge processors Tony Luck
2012-07-20 12:18   ` Borislav Petkov [this message]
2012-07-20 16:33     ` Tony Luck
2012-07-21 12:45       ` Borislav Petkov
2012-07-23 16:11         ` Luck, Tony
  -- strict thread matches above, loose matches on Subject: below --
2012-07-23 21:21 [PATCH 0/2] Fix machine check recovery for instruction fault on Sandy Bridge Tony Luck
2012-07-19 18:28 ` [PATCH 2/2] x86/mce: Add quirk for instruction recovery on Sandy Bridge processors Tony Luck

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=20120720121848.GA29183@aftab.osrc.amd.com \
    --to=bp@amd64.org \
    --cc=gong.chen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=seto.hidetoshi@jp.fujitsu.com \
    --cc=tony.luck@intel.com \
    --cc=ying.huang@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.