public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@amd64.org>
To: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Cc: tony.luck@intel.com, andi@firstfloor.org, bp@amd64.org,
	gong.chen@linux.intel.com, x86@kernel.org,
	linux-kernel@vger.kernel.org, mingo@redhat.com,
	tglx@linutronix.de, linux-edac@vger.kernel.org
Subject: Re: [PATCH] x86: mce: Honour bios-set CMCI threshold
Date: Wed, 22 Aug 2012 14:46:49 +0200	[thread overview]
Message-ID: <20120822124649.GD5817@aftab.osrc.amd.com> (raw)
In-Reply-To: <20120822123054.29238.3864.stgit@localhost.localdomain>

On Wed, Aug 22, 2012 at 06:00:54PM +0530, Naveen N. Rao wrote:
> The ACPI spec doesn't provide for a way for the bios to pass down
> recommended thresholds to the OS on a _per-bank_ basis. This patch adds
> a new boot option, which if passed, allows bios to initialize the CMCI
> threshold. In such a case, we simply skip programming any threshold
> value.
> 
> As fail-safe, we initialize threshold to 1 if some banks have not been
> initialized by the bios and warn the user.
> 
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
> ---
>  Documentation/x86/x86_64/boot-options.txt |    5 ++++
>  arch/x86/include/asm/mce.h                |    1 +
>  arch/x86/kernel/cpu/mcheck/mce.c          |    4 +++
>  arch/x86/kernel/cpu/mcheck/mce_intel.c    |   39 +++++++++++++++++++++++++++--
>  4 files changed, 46 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/x86/x86_64/boot-options.txt b/Documentation/x86/x86_64/boot-options.txt
> index c54b4f5..ec92540 100644
> --- a/Documentation/x86/x86_64/boot-options.txt
> +++ b/Documentation/x86/x86_64/boot-options.txt
> @@ -50,6 +50,11 @@ Machine check
>  		monarchtimeout:
>  		Sets the time in us to wait for other CPUs on machine checks. 0
>  		to disable.
> +   mce=bios_cmci_threshold
> +		Don't overwrite the bios-set CMCI threshold. This boot option
> +		prevents Linux from overwriting the CMCI threshold set by the
> +		bios. Without this option, Linux always sets the CMCI
> +		threshold to 1.
>  
>     nomce (for compatibility with i386): same as mce=off
>  
> diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
> index a3ac52b..8ad5078 100644
> --- a/arch/x86/include/asm/mce.h
> +++ b/arch/x86/include/asm/mce.h
> @@ -171,6 +171,7 @@ DECLARE_PER_CPU(struct device *, mce_device);
>  #ifdef CONFIG_X86_MCE_INTEL
>  extern int mce_cmci_disabled;
>  extern int mce_ignore_ce;
> +extern int mce_bios_cmci_threshold;
>  void mce_intel_feature_init(struct cpuinfo_x86 *c);
>  void cmci_clear(void);
>  void cmci_reenable(void);
> diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
> index 292d025..401359d 100644
> --- a/arch/x86/kernel/cpu/mcheck/mce.c
> +++ b/arch/x86/kernel/cpu/mcheck/mce.c
> @@ -82,6 +82,7 @@ static int			mce_panic_timeout	__read_mostly;
>  static int			mce_dont_log_ce		__read_mostly;
>  int				mce_cmci_disabled	__read_mostly;
>  int				mce_ignore_ce		__read_mostly;
> +int				mce_bios_cmci_threshold	__read_mostly;
>  int				mce_ser			__read_mostly;

AFAICT, this is actually a single-bit flag but we're using a whole
integer for it and from looking at the other boot options a couple of
them are used as flags too.

Care to define a

struct boot_flags {
	__u64 	mce_bios_cmci_threshold : 1,
		__reserved		: 63;
};

and use

	boot_flags.mce_bios_cmci_threshold

in the conditionals below instead?

I'll try to convert the rest of them to that struct and thus save some
more space...

Thanks.

-- 
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-08-22 12:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-22 12:30 [PATCH] x86: mce: Honour bios-set CMCI threshold Naveen N. Rao
2012-08-22 12:46 ` Borislav Petkov [this message]
2012-08-23 11:56   ` Naveen N. Rao
2012-08-27  9:12     ` Borislav Petkov
2012-08-27  9:54       ` Naveen N. Rao
2012-08-23 12:08   ` Naveen N. Rao
2012-08-23 12:29     ` 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=20120822124649.GD5817@aftab.osrc.amd.com \
    --to=bp@amd64.org \
    --cc=andi@firstfloor.org \
    --cc=gong.chen@linux.intel.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=tglx@linutronix.de \
    --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