[PATCH 1/3] x86/mce: Make sysfs tunables available globally acrossall cpus

From: Naveen N. Rao
Date: Wed Sep 05 2012 - 06:24:06 EST


All the MCE attributes currently exported via sysfs appear under
/sys/devices/system/machinecheck/machinecheck<n>/. Pretty much all of
these are global in nature and not specific to a processor. So, make these
available under /sys/devices/system/machinecheck/ where they rightly belong.
Update documentation to also point to the new location so that user-space
tools can pick up on the new location. We would eventually want to remove
these from the per-cpu location.

Signed-off-by: Naveen N. Rao <naveen.n.rao@xxxxxxxxxxxxxxxxxx>
---
Documentation/x86/x86_64/machinecheck | 4 ++--
arch/x86/kernel/cpu/mcheck/mce.c | 24 +++++++++++++++++++++++-
2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/Documentation/x86/x86_64/machinecheck b/Documentation/x86/x86_64/machinecheck
index b1fb302..02b84a6 100644
--- a/Documentation/x86/x86_64/machinecheck
+++ b/Documentation/x86/x86_64/machinecheck
@@ -31,8 +31,8 @@ bankNctl
Note that BIOS maintain another mask to disable specific events
per bank. This is not visible here

-The following entries appear for each CPU, but they are truly shared
-between all CPUs.
+The following entries are shared between all CPUs and appear under
+/sys/devices/system/machinecheck:

check_interval
How often to poll for corrected machine check errors, in seconds
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index c311122..bf276eb 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -2205,6 +2205,7 @@ static struct dev_ext_attribute dev_attr_cmci_disabled = {
&mce_cmci_disabled
};

+/* Use this _only_ for per-cpu attributes */
static struct device_attribute *mce_device_attrs[] = {
&dev_attr_tolerant.attr,
&dev_attr_check_interval.attr,
@@ -2216,6 +2217,27 @@ static struct device_attribute *mce_device_attrs[] = {
NULL
};

+/* All new global attributes go here */
+static struct attribute *mce_device_global_attrs[] = {
+ &dev_attr_tolerant.attr.attr,
+ &dev_attr_check_interval.attr.attr,
+ &dev_attr_trigger.attr,
+ &dev_attr_monarch_timeout.attr.attr,
+ &dev_attr_dont_log_ce.attr.attr,
+ &dev_attr_ignore_ce.attr.attr,
+ &dev_attr_cmci_disabled.attr.attr,
+ NULL
+};
+
+static struct attribute_group mce_device_attr_group = {
+ .attrs = mce_device_global_attrs,
+};
+
+static const struct attribute_group *mce_device_attr_groups[] = {
+ &mce_device_attr_group,
+ NULL,
+};
+
static cpumask_var_t mce_device_initialized;

static void mce_device_release(struct device *dev)
@@ -2397,7 +2419,7 @@ static __init int mcheck_init_device(void)

mce_init_banks();

- err = subsys_system_register(&mce_subsys, NULL);
+ err = subsys_system_register(&mce_subsys, mce_device_attr_groups);
if (err)
return err;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/