mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Ashok Raj <ashok.raj@intel.com>
Cc: linux-kernel@vger.kernel.org, linux-edac@vger.kernel.org,
	Borislav Petkov <bp@suse.de>, Tony Luck <tony.luck@intel.com>
Subject: Re: [Patch V1 2/3] x86, mce: Add infrastructure required to support LMCE
Date: Fri, 29 May 2015 19:44:39 +0200	[thread overview]
Message-ID: <20150529174439.GO31435@pd.tnic> (raw)
In-Reply-To: <1432916882-1304-3-git-send-email-ashok.raj@intel.com>

On Fri, May 29, 2015 at 09:28:01AM -0700, Ashok Raj wrote:
> Initialization and handling for LMCE
> - boot time option to disable LMCE for that boot instance
> - Check for capability via IA32_MCG_CAP
> - provide ability to enable/disable LMCE on demand.
> 
> See http://www.intel.com/sdm Volume 3 System Programming Guide, Chapter 15
> for more information on MSR's and documentation on Local MCE.
> 
> Signed-off-by: Ashok Raj <ashok.raj@intel.com>
> ---
>  Documentation/x86/x86_64/boot-options.txt |  3 ++
>  arch/x86/include/asm/mce.h                |  5 +++
>  arch/x86/kernel/cpu/mcheck/mce.c          |  3 ++
>  arch/x86/kernel/cpu/mcheck/mce_intel.c    | 75 +++++++++++++++++++++++++++++++
>  4 files changed, 86 insertions(+)

...

> +static bool lmce_supported(void)
> +{
> +	u64 cap, feature_ctl;
> +	bool lmce_bios_support, retval;
> +
> +	if (mca_cfg.lmce_disabled)
> +		return false;
> +
> +	rdmsrl(MSR_IA32_MCG_CAP, cap);
> +	rdmsrl(MSR_IA32_FEATURE_CONTROL, feature_ctl);

One more thing: You should check MCG_LMCE_P *first* and only read
MSR_IA32_FEATURE_CONTROL if MCG_LMCE_P is set - otherwise this'll start
blowing up on older machines which don't sport that new MSR and on kvm.

> +	/*
> +	 * BIOS should indicate support for LMCE by setting
> +	 * bit20 in IA32_FEATURE_CONTROL. without which touching
> +	 * MCG_EXT_CTL will generate #GP fault.
> +	 */
> +	lmce_bios_support = ((feature_ctl & (FEATURE_CONTROL_LMCE_BITS)) ==
> +			(FEATURE_CONTROL_LMCE_BITS));
> +
> +	/*
> +	 * MCG_CAP should indicate both MCG_SER_P and MCG_LMCE_P
> +	 */

Also, why do we need to look at MCG_SER_P for LMCE?

Btw, we do that already in __mcheck_cpu_cap_init() so you could check
mca_cfg.ser here instead.

> +	cap = ((cap & MCG_CAP_LMCE_BITS) == (MCG_CAP_LMCE_BITS));
> +	retval = (cap && lmce_bios_support);

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--

  parent reply	other threads:[~2015-05-29 17:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-29 16:27 [Patch V1 0/3] x86 Local Machine Check Exception (LMCE) Ashok Raj
2015-05-29 16:28 ` [Patch V1 1/3] x86, mce: Add LMCE definitions Ashok Raj
2015-05-29 16:28 ` [Patch V1 2/3] x86, mce: Add infrastructure required to support LMCE Ashok Raj
2015-05-29 17:35   ` Borislav Petkov
2015-05-29 17:44   ` Borislav Petkov [this message]
2015-06-01 17:09     ` Raj, Ashok
2015-06-01 18:48     ` Raj, Ashok
2015-06-01 19:37       ` Borislav Petkov
2015-05-29 16:28 ` [Patch V1 3/3] x86, mce: Handling LMCE events Ashok Raj
2015-05-29 17:36   ` Borislav Petkov

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=20150529174439.GO31435@pd.tnic \
    --to=bp@alien8.de \
    --cc=ashok.raj@intel.com \
    --cc=bp@suse.de \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®