Skip to contentSkip to conversation

Rework MCA configuration handling code, v2

PATCH In review Borislav Petkov 3 participants 11 messages Oct 25, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Rework MCA configuration handling code, v2

From: Borislav Petkov <[email protected]>

Third round, incorporating feedback from the last time.

Changelog:
==========

v1:
---

this is the first complete series implementing what we discussed previously. It now uses simple bools and collects everything in a struct mca_config which is nicely abstracted and collected in one place.

Please take a look and complain :)

v0:
---

Right,

so I did give that a try and it turned out to be a bit more involved than I thought. Basically, I'm relying on the assumption that if I use a u64 bitfield and pass a pointer to it, accessing it through that pointer as a u64 value works. Actually, I have the u64 bitfield as the first member of a struct and if I cast a pointer to that struct to u64 *, I'm expecting to have the 64 bits of the same bitfield.

Therefore, I can toggle the bits in the mce code with mca_cfg.<bitname>. When defining accessing them through the device attributes in sysfs, I use a new macro DEVICE_BIT_ATTR which gets the corresponding bit number of that same bit in the bitfield. This gives only one function which operates on a bitfield instead of a single function per bit in the bitfield.

For example,

mca_cfg {
	u64 dont_log_ce : 1,

is the first bit in the bitfield and I also have a MCA_CFG_DONT_LOG_CE define which is 0, i.e. the first bit, which I use to toggle the corresponding bit in the u64 in device_{show,store}_bit.

So I converted mce_dont_log_ce and mce_disabled (renaming it into the more correct mca_disabled) and it seems to work.

The asm looks sane too. One other advantage is that it makes the code much more cleaner and compact by collecting all those bool config values in a single struct, which was my original incentive to do that.

So please take a look and let me know whether this is sane, especially the above assumption that I can access a u64 bitfield through a u64 * and the bits are where they're expected to be. gcc seems to do that... and I don't see anything in the C99 standard that would object to it but I could be overlooking something.

Thanks.

Borislav Petkov (5):
drivers/base: Add a DEVICE_BOOL_ATTR macro x86, MCA: Convert dont_log_ce, banks and tolerant x86, MCA: Convert rip_msr, mce_bootlog, monarch_timeout x86, MCA: Convert the next three variables batch x86, MCA: Finish mca_config conversion

 arch/x86/include/asm/mce.h                |  21 ++-
 arch/x86/kernel/cpu/mcheck/mce-internal.h |   2 -
 arch/x86/kernel/cpu/mcheck/mce-severity.c |   4 +-
 arch/x86/kernel/cpu/mcheck/mce.c          | 209 +++++++++++++++---------------
 arch/x86/kernel/cpu/mcheck/mce_intel.c    |   8 +-
 arch/x86/lguest/boot.c                    |   2 +-
 drivers/base/core.c                       |  21 +++
 include/linux/device.h                    |   7 +
 8 files changed, 159 insertions(+), 115 deletions(-)
Signature · 1 line
1.8.0
#1 lore raw

PATCH 1/5 drivers/base: Add a DEVICE_BOOL_ATTR macro

From: Borislav Petkov <[email protected]>

... which, analogous to DEVICE_INT_ATTR provides functionality to set/clear bools. Its purpose is to be used where values need to be used as booleans in configuration context.

Next patch uses this.

Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/base/core.c    | 21 +++++++++++++++++++++
 include/linux/device.h |  7 +++++++
 2 files changed, 28 insertions(+)
drivers/base/core.c +21 -0
index abea76c36a4b..c8ae1f6b01b9 100644
@@ -171,6 +171,27 @@ ssize_t device_show_int(struct device *dev,
 }
 EXPORT_SYMBOL_GPL(device_show_int);
 
+ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
+			  const char *buf, size_t size)
+{
+	struct dev_ext_attribute *ea = to_ext_attr(attr);
+
+	if (strtobool(buf, ea->var) < 0)
+		return -EINVAL;
+
+	return size;
+}
+EXPORT_SYMBOL_GPL(device_store_bool);
+
+ssize_t device_show_bool(struct device *dev, struct device_attribute *attr,
+			 char *buf)
+{
+	struct dev_ext_attribute *ea = to_ext_attr(attr);
+
+	return snprintf(buf, PAGE_SIZE, "%d\n", *(bool *)(ea->var));
+}
+EXPORT_SYMBOL_GPL(device_show_bool);
+
 /**
  *	device_release - free device structure.
  *	@kobj:	device's kobject.
include/linux/device.h +7 -0
index 86ef6ab553b1..50c85a26b003 100644
@@ -496,6 +496,10 @@ ssize_t device_show_int(struct device *dev, struct device_attribute *attr,
 			char *buf);
 ssize_t device_store_int(struct device *dev, struct device_attribute *attr,
 			 const char *buf, size_t count);
+ssize_t device_show_bool(struct device *dev, struct device_attribute *attr,
+			char *buf);
+ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
+			 const char *buf, size_t count);
 
 #define DEVICE_ATTR(_name, _mode, _show, _store) \
 	struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
@@ -505,6 +509,9 @@ ssize_t device_store_int(struct device *dev, struct device_attribute *attr,
 #define DEVICE_INT_ATTR(_name, _mode, _var) \
 	struct dev_ext_attribute dev_attr_##_name = \
 		{ __ATTR(_name, _mode, device_show_int, device_store_int), &(_var) }
+#define DEVICE_BOOL_ATTR(_name, _mode, _var) \
+	struct dev_ext_attribute dev_attr_##_name = \
+		{ __ATTR(_name, _mode, device_show_bool, device_store_bool), &(_var) }
 #define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \
 	struct device_attribute dev_attr_##_name =		\
 		__ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store)
Signature · 1 line
1.8.0
maintainer Acked-by on v1 1/5
#2 lore raw

Re: [PATCH 1/5] drivers/base: Add a DEVICE_BOOL_ATTR macro

Quoted 10 lines · Borislav Petkov

From: Borislav Petkov <[email protected]>

... which, analogous to DEVICE_INT_ATTR provides functionality to set/clear bools. Its purpose is to be used where values need to be used as booleans in configuration context.

Next patch uses this.

Cc Greg Kroah-Hartman <[email protected]>

Do you want me to take this through my tree now? If not, I have no objection to it being part of this larger series and go to Linus through whatever tree takes it.

thanks,

greg k-h

#3 lore raw

Re: [PATCH 1/5] drivers/base: Add a DEVICE_BOOL_ATTR macro

Quoted 9 lines · Greg Kroah-Hartman
Quoted 8 lines · Borislav Petkov

From: Borislav Petkov <[email protected]>

... which, analogous to DEVICE_INT_ATTR provides functionality to set/clear bools. Its purpose is to be used where values need to be used as booleans in configuration context.

Next patch uses this.

Quoted 8 lines
Quoted 2 lines
Cc Greg Kroah-Hartman <[email protected]>

Do you want me to take this through my tree now? If not, I have no objection to it being part of this larger series and go to Linus through whatever tree takes it.

Well, in my case it would go through the RAS tree.

And I, like you, don't care which way it goes except maybe that if those 5 patches stay together, there won't be any build issues due to merging order in linux-next and later Linus' tree if that first patch goes separately.

But I'm absolutely open to whatever you suggest is best.

Thanks.

Signature · 8 lines
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
#4 lore raw

Re: [PATCH 1/5] drivers/base: Add a DEVICE_BOOL_ATTR macro

Quoted 13 lines · Borislav Petkov
Quoted 12 lines · Greg Kroah-Hartman
Quoted 10 lines · Borislav Petkov

From: Borislav Petkov <[email protected]>

... which, analogous to DEVICE_INT_ATTR provides functionality to set/clear bools. Its purpose is to be used where values need to be used as booleans in configuration context.

Next patch uses this.

Cc Greg Kroah-Hartman <[email protected]>
Quoted 7 lines
Quoted 5 lines

Do you want me to take this through my tree now? If not, I have no objection to it being part of this larger series and go to Linus through whatever tree takes it.

Well, in my case it would go through the RAS tree.

Then I'd recommend it going in that way.

thanks,

greg k-h

#5 lore raw

PATCH 2/5 x86, MCA: Convert dont_log_ce, banks and tolerant

In reply to Borislav Petkov

From: Borislav Petkov <[email protected]>

Move those MCA configuration variables into struct mca_config and adjust the places they're used accordingly.

---
 arch/x86/include/asm/mce.h       |  7 +++
 arch/x86/kernel/cpu/mcheck/mce.c | 97 ++++++++++++++++++++++------------------
 2 files changed, 60 insertions(+), 44 deletions(-)
arch/x86/include/asm/mce.h +7 -0
index 54d73b1f00a0..e4060de88476 100644
@@ -119,6 +119,13 @@ struct mce_log {
 #define K8_MCE_THRESHOLD_BASE      (MCE_EXTENDED_BANK + 1)
 
 #ifdef __KERNEL__
+
+struct mca_config {
+	bool dont_log_ce;
+	u8 banks;
+	int tolerant;
+};
+
 extern void mce_register_decode_chain(struct notifier_block *nb);
 extern void mce_unregister_decode_chain(struct notifier_block *nb);
 
arch/x86/kernel/cpu/mcheck/mce.c +53 -44

315 lines not on this page · raw message

Signature · 1 line
1.8.0
#6 lore raw

PATCH 3/5 x86, MCA: Convert rip_msr, mce_bootlog, monarch_timeout

In reply to Borislav Petkov

From: Borislav Petkov <[email protected]>

Move above configuration variables into struct mca_config and adjust usage places accordingly.

---
 arch/x86/include/asm/mce.h       |  3 +++
 arch/x86/kernel/cpu/mcheck/mce.c | 51 +++++++++++++++++++++-------------------
 2 files changed, 30 insertions(+), 24 deletions(-)
arch/x86/include/asm/mce.h +3 -0
index e4060de88476..73ba1853951a 100644
@@ -123,7 +123,10 @@ struct mce_log {
 struct mca_config {
 	bool dont_log_ce;
 	u8 banks;
+	s8 bootlog;
 	int tolerant;
+	int monarch_timeout;
+	u32 rip_msr;
 };
 
 extern void mce_register_decode_chain(struct notifier_block *nb);
arch/x86/kernel/cpu/mcheck/mce.c +27 -24

162 lines not on this page · raw message

Signature · 1 line
1.8.0
#7 lore raw

PATCH 4/5 x86, MCA: Convert the next three variables batch

In reply to Borislav Petkov

From: Borislav Petkov <[email protected]>

Move them into the mca_config struct and adjust code touching them accordingly.

---
 arch/x86/include/asm/mce.h             |  6 ++++--
 arch/x86/kernel/cpu/mcheck/mce.c       | 35 ++++++++++++++++------------------
 arch/x86/kernel/cpu/mcheck/mce_intel.c |  2 +-
 3 files changed, 21 insertions(+), 22 deletions(-)
arch/x86/include/asm/mce.h +4 -2
index 73ba1853951a..a711e3f4fbc7 100644
@@ -122,13 +122,17 @@ struct mce_log {
 
 struct mca_config {
 	bool dont_log_ce;
+	bool cmci_disabled;
+	bool ignore_ce;
 	u8 banks;
 	s8 bootlog;
 	int tolerant;
 	int monarch_timeout;
+	int panic_timeout;
 	u32 rip_msr;
 };
 
+extern struct mca_config mca_cfg;
 extern void mce_register_decode_chain(struct notifier_block *nb);
 extern void mce_unregister_decode_chain(struct notifier_block *nb);
 
@@ -169,8 +173,6 @@ DECLARE_PER_CPU(struct device *, mce_device);
 #define MAX_NR_BANKS 32
 
 #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);
arch/x86/kernel/cpu/mcheck/mce.c +16 -19
index aa11019eeb0e..8c7a90d89852 100644
@@ -66,9 +66,6 @@ atomic_t mce_entry;
 
 DEFINE_PER_CPU(unsigned, mce_exception_count);
 
-static int			mce_panic_timeout	__read_mostly;
-int				mce_cmci_disabled	__read_mostly;
-int				mce_ignore_ce		__read_mostly;
 int				mce_ser			__read_mostly;
 int				mce_bios_cmci_threshold	__read_mostly;
 
@@ -302,7 +299,7 @@ static void wait_for_panic(void)
 	while (timeout-- > 0)
 		udelay(1);
 	if (panic_timeout == 0)
-		panic_timeout = mce_panic_timeout;
+		panic_timeout = mca_cfg.panic_timeout;
 	panic("Panicing machine check CPU died");
 }
 
@@ -360,7 +357,7 @@ static void mce_panic(char *msg, struct mce *final, char *exp)
 		pr_emerg(HW_ERR "Machine check: %s\n", exp);
 	if (!fake_panic) {
 		if (panic_timeout == 0)
-			panic_timeout = mce_panic_timeout;
+			panic_timeout = mca_cfg.panic_timeout;
 		panic(msg);
 	} else
 		pr_emerg(HW_ERR "Fake kernel panic: %s\n", msg);
@@ -1600,7 +1597,7 @@ static int __cpuinit __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c)
 	if (cfg->monarch_timeout < 0)
 		cfg->monarch_timeout = 0;
 	if (cfg->bootlog != 0)
-		mce_panic_timeout = 30;
+		cfg->panic_timeout = 30;
 
 	return 0;
 }
@@ -1645,7 +1642,7 @@ static void mce_start_timer(unsigned int cpu, struct timer_list *t)
 
 	__this_cpu_write(mce_next_interval, iv);
 
-	if (mce_ignore_ce || !iv)
+	if (mca_cfg.ignore_ce || !iv)
 		return;
 
 	t->expires = round_jiffies(jiffies + iv);
@@ -1972,11 +1969,11 @@ static int __init mcheck_enable(char *str)
 	if (!strcmp(str, "off"))
 		mce_disabled = 1;
 	else if (!strcmp(str, "no_cmci"))
-		mce_cmci_disabled = 1;
+		cfg->cmci_disabled = true;
 	else if (!strcmp(str, "dont_log_ce"))
 		cfg->dont_log_ce = true;
 	else if (!strcmp(str, "ignore_ce"))
-		mce_ignore_ce = 1;
+		cfg->ignore_ce = true;
 	else if (!strcmp(str, "bootlog") || !strcmp(str, "nobootlog"))
 		cfg->bootlog = (str[0] == 'b');
 	else if (!strcmp(str, "bios_cmci_threshold"))
@@ -2154,15 +2151,15 @@ static ssize_t set_ignore_ce(struct device *s,
 	if (strict_strtoull(buf, 0, &new) < 0)
 		return -EINVAL;
 
-	if (mce_ignore_ce ^ !!new) {
+	if (mca_cfg.ignore_ce ^ !!new) {
 		if (new) {
 			/* disable ce features */
 			mce_timer_delete_all();
 			on_each_cpu(mce_disable_cmci, NULL, 1);
-			mce_ignore_ce = 1;
+			mca_cfg.ignore_ce = true;
 		} else {
 			/* enable ce features */
-			mce_ignore_ce = 0;
+			mca_cfg.ignore_ce = false;
 			on_each_cpu(mce_enable_ce, (void *)1, 1);
 		}
 	}
@@ -2178,14 +2175,14 @@ static ssize_t set_cmci_disabled(struct device *s,
 	if (strict_strtoull(buf, 0, &new) < 0)
 		return -EINVAL;
 
-	if (mce_cmci_disabled ^ !!new) {
+	if (mca_cfg.cmci_disabled ^ !!new) {
 		if (new) {
 			/* disable cmci */
 			on_each_cpu(mce_disable_cmci, NULL, 1);
-			mce_cmci_disabled = 1;
+			mca_cfg.cmci_disabled = true;
 		} else {
 			/* enable cmci */
-			mce_cmci_disabled = 0;
+			mca_cfg.cmci_disabled = false;
 			on_each_cpu(mce_enable_ce, NULL, 1);
 		}
 	}
@@ -2212,13 +2209,13 @@ static struct dev_ext_attribute dev_attr_check_interval = {
 };
 
 static struct dev_ext_attribute dev_attr_ignore_ce = {
-	__ATTR(ignore_ce, 0644, device_show_int, set_ignore_ce),
-	&mce_ignore_ce
+	__ATTR(ignore_ce, 0644, device_show_bool, set_ignore_ce),
+	&mca_cfg.ignore_ce
 };
 
 static struct dev_ext_attribute dev_attr_cmci_disabled = {
-	__ATTR(cmci_disabled, 0644, device_show_int, set_cmci_disabled),
-	&mce_cmci_disabled
+	__ATTR(cmci_disabled, 0644, device_show_bool, set_cmci_disabled),
+	&mca_cfg.cmci_disabled
 };
 
 static struct device_attribute *mce_device_attrs[] = {
arch/x86/kernel/cpu/mcheck/mce_intel.c +1 -1
index 5f88abf07e9c..1acd8ecba1c3 100644
@@ -53,7 +53,7 @@ static int cmci_supported(int *banks)
 {
 	u64 cap;
 
-	if (mce_cmci_disabled || mce_ignore_ce)
+	if (mca_cfg.cmci_disabled || mca_cfg.ignore_ce)
 		return 0;
 
 	/*
Signature · 1 line
1.8.0
#8 lore raw

PATCH 5/5 x86, MCA: Finish mca_config conversion

In reply to Borislav Petkov

From: Borislav Petkov <[email protected]>

mce_ser, mce_bios_cmci_threshold and mce_disabled are the last three bools which need conversion. Move them to the mca_config struct and adjust usage sites accordingly.

---
 arch/x86/include/asm/mce.h                |  5 +++--
 arch/x86/kernel/cpu/mcheck/mce-internal.h |  2 --
 arch/x86/kernel/cpu/mcheck/mce-severity.c |  4 ++--
 arch/x86/kernel/cpu/mcheck/mce.c          | 36 ++++++++++++++-----------------
 arch/x86/kernel/cpu/mcheck/mce_intel.c    |  6 +++---
 arch/x86/lguest/boot.c                    |  2 +-
 6 files changed, 25 insertions(+), 30 deletions(-)
arch/x86/include/asm/mce.h +3 -2
index a711e3f4fbc7..d90c2fccc30c 100644
@@ -124,6 +124,9 @@ struct mca_config {
 	bool dont_log_ce;
 	bool cmci_disabled;
 	bool ignore_ce;
+	bool disabled;
+	bool ser;
+	bool bios_cmci_threshold;
 	u8 banks;
 	s8 bootlog;
 	int tolerant;
@@ -140,7 +143,6 @@ extern void mce_unregister_decode_chain(struct notifier_block *nb);
 #include <linux/init.h>
 #include <linux/atomic.h>
 
-extern int mce_disabled;
 extern int mce_p5_enabled;
 
 #ifdef CONFIG_X86_MCE
@@ -173,7 +175,6 @@ DECLARE_PER_CPU(struct device *, mce_device);
 #define MAX_NR_BANKS 32
 
 #ifdef CONFIG_X86_MCE_INTEL
-extern int mce_bios_cmci_threshold;
 void mce_intel_feature_init(struct cpuinfo_x86 *c);
 void cmci_clear(void);
 void cmci_reenable(void);
arch/x86/kernel/cpu/mcheck/mce-internal.h +0 -2
index 6a05c1d327a9..5b7d4fa5d3b7 100644
@@ -24,8 +24,6 @@ struct mce_bank {
 int mce_severity(struct mce *a, int tolerant, char **msg);
 struct dentry *mce_get_debugfs_dir(void);
 
-extern int mce_ser;
-
 extern struct mce_bank *mce_banks;
 
 #ifdef CONFIG_X86_MCE_INTEL
arch/x86/kernel/cpu/mcheck/mce-severity.c +2 -2
index 13017626f9a8..beb1f1689e52 100644
@@ -193,9 +193,9 @@ int mce_severity(struct mce *m, int tolerant, char **msg)
 			continue;
 		if ((m->mcgstatus & s->mcgmask) != s->mcgres)
 			continue;
-		if (s->ser == SER_REQUIRED && !mce_ser)
+		if (s->ser == SER_REQUIRED && !mca_cfg.ser)
 			continue;
-		if (s->ser == NO_SER && mce_ser)
+		if (s->ser == NO_SER && mca_cfg.ser)
 			continue;
 		if (s->context && ctx != s->context)
 			continue;
arch/x86/kernel/cpu/mcheck/mce.c +16 -20
index 8c7a90d89852..80dbda84f1c3 100644
@@ -58,18 +58,13 @@ static DEFINE_MUTEX(mce_chrdev_read_mutex);
 #define CREATE_TRACE_POINTS
 #include <trace/events/mce.h>
 
-int mce_disabled __read_mostly;
-
 #define SPINUNIT 100	/* 100ns */
 
 atomic_t mce_entry;
 
 DEFINE_PER_CPU(unsigned, mce_exception_count);
 
-int				mce_ser			__read_mostly;
-int				mce_bios_cmci_threshold	__read_mostly;
-
-struct mce_bank                *mce_banks		__read_mostly;
+struct mce_bank *mce_banks __read_mostly;
 
 struct mca_config mca_cfg __read_mostly = {
 	.bootlog  = -1,
@@ -510,7 +505,7 @@ static int mce_ring_add(unsigned long pfn)
 
 int mce_available(struct cpuinfo_x86 *c)
 {
-	if (mce_disabled)
+	if (mca_cfg.disabled)
 		return 0;
 	return cpu_has(c, X86_FEATURE_MCE) && cpu_has(c, X86_FEATURE_MCA);
 }
@@ -562,7 +557,7 @@ static void mce_read_aux(struct mce *m, int i)
 		/*
 		 * Mask the reported address by the reported granularity.
 		 */
-		if (mce_ser && (m->status & MCI_STATUS_MISCV)) {
+		if (mca_cfg.ser && (m->status & MCI_STATUS_MISCV)) {
 			u8 shift = MCI_MISC_ADDR_LSB(m->misc);
 			m->addr >>= shift;
 			m->addr <<= shift;
@@ -617,7 +612,7 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)
 		 * TBD do the same check for MCI_STATUS_EN here?
 		 */
 		if (!(flags & MCP_UC) &&
-		    (m.status & (mce_ser ? MCI_STATUS_S : MCI_STATUS_UC)))
+		    (m.status & (mca_cfg.ser ? MCI_STATUS_S : MCI_STATUS_UC)))
 			continue;
 
 		mce_read_aux(&m, i);
@@ -1009,6 +1004,7 @@ static void mce_clear_info(struct mce_info *mi)
  */
 void do_machine_check(struct pt_regs *regs, long error_code)
 {
+	struct mca_config *cfg = &mca_cfg;
 	struct mce m, *final;
 	int i;
 	int worst = 0;
@@ -1036,7 +1032,7 @@ void do_machine_check(struct pt_regs *regs, long error_code)
 
 	this_cpu_inc(mce_exception_count);
 
-	if (!mca_cfg.banks)
+	if (!cfg->banks)
 		goto out;
 
 	mce_gather_info(&m, regs);
@@ -1063,7 +1059,7 @@ void do_machine_check(struct pt_regs *regs, long error_code)
 	 * because the first one to see it will clear it.
 	 */
 	order = mce_start(&no_way_out);
-	for (i = 0; i < mca_cfg.banks; i++) {
+	for (i = 0; i < cfg->banks; i++) {
 		__clear_bit(i, toclear);
 		if (!test_bit(i, valid_banks))
 			continue;
@@ -1082,7 +1078,7 @@ void do_machine_check(struct pt_regs *regs, long error_code)
 		 * Non uncorrected or non signaled errors are handled by
 		 * machine_check_poll. Leave them alone, unless this panics.
 		 */
-		if (!(m.status & (mce_ser ? MCI_STATUS_S : MCI_STATUS_UC)) &&
+		if (!(m.status & (cfg->ser ? MCI_STATUS_S : MCI_STATUS_UC)) &&
 			!no_way_out)
 			continue;
 
@@ -1091,7 +1087,7 @@ void do_machine_check(struct pt_regs *regs, long error_code)
 		 */
 		add_taint(TAINT_MACHINE_CHECK);
 
-		severity = mce_severity(&m, mca_cfg.tolerant, NULL);
+		severity = mce_severity(&m, cfg->tolerant, NULL);
 
 		/*
 		 * When machine check was for corrected handler don't touch,
@@ -1147,7 +1143,7 @@ void do_machine_check(struct pt_regs *regs, long error_code)
 	 * issues we try to recover, or limit damage to the current
 	 * process.
 	 */
-	if (mca_cfg.tolerant < 3) {
+	if (cfg->tolerant < 3) {
 		if (no_way_out)
 			mce_panic("Fatal machine check on current CPU", &m, msg);
 		if (worst == MCE_AR_SEVERITY) {
@@ -1426,7 +1422,7 @@ static int __cpuinit __mcheck_cpu_cap_init(void)
 		mca_cfg.rip_msr = MSR_IA32_MCG_EIP;
 
 	if (cap & MCG_SER_P)
-		mce_ser = 1;
+		mca_cfg.ser = true;
 
 	return 0;
 }
@@ -1675,7 +1671,7 @@ void (*machine_check_vector)(struct pt_regs *, long error_code) =
  */
 void __cpuinit mcheck_cpu_init(struct cpuinfo_x86 *c)
 {
-	if (mce_disabled)
+	if (mca_cfg.disabled)
 		return;
 
 	if (__mcheck_cpu_ancient_init(c))
@@ -1685,7 +1681,7 @@ void __cpuinit mcheck_cpu_init(struct cpuinfo_x86 *c)
 		return;
 
 	if (__mcheck_cpu_cap_init() < 0 || __mcheck_cpu_apply_quirks(c) < 0) {
-		mce_disabled = 1;
+		mca_cfg.disabled = true;
 		return;
 	}
 
@@ -1967,7 +1963,7 @@ static int __init mcheck_enable(char *str)
 	if (*str == '=')
 		str++;
 	if (!strcmp(str, "off"))
-		mce_disabled = 1;
+		cfg->disabled = true;
 	else if (!strcmp(str, "no_cmci"))
 		cfg->cmci_disabled = true;
 	else if (!strcmp(str, "dont_log_ce"))
@@ -1977,7 +1973,7 @@ static int __init mcheck_enable(char *str)
 	else if (!strcmp(str, "bootlog") || !strcmp(str, "nobootlog"))
 		cfg->bootlog = (str[0] == 'b');
 	else if (!strcmp(str, "bios_cmci_threshold"))
-		mce_bios_cmci_threshold = 1;
+		cfg->bios_cmci_threshold = true;
 	else if (isdigit(str[0])) {
 		get_option(&str, &(cfg->tolerant));
 		if (*str == ',') {
@@ -2435,7 +2431,7 @@ device_initcall_sync(mcheck_init_device);
  */
 static int __init mcheck_disable(char *str)
 {
-	mce_disabled = 1;
+	mca_cfg.disabled = true;
 	return 1;
 }
 __setup("nomce", mcheck_disable);
arch/x86/kernel/cpu/mcheck/mce_intel.c +3 -3
index 1acd8ecba1c3..79b2b6b6e613 100644
@@ -200,7 +200,7 @@ static void cmci_discover(int banks)
 			continue;
 		}
 
-		if (!mce_bios_cmci_threshold) {
+		if (!mca_cfg.bios_cmci_threshold) {
 			val &= ~MCI_CTL2_CMCI_THRESHOLD_MASK;
 			val |= CMCI_THRESHOLD;
 		} else if (!(val & MCI_CTL2_CMCI_THRESHOLD_MASK)) {
@@ -227,7 +227,7 @@ static void cmci_discover(int banks)
 			 * set the thresholds properly or does not work with
 			 * this boot option. Note down now and report later.
 			 */
-			if (mce_bios_cmci_threshold && bios_zero_thresh &&
+			if (mca_cfg.bios_cmci_threshold && bios_zero_thresh &&
 					(val & MCI_CTL2_CMCI_THRESHOLD_MASK))
 				bios_wrong_thresh = 1;
 		} else {
@@ -235,7 +235,7 @@ static void cmci_discover(int banks)
 		}
 	}
 	raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
-	if (mce_bios_cmci_threshold && bios_wrong_thresh) {
+	if (mca_cfg.bios_cmci_threshold && bios_wrong_thresh) {
 		pr_info_once(
 			"bios_cmci_threshold: Some banks do not have valid thresholds set\n");
 		pr_info_once(
arch/x86/lguest/boot.c +1 -1
index 642d8805bc1b..df4176cdbb32 100644
@@ -1412,7 +1412,7 @@ __init void lguest_init(void)
 
 	/* We don't have features.  We have puppies!  Puppies! */
 #ifdef CONFIG_X86_MCE
-	mce_disabled = 1;
+	mca_cfg.disabled = true;
 #endif
 #ifdef CONFIG_ACPI
 	acpi_disabled = 1;
Signature · 1 line
1.8.0
#10 lore raw
Quoted 9 lines · Tony
Quoted 1 line

Third round, incorporating feedback from the last time.

Paste one of these onto each piece:

What's up, you guys bored? :-)

Signature · 8 lines
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