[PATCH] [mcelog] Start using the new sysfs tunables location

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


All the current mce tunables are now available under
/sys/devices/system/machinecheck. Start using this new location, but fall back
to the older per-cpu location so that we continue working with older kernels.

Signed-off-by: Naveen N. Rao <naveen.n.rao@xxxxxxxxxxxxxxxxxx>
---
README | 2 +-
mcelog.init | 5 ++++-
tests/test | 7 ++++++-
3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/README b/README
index 08184ed..0426460 100644
--- a/README
+++ b/README
@@ -18,7 +18,7 @@ significantly (upto 10 minutes) and does not allow mcelog to keep extended state

trigger is a newer method where the kernel runs mcelog on a error.
This is configured with
-echo /usr/sbin/mcelog > /sys/devices/system/machinecheck/machinecheck0/trigger
+echo /usr/sbin/mcelog > /sys/devices/system/machinecheck/trigger
This is faster, but still doesn't allow mcelog to keep state,
and has relatively high overhead for each error because a program has
to be initialized from scratch.
diff --git a/mcelog.init b/mcelog.init
index 0abe786..5f32ba7 100755
--- a/mcelog.init
+++ b/mcelog.init
@@ -31,7 +31,10 @@ MCELOG_OPTIONS=""

# private settings
MCELOG=${MCELOG:-/usr/sbin/mcelog}
-TRIGGER=/sys/devices/system/machinecheck/machinecheck0/trigger
+TRIGGER=/sys/devices/system/machinecheck/trigger
+if [ ! -e $TRIGGER ] ; then
+ TRIGGER=/sys/devices/system/machinecheck/machinecheck0/trigger
+fi
[ ! -x $MCELOG ] && ( echo "mcelog not found" ; exit 1 )
[ ! -r /dev/mcelog ] && ( echo "/dev/mcelog not active" ; exit 0 )

diff --git a/tests/test b/tests/test
index c673eb2..52daf01 100755
--- a/tests/test
+++ b/tests/test
@@ -17,10 +17,15 @@ if [ "$(whoami)" != "root" ] ; then
exit 1
fi

+TRIGGER=/sys/devices/system/machinecheck/trigger
+if [ ! -e $TRIGGER ] ; then
+ TRIGGER=/sys/devices/system/machinecheck/machinecheck0/trigger
+fi
+
echo "++++++++++++ running $1 test +++++++++++++++++++"

# disable trigger
-echo -n "" > /sys/devices/system/machinecheck/machinecheck0/trigger
+echo -n "" > $TRIGGER
killall mcelog || true

#killwatchdog() {

--
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/