Blame 0024-doc-MCE_readme.txt-new-file-documentation-about-MCE-.patch

69165ba
From 95e9590bfee2df447c8f4c0fd799e8c514beca80 Mon Sep 17 00:00:00 2001
69165ba
From: Denys Vlasenko <dvlasenk@redhat.com>
69165ba
Date: Tue, 10 Dec 2013 13:07:35 +0100
69165ba
Subject: [ABRT PATCH 24/27] doc/MCE_readme.txt: new file - documentation about
69165ba
 MCE handling
69165ba
69165ba
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
69165ba
69165ba
Related to rhbz#1032077
69165ba
69165ba
Signed-off-by: Jakub Filak <jfilak@redhat.com>
69165ba
---
69165ba
 doc/MCE_readme.txt | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
69165ba
 1 file changed, 86 insertions(+)
69165ba
 create mode 100644 doc/MCE_readme.txt
69165ba
69165ba
diff --git a/doc/MCE_readme.txt b/doc/MCE_readme.txt
69165ba
new file mode 100644
69165ba
index 0000000..ed5b627
69165ba
--- /dev/null
69165ba
+++ b/doc/MCE_readme.txt
69165ba
@@ -0,0 +1,86 @@
69165ba
+	Background
69165ba
+
69165ba
+MCEs can be fatal (they panic kernel) or not.
69165ba
+Fatal MCE are delivered as exception#18.
69165ba
+Non-fatal ones sometimes are delivered as exception#18; other times
69165ba
+they are silently recorded in magic MSRs, CPU is not alerted.
69165ba
+Linux kernel periodically (up to 5 mins interval) reads those MSRs
69165ba
+and if MCE is seen there, it is piped in binary form through
69165ba
+/dev/mcelog to whoever listens on it. (Such as mcelog tool in
69165ba
+--daemon mode; but cat 
69165ba
+
69165ba
+"Machine Check Exception:" message is printed *only* by fatal MCEs.
69165ba
+It will be caught as vmcore if kdump is configured.
69165ba
+
69165ba
+Non-fatal MCEs have "[Hardware Error]: Machine check events logged"
69165ba
+message in kernel log.
69165ba
+When /dev/mcelog is read, *no additional kernel log messages appear*.
69165ba
+
69165ba
+> Are those magic MSR registers cleared when read via /dev/mcelog?
69165ba
+
69165ba
+Yes.
69165ba
+
69165ba
+> Without mcelog utility, we can directly read only binary form, right?
69165ba
+> Not nice, but still useful, right?
69165ba
+> (could be transferred to nice text form on other machine).
69165ba
+
69165ba
+No, raw /dev/mcelog data is not easy to interpret on other machine.
69165ba
+In fact, it can't be used by mcelog tool even on the same machine.
69165ba
+Technical reason is that mcelog uses an obscure ioctl on /dev/mcelog
69165ba
+in order to know the size of binary blob with MCE information.
69165ba
+When run on a file, ioctl fails, and mcelog bombs out.
69165ba
+
69165ba
+Looks like without mcelog running and processing /dev/mcelog data,
69165ba
+non-fatal MCE's can't be easily decoded with currently existing tools.
69165ba
+
69165ba
+mcelog tool can be configured to write log to /var/log/mcelog
69165ba
+(RHEL6 does that) or to syslog (RHEL7 does that).
69165ba
+
69165ba
+
69165ba
+	How ABRT catches MCEs
69165ba
+
69165ba
+Fatal MCEs are caught as any fatal kernel panic is caught - as a vmcore.
69165ba
+The oops text, which goes to "backtrace" element, will be the decoded
69165ba
+MCE message from kernel log buffer.
69165ba
+
69165ba
+Non-fatal MCEs are caught as kernel oopses.
69165ba
+If "Machine check events logged" message is seen in "dmesg" element,
69165ba
+we assume it's a MCE, and create "not-reportable" element with suitable
69165ba
+explanation.
69165ba
+Then we check whether /var/log/mcelog exists,
69165ba
+or whether system log contains "mcelog: Hardware event",
69165ba
+and create a "comment" element with explanatory text, followed by
69165ba
+last 20 lines from either of those files.
69165ba
+
69165ba
+
69165ba
+	How to test MCEs
69165ba
+
69165ba
+There is an MCE injection tool and a kernel module, both named mce-inject.
69165ba
+(The tool comes from mce-test project, may be found in ras-utils RHEL7 package).
69165ba
+The script I used is:
69165ba
+
69165ba
+modprobe mce-inject
69165ba
+sync &
69165ba
+sleep 1
69165ba
+sync
69165ba
+# This can crash the machine:
69165ba
+echo "Injecting MCE from file $1"
69165ba
+mce-inject "$1"
69165ba
+echo "Exitcode:$?"
69165ba
+
69165ba
+It requires files which describe MCE to simulate. I grabbed a few examples
69165ba
+from mce-test.tar.gz (source tarball of mce-test project).
69165ba
+I used this this file to cause a non-fatal MCE:
69165ba
+
69165ba
+CPU 0 BANK 2
69165ba
+STATUS VAL OVER EN
69165ba
+
69165ba
+And this one to cause a fatal one:
69165ba
+
69165ba
+CPU 0 BANK 4
69165ba
+MCGSTATUS MCIP
69165ba
+STATUS FATAL S
69165ba
+RIP 12343434
69165ba
+MISC 11
69165ba
+
69165ba
+(Not sure what failures exactly they imitate, maybe there are better examples).
69165ba
-- 
69165ba
1.8.3.1
69165ba