From: "Jan Beulich" Subject: [PATCH] x86/MCE: allow overriding the CMCI threshold Date: Mon, 12 Jan 2015 08:44:00 +0000 Message-ID: <54B397600200007800053780@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part4673AC40.2__=" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YAabT-0005CM-Mm for xen-devel@lists.xenproject.org; Mon, 12 Jan 2015 08:44:03 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Jinsong Liu , Christoph Egger List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part4673AC40.2__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline We've had reports of systems where CMCIs would surface at a relatively high rate during certain periods of time, without them apparently causing subsequent more severe problems (see Xeon E7-8800/4800/2800 specification clarification SC1). Give the admin a knob to lower the impact on the system logs. Signed-off-by: Jan Beulich --- a/docs/misc/xen-command-line.markdown +++ b/docs/misc/xen-command-line.markdown @@ -242,6 +242,14 @@ the NMI watchdog is also enabled. =20 If set, override Xen's default choice for the platform timer. =20 +### cmci-threshold +> `=3D ` + +> Default: `2` + +Specify the event count threshold for raising Corrected Machine Check +Interrupts. Specifying zero disables CMCI handling. + ### cmos-rtc-probe > `=3D ` =20 --- a/xen/arch/x86/cpu/mcheck/mce_intel.c +++ b/xen/arch/x86/cpu/mcheck/mce_intel.c @@ -492,6 +492,9 @@ static int do_cmci_discover(int i) { unsigned msr =3D MSR_IA32_MCx_CTL2(i); u64 val; + unsigned int threshold, max_threshold; + static unsigned int cmci_threshold =3D 2; + integer_param("cmci-threshold", cmci_threshold); =20 rdmsrl(msr, val); /* Some other CPU already owns this bank. */ @@ -500,15 +503,28 @@ static int do_cmci_discover(int i) goto out; } =20 - val &=3D ~CMCI_THRESHOLD_MASK; - wrmsrl(msr, val | CMCI_EN | CMCI_THRESHOLD); - rdmsrl(msr, val); + if ( cmci_threshold ) + { + wrmsrl(msr, val | CMCI_EN | CMCI_THRESHOLD_MASK); + rdmsrl(msr, val); + } =20 if (!(val & CMCI_EN)) { /* This bank does not support CMCI. Polling timer has to handle = it. */ mcabanks_set(i, __get_cpu_var(no_cmci_banks)); + wrmsrl(msr, val & ~CMCI_THRESHOLD_MASK); return 0; } + max_threshold =3D MASK_EXTR(val, CMCI_THRESHOLD_MASK); + threshold =3D cmci_threshold; + if ( threshold > max_threshold ) + { + mce_printk(MCE_QUIET, + "CMCI: threshold %#x too large for CPU%u bank %u, using = %#x\n", + threshold, smp_processor_id(), i, max_threshold); + threshold =3D max_threshold; + } + wrmsrl(msr, (val & ~CMCI_THRESHOLD_MASK) | CMCI_EN | threshold); mcabanks_set(i, __get_cpu_var(mce_banks_owned)); out: mcabanks_clear(i, __get_cpu_var(no_cmci_banks)); --- a/xen/arch/x86/cpu/mcheck/x86_mca.h +++ b/xen/arch/x86/cpu/mcheck/x86_mca.h @@ -86,9 +86,6 @@ /* Bitfield of MSR_K8_HWCR register */ #define K8_HWCR_MCi_STATUS_WREN (1ULL << 18) =20 -/*Intel Specific bitfield*/ -#define CMCI_THRESHOLD 0x2 - #define MCi_MISC_ADDRMOD_MASK (0x7UL << 6) #define MCi_MISC_PHYSMOD (0x2UL << 6) =20 --=__Part4673AC40.2__= Content-Type: text/plain; name="x86-CMCI-threshold.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-CMCI-threshold.patch" x86/MCE: allow overriding the CMCI threshold=0A=0AWe've had reports of = systems where CMCIs would surface at a relatively=0Ahigh rate during = certain periods of time, without them apparently=0Acausing subsequent more = severe problems (see Xeon E7-8800/4800/2800=0Aspecification clarification = SC1). Give the admin a knob to lower the=0Aimpact on the system logs.=0A=0A= Signed-off-by: Jan Beulich =0A=0A--- a/docs/misc/xen-com= mand-line.markdown=0A+++ b/docs/misc/xen-command-line.markdown=0A@@ -242,6 = +242,14 @@ the NMI watchdog is also enabled.=0A =0A If set, override Xen's = default choice for the platform timer.=0A =0A+### cmci-threshold=0A+> `=3D = `=0A+=0A+> Default: `2`=0A+=0A+Specify the event count threshold = for raising Corrected Machine Check=0A+Interrupts. Specifying zero = disables CMCI handling.=0A+=0A ### cmos-rtc-probe=0A > `=3D `=0A = =0A--- a/xen/arch/x86/cpu/mcheck/mce_intel.c=0A+++ b/xen/arch/x86/cpu/mchec= k/mce_intel.c=0A@@ -492,6 +492,9 @@ static int do_cmci_discover(int i)=0A = {=0A unsigned msr =3D MSR_IA32_MCx_CTL2(i);=0A u64 val;=0A+ = unsigned int threshold, max_threshold;=0A+ static unsigned int = cmci_threshold =3D 2;=0A+ integer_param("cmci-threshold", cmci_threshold= );=0A =0A rdmsrl(msr, val);=0A /* Some other CPU already owns this = bank. */=0A@@ -500,15 +503,28 @@ static int do_cmci_discover(int i)=0A = goto out;=0A }=0A =0A- val &=3D ~CMCI_THRESHOLD_MASK;=0A- = wrmsrl(msr, val | CMCI_EN | CMCI_THRESHOLD);=0A- rdmsrl(msr, val);=0A+ = if ( cmci_threshold )=0A+ {=0A+ wrmsrl(msr, val | CMCI_EN | = CMCI_THRESHOLD_MASK);=0A+ rdmsrl(msr, val);=0A+ }=0A =0A if = (!(val & CMCI_EN)) {=0A /* This bank does not support CMCI. = Polling timer has to handle it. */=0A mcabanks_set(i, __get_cpu_var= (no_cmci_banks));=0A+ wrmsrl(msr, val & ~CMCI_THRESHOLD_MASK);=0A = return 0;=0A }=0A+ max_threshold =3D MASK_EXTR(val, CMCI_THRES= HOLD_MASK);=0A+ threshold =3D cmci_threshold;=0A+ if ( threshold > = max_threshold )=0A+ {=0A+ mce_printk(MCE_QUIET,=0A+ = "CMCI: threshold %#x too large for CPU%u bank %u, using %#x\n",=0A+ = threshold, smp_processor_id(), i, max_threshold);=0A+ = threshold =3D max_threshold;=0A+ }=0A+ wrmsrl(msr, (val & ~CMCI_THRES= HOLD_MASK) | CMCI_EN | threshold);=0A mcabanks_set(i, __get_cpu_var(mce= _banks_owned));=0A out:=0A mcabanks_clear(i, __get_cpu_var(no_cmci_bank= s));=0A--- a/xen/arch/x86/cpu/mcheck/x86_mca.h=0A+++ b/xen/arch/x86/cpu/mch= eck/x86_mca.h=0A@@ -86,9 +86,6 @@=0A /* Bitfield of MSR_K8_HWCR register = */=0A #define K8_HWCR_MCi_STATUS_WREN (1ULL << 18)=0A =0A-/*Intel= Specific bitfield*/=0A-#define CMCI_THRESHOLD 0x2=0A-=0A = #define MCi_MISC_ADDRMOD_MASK (0x7UL << 6)=0A #define MCi_MISC_PHYSMOD = (0x2UL << 6)=0A =0A --=__Part4673AC40.2__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part4673AC40.2__=--