x86: Add an option to disable decoding of MCE
Subsystems (2)
PATCH 1/1 x86: Add an option to disable decoding of MCE
This patch applies to v2.6.37.
---
On our systems, we do not want to have any "decoders" called on machine check events. These decoders can easily spam our logs and cause space problems on machines that have a lot of correctable error events. We _do_ however want to get the messages delivered via /dev/mcelog for userland processing.
Introduce an interface "dont_decode" that allows us to skip the decoders. We always call the decoders by default.
Google-Bug-Id: 3289142
--- arch/x86/kernel/cpu/mcheck/mce.c | 24 ++++++++++++++++++------ 1 files changed, 18 insertions(+), 6 deletions(-)
arch/x86/kernel/cpu/mcheck/mce.c +18 -6
@@ -82,6 +82,7 @@ static int mce_bootlog __read_mostly = -1;static int monarch_timeout__read_mostly =-1 ;static int mce_panic_timeout__read_mostly ;static int mce_dont_log_ce__read_mostly ; +static int mce_dont_decode__read_mostly ;int mce_cmci_disabled__read_mostly ;int mce_ignore_ce__read_mostly ;int mce_ser__read_mostly ;
@@ -209,6 +210,17 @@ void mce_log(struct mce *mce)set_bit (0 , &mce_need_notify); } +static void call_decoders (struct mce *m) +{ +if (mce_dont_decode) +return ; +/* +* Print out human-readable details about the MCE error, +* (if the CPU has an implementation for that) +*/ +atomic_notifier_call_chain (&x86_mce_decoder_chain,0 , m); +} +static void print_mce (struct mce *m) { pr_emerg(HW_ERR "CPU %d: Machine Check Exception: %Lx Bank %d: %016Lx\n",
@@ -234,11 +246,7 @@ static void print_mce(struct mce *m)pr_emerg (HW_ERR "PROCESSOR %u:%x TIME %llu SOCKET %u APIC %x\n" , m->cpuvendor, m->cpuid, m->time, m->socketid, m->apicid); -/* -* Print out human-readable details about the MCE error, -* (if the CPU has an implementation for that) -*/ -atomic_notifier_call_chain (&x86_mce_decoder_chain,0 , m); +call_decoders (m); }#define PANIC_TIMEOUT 5/* 5 seconds */
@@ -588,7 +596,7 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)*/ if (!(flags &MCP_DONTLOG ) && !mce_dont_log_ce) {mce_log (&m); -atomic_notifier_call_chain (&x86_mce_decoder_chain,0 , &m); +call_decoders (&m);add_taint (TAINT_MACHINE_CHECK ); }
@@ -1700,6 +1708,8 @@ static int __init mcheck_enable(char *str) mce_cmci_disabled =1 ; else if (!strcmp(str, "dont_log_ce")) mce_dont_log_ce =1 ; + else if (!strcmp(str, "dont_decode")) + mce_dont_decode =1 ; else if (!strcmp(str, "ignore_ce")) mce_ignore_ce =1 ; else if (!strcmp(str, "bootlog") || !strcmp(str, "nobootlog"))
@@ -1926,6 +1936,7 @@ static SYSDEV_ATTR(trigger, 0644, show_trigger, set_trigger); static SYSDEV_INT_ATTR(tolerant, 0644, tolerant); static SYSDEV_INT_ATTR(monarch_timeout, 0644, monarch_timeout); static SYSDEV_INT_ATTR(dont_log_ce, 0644, mce_dont_log_ce); +static SYSDEV_INT_ATTR(dont_decode, 0644, mce_dont_decode);static struct sysdev_ext_attribute attr_check_interval = { _SYSDEV_ATTR(check_interval, 0644, sysdev_show_int,
@@ -1949,6 +1960,7 @@ static struct sysdev_attribute *mce_attrs[] = { &attr_trigger, &attr_monarch_timeout.attr, &attr_dont_log_ce.attr, + &attr_dont_decode.attr, &attr_ignore_ce.attr, &attr_cmci_disabled.attr,NULL
Signature · 1 line
1.7.3.1
Quoted 10 lines · Mike Waychison
This patch applies to v2.6.37.
---On our systems, we do not want to have any "decoders" called on machine check events. These decoders can easily spam our logs and cause space problems on machines that have a lot of correctable error events. We _do_ however want to get the messages delivered via
/dev/mcelogfor userland processing.
Quoted 8 lines
Introduce an interface "
dont_decode" that allows us to skip the decoders. We always call the decoders by default.Google-Bug-Id: 3289142
Signed-off-by Mike Waychison <[email protected]>---
arch/x86/kernel/cpu/mcheck/mce.c| 24 ++++++++++++++++++------ 1 files
changed, 18 insertions(+), 6 deletions(-)
Hi,
Please update Documentation/x86/x86_64/boot-options.txt with this new option.
Signature · 1 line
~Randy
PATCH 1/1 x86: Add an option to disable decoding of MCE
This patch applies to v2.6.37.
Updated with documentation of the new option.
---
On our systems, we do not want to have any "decoders" called on machine check events. These decoders can easily spam our logs and cause space problems on machines that have a lot of correctable error events. We _do_ however want to get the messages delivered via /dev/mcelog for userland processing.
Introduce an interface "dont_decode" that allows us to skip the decoders. We always call the decoders by default.
Google-Bug-Id: 3289142
--- Documentation/x86/x86_64/boot-options.txt | 5 +++++ Documentation/x86/x86_64/machinecheck | 6 ++++++ arch/x86/kernel/cpu/mcheck/mce.c | 24 ++++++++++++++++++------ 3 files changed, 29 insertions(+), 6 deletions(-)
Documentation/x86/x86_64/boot-options.txt +5 -0
@@ -22,6 +22,11 @@ Machine check as corrected are silently cleared by OS. This option will be useful if you have no interest in any of corrected errors. + mce=dont_decode + Disable in-kernel decoding of errors. Setting this boot + option will cause EDAC to be skipped (if enabled) and no + messages to be printed into the logs. Events will still + be available via /dev/mcelog however. mce=ignore_ce Disable features for corrected errors, e.g. polling timer and CMCI. All events reported as corrected are not cleared
Documentation/x86/x86_64/machinecheck +6 -0
@@ -65,6 +65,12 @@ tolerant Note this only makes a difference if the CPU allows recovery from a machine check exception. Current x86 CPUs generally do not. +dont_decode + Disable in-kernel decoding of any errors. Setting this boot + option will cause EDAC to be skipped (if enabled) and no + messages to be printed into the logs. Events will still be + available via /dev/mcelog however. + trigger Program to run when a machine check event is detected. This is an alternative to running mcelog regularly from cron
arch/x86/kernel/cpu/mcheck/mce.c +18 -6
@@ -82,6 +82,7 @@ static int mce_bootlog __read_mostly = -1;static int monarch_timeout__read_mostly =-1 ;static int mce_panic_timeout__read_mostly ;static int mce_dont_log_ce__read_mostly ; +static int mce_dont_decode__read_mostly ;int mce_cmci_disabled__read_mostly ;int mce_ignore_ce__read_mostly ;int mce_ser__read_mostly ;
@@ -209,6 +210,17 @@ void mce_log(struct mce *mce)set_bit (0 , &mce_need_notify); } +static void call_decoders (struct mce *m) +{ +if (mce_dont_decode) +return ; +/* +* Print out human-readable details about the MCE error, +* (if the CPU has an implementation for that) +*/ +atomic_notifier_call_chain (&x86_mce_decoder_chain,0 , m); +} +static void print_mce (struct mce *m) { pr_emerg(HW_ERR "CPU %d: Machine Check Exception: %Lx Bank %d: %016Lx\n",
@@ -234,11 +246,7 @@ static void print_mce(struct mce *m)pr_emerg (HW_ERR "PROCESSOR %u:%x TIME %llu SOCKET %u APIC %x\n" , m->cpuvendor, m->cpuid, m->time, m->socketid, m->apicid); -/* -* Print out human-readable details about the MCE error, -* (if the CPU has an implementation for that) -*/ -atomic_notifier_call_chain (&x86_mce_decoder_chain,0 , m); +call_decoders (m); }#define PANIC_TIMEOUT 5/* 5 seconds */
@@ -588,7 +596,7 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)*/ if (!(flags &MCP_DONTLOG ) && !mce_dont_log_ce) {mce_log (&m); -atomic_notifier_call_chain (&x86_mce_decoder_chain,0 , &m); +call_decoders (&m);add_taint (TAINT_MACHINE_CHECK ); }
@@ -1700,6 +1708,8 @@ static int __init mcheck_enable(char *str) mce_cmci_disabled =1 ; else if (!strcmp(str, "dont_log_ce")) mce_dont_log_ce =1 ; + else if (!strcmp(str, "dont_decode")) + mce_dont_decode =1 ; else if (!strcmp(str, "ignore_ce")) mce_ignore_ce =1 ; else if (!strcmp(str, "bootlog") || !strcmp(str, "nobootlog"))
@@ -1926,6 +1936,7 @@ static SYSDEV_ATTR(trigger, 0644, show_trigger, set_trigger); static SYSDEV_INT_ATTR(tolerant, 0644, tolerant); static SYSDEV_INT_ATTR(monarch_timeout, 0644, monarch_timeout); static SYSDEV_INT_ATTR(dont_log_ce, 0644, mce_dont_log_ce); +static SYSDEV_INT_ATTR(dont_decode, 0644, mce_dont_decode);static struct sysdev_ext_attribute attr_check_interval = { _SYSDEV_ATTR(check_interval, 0644, sysdev_show_int,
@@ -1949,6 +1960,7 @@ static struct sysdev_attribute *mce_attrs[] = { &attr_trigger, &attr_monarch_timeout.attr, &attr_dont_log_ce.attr, + &attr_dont_decode.attr, &attr_ignore_ce.attr, &attr_cmci_disabled.attr,NULL
Signature · 1 line
1.7.3.1
Quoted 10 lines · Mike Waychison
This patch applies to v2.6.37.
Updated with documentation of the new option.
---On our systems, we do not want to have any "decoders" called on machine check events. These decoders can easily spam our logs and cause space problems on machines that have a lot of correctable error events. We _do_ however want to get the messages delivered via
/dev/mcelogfor userland processing.
Ok, question: how do you guys process DRAM ECCs? And more specifically, with a large number of machines, how do you do the mapping from the DRAM ECC error address reported by MCA to a DIMM that's failing in userspace on a particular machine?
Also, I've worked on trimming down all that decoding output to 3-5 lines. Now it looks like this:
[ 521.677316] [Hardware Error]: MC4_STATUS[Over|UE|MiscV|PCC|AddrV|UECC]: 0xfe00200000080a0f [ 521.686467] [Hardware Error]: Northbridge Error (node 0): DRAM ECC error detected on the NB. [ 521.686498] EDAC MC0: UE page 0x0, offset 0x0, grain 0, row 0, labels ":": amd64_edac [ 521.686501] EDAC MC0: UE - no information available: UE bit is set [ 521.686503] [Hardware Error]: cache level: L3/GEN, mem/io: GEN, mem-tx: GEN, part-proc: RES (no timeout)
and the two lines starting with "EDAC MC0" will get trimmed even more with time. I'm assuming this is not a lot but if you get a lot of correctable error events, then output like that accumulates over time. How about an error thresholding scheme in software then which accumulates the error events and reports only when some configurable thresholds per DRAM device in error have been reached?
Quoted 57 lines
Introduce an interface "
dont_decode" that allows us to skip the decoders. We always call the decoders by default.Google-Bug-Id: 3289142
Signed-off-by Mike Waychison <[email protected]>--- Documentation/x86/x86_64/boot-options.txt | 5 +++++ Documentation/x86/x86_64/machinecheck | 6 ++++++ arch/x86/kernel/cpu/mcheck/mce.c | 24 ++++++++++++++++++------ 3 files changed, 29 insertions(+), 6 deletions(-)Documentation/x86/x86_64/boot-options.txt +5
-0@@ -22,6 +22,11 @@ Machine check as corrected are silently cleared by OS. This option will be useful if you have no interest in any of corrected errors. + mce=dont_decode + Disable in-kernel decoding of errors. Setting this boot + option will cause EDAC to be skipped (if enabled) and no + messages to be printed into the logs. Events will still + be available via /dev/mcelog however. mce=ignore_ce Disable features for corrected errors, e.g. polling timer and CMCI. All events reported as corrected are not clearedDocumentation/x86/x86_64/machinecheck +6
-0@@ -65,6 +65,12 @@ tolerant Note this only makes a difference if the CPU allows recovery from a machine check exception. Current x86 CPUs generally do not. +dont_decode + Disable in-kernel decoding of any errors. Setting this boot + option will cause EDAC to be skipped (if enabled) and no + messages to be printed into the logs. Events will still be + available via /dev/mcelog however. + trigger Program to run when a machine check event is detected. This is an alternative to running mcelog regularly from cronarch/x86/kernel/cpu/mcheck/mce.c +1
-0@@ -82,6 +82,7 @@ static int mce_bootlog __read_mostly = -1;static int monarch_timeout__read_mostly =-1 ;static int mce_panic_timeout__read_mostly ;static int mce_dont_log_ce__read_mostly ; +static int mce_dont_decode__read_mostly ;int mce_cmci_disabled__read_mostly ;int mce_ignore_ce__read_mostly ;int mce_ser__read_mostly ;
arch/x86/kernel/cpu/mcheck/mce.c void mce_log(struct mce *mce) · line 213
Quoted 4 lines
arch/x86/kernel/cpu/mcheck/mce.c +1
-0@@ -209,6 +210,17 @@ void mce_log(struct mce *mce)set_bit (0 , &mce_need_notify); } +static void call_decoders (struct mce *m)
Yeah, let's call this decode_mce().
Quoted 27 lines
arch/x86/kernel/cpu/mcheck/mce.c +11
-5+{ +if (mce_dont_decode) +return ; +/* +* Print out human-readable details about the MCE error, +* (if the CPU has an implementation for that) +*/ +atomic_notifier_call_chain (&x86_mce_decoder_chain,0 , m); +} +static void print_mce (struct mce *m) { pr_emerg(HW_ERR "CPU %d: Machine Check Exception: %Lx Bank %d: %016Lx\n",@@ -234,11 +246,7 @@ static void print_mce(struct mce *m)pr_emerg (HW_ERR "PROCESSOR %u:%x TIME %llu SOCKET %u APIC %x\n" , m->cpuvendor, m->cpuid, m->time, m->socketid, m->apicid); -/* -* Print out human-readable details about the MCE error, -* (if the CPU has an implementation for that) -*/ -atomic_notifier_call_chain (&x86_mce_decoder_chain,0 , m); +call_decoders (m); }#define PANIC_TIMEOUT 5/* 5 seconds */
arch/x86/kernel/cpu/mcheck/mce.c void machine_check_poll(enum mcp_flags flags, mce_banks_t *b) · line 598
Quoted 3 lines
arch/x86/kernel/cpu/mcheck/mce.c +0
-0@@ -588,7 +596,7 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)*/ if (!(flags &MCP_DONTLOG ) && !mce_dont_log_ce) {mce_log (&m);
Also, there's another hook in the function above that does edac_mce_parse(mce) (which shouldnt've been there actually) which is used by the Nehalem driver i7core_edac which does also decode DRAM ECCs.
@Mauro: how about dropping the whole <drivers/edac/edac_mce.c> and using a simple notifier which is much smaller in code and does the same thing?
Signature · 8 lines
Regards/Gruss, Boris. Advanced Micro Devices GmbH Einsteinring 24, 85609 Dornach General Managers: Alberto Bozzo, Andrew Bowd Registration: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632
Quoted 12 lines · Borislav Petkov
Quoted 10 lines · Mike Waychison
This patch applies to v2.6.37.
Updated with documentation of the new option.
---On our systems, we do not want to have any "decoders" called on machine check events. These decoders can easily spam our logs and cause space problems on machines that have a lot of correctable error events. We _do_ however want to get the messages delivered via
/dev/mcelogfor userland processing.
Quoted 4 lines
Ok, question: how do you guys process DRAM ECCs? And more specifically, with a large number of machines, how do you do the mapping from the DRAM ECC error address reported by MCA to a DIMM that's failing in userspace on a particular machine?
We process machine checks in userland, using carnal knowledge of the memory controller and the board specific addressing of the SPDs on the various i2c busses to deswizzle and make sense of the addresses and symptoms. We then expose this digested data on the network, which is dealt with at the cluster level.
Quoted 10 lines
Also, I've worked on trimming down all that decoding output to 3-5 lines. Now it looks like this:
[ 521.677316] [Hardware Error]: MC4_STATUS[Over|UE|MiscV|PCC|AddrV|UECC]:
0xfe00200000080a0f[ 521.686467] [Hardware Error]: Northbridge Error (node 0): DRAM ECC error detected on the NB. [ 521.686498] EDAC MC0: UE page0x0, offset0x0, grain 0, row 0, labels ":":amd64_edac
[ 521.686501] EDAC MC0: UE - no information available: UE bit is set
[ 521.686503] [Hardware Error]: cache level: L3/GEN, mem/io: GEN, mem-tx: GEN, part-proc: RES (no timeout)
Quoted 4 lines
and the two lines starting with "EDAC MC0" will get trimmed even more with time. I'm assuming this is not a lot but if you get a lot of correctable error events, then output like that accumulates over time.
This decoded information is great, but it's only really consumable by a human. We'd _much_ rather have structured data that we know isn't as volatile (in terms of regexes that break with development churn) nor susceptible to corruption (as the logs are not transactional and
are shared by all CPUs concurrently). For the most part, we rarely
rely on the anything automated consuming kernel printk logs, and the bits that do are there only for historical reasons (read: we haven't figured out how to replace them yet). With almost every single kernel version bump we've had, we've found numerous places where strings in the logs have subtly changed, breaking our infrastructure :( Finding these is a painful process and often shows up late in the deployment process. This is disastrous to our deployment schedules as rebooting our number of machines, well, it takes a while...
I'm sorry if this is tangential to your comment above, but I feel the need to have folks recognize that printk() is _not_ a good foundation on which to build automation.
As for using EDAC, I know we tried using it a few years ago, but have since reverted to processing MCE ourselves. I don't know all the details as to why, however Duncan Laurie might be able to share more (CCed).
Quoted 3 lines
How about an error thresholding scheme in software then which accumulates the error events and reports only when some configurable thresholds per DRAM device in error have been reached?
This is pretty much the opposite of what we'd want. We have no use
for anything printed in the logs, though emitting these messages wouldn't be a problem except for those machines which very frequently have MCA events to report. On those machines, the chatter in the logs can potentially wedge our root filesystem (which is tiny) and has the downside that it forces logs to rotate quickly (which means there is less useful data for a human to consume when analyzing what happened on the host). Our policy has been to neuter bits of the kernel that don't know when to stfu :)
Quoted 4 lines
Quoted 2 lines
+static void
call_decoders(struct mce *m)Yeah, let's call this
decode_mce().
OK.
Quoted 26 lines
Quoted 26 lines
arch/x86/kernel/cpu/mcheck/mce.c +10
-0+{ + if (mce_dont_decode) + return; + /* + * Print out human-readable details about the MCE error, + * (if the CPU has an implementation for that) + */ + atomic_notifier_call_chain(&x86_mce_decoder_chain, 0, m); +} +static void
print_mce(struct mce *m)
{
pr_emerg(HW_ERR "CPU %d: Machine Check Exception: %Lx Bank %d: %016Lx\n",arch/x86/kernel/cpu/mcheck/mce.c +1
-5@@ -234,11 +246,7 @@ static void print_mce(struct mce *m) pr_emerg(HW_ERR "PROCESSOR %u:%x TIME %llu SOCKET %u APIC %x\n", m->cpuvendor, m->cpuid, m->time, m->socketid, m->apicid); - /* - * Print out human-readable details about the MCE error, - * (if the CPU has an implementation for that) - */ - atomic_notifier_call_chain(&x86_mce_decoder_chain, 0, m); + call_decoders(m); }
Quoted 9 lines
arch/x86/kernel/cpu/mcheck/mce.c void machine_check_poll(enum mcp_flags flags, mce_banks_t *b) · line 598
Quoted 5 lines
arch/x86/kernel/cpu/mcheck/mce.c +0
-0#define PANIC_TIMEOUT 5 /* 5 seconds */@@ -588,7 +596,7 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)*/ if (!(flags & MCP_DONTLOG) && !mce_dont_log_ce) { mce_log(&m);Also, there's another hook in the function above that does
edac_mce_parse(mce)(which shouldnt've been there actually) which is used by the Nehalem driveri7core_edacwhich does also decode DRAM ECCs.
What should we do with this guy? I'd be happy to send a patch in, but as I mentioned above, we don't use EDAC at all (which is probably why I didn't notice this guy).
Quoted 3 lines
@Mauro: how about dropping the whole <
drivers/edac/edac_mce.c> and using a simple notifier which is much smaller in code and does the same thing?
Ok, let me preface this with an even easier suggestion: Can you simply not compile EDAC (which includes CONFIG_EDAC_DECODE_MCE) in your kernels and the whole issue with decoding disappears simply because no module registers as a decoder...?
Quoted 11 lines · Mike Waychison
Quoted 10 lines
Quoted 5 lines
On our systems, we do not want to have any "decoders" called on machine check events. These decoders can easily spam our logs and cause space problems on machines that have a lot of correctable error events. We _do_ however want to get the messages delivered via
/dev/mcelogfor userland processing.Ok, question: how do you guys process DRAM ECCs? And more specifically, with a large number of machines, how do you do the mapping from the DRAM ECC error address reported by MCA to a DIMM that's failing in userspace on a particular machine?
Quoted 5 lines
We process machine checks in userland, using carnal knowledge of the memory controller and the board specific addressing of the SPDs on the various i2c busses to deswizzle and make sense of the addresses and symptoms. We then expose this digested data on the network, which is dealt with at the cluster level.
Right, and this means that you need to know all the memory controller topologies of all the different architectures and also the SPD accessing based on a board type could be a pain. One of the main reasons for fleshing out MCE decoding in the kernel was to avoid needless trouble like that.
Quoted 14 lines
Quoted 9 lines
Also, I've worked on trimming down all that decoding output to 3-5 lines. Now it looks like this:
[ 521.677316] [Hardware Error]: MC4_STATUS[Over|UE|MiscV|PCC|AddrV|UECC]:
0xfe00200000080a0f[ 521.686467] [Hardware Error]: Northbridge Error (node 0): DRAM ECC error detected on the NB. [ 521.686498] EDAC MC0: UE page0x0, offset0x0, grain 0, row 0, labels ":":amd64_edac
[ 521.686501] EDAC MC0: UE - no information available: UE bit is set
[ 521.686503] [Hardware Error]: cache level: L3/GEN, mem/io: GEN, mem-tx: GEN, part-proc: RES (no timeout)Quoted 4 lines
and the two lines starting with "EDAC MC0" will get trimmed even more with time. I'm assuming this is not a lot but if you get a lot of correctable error events, then output like that accumulates over time.
Quoted 13 lines
This decoded information is great, but it's only really consumable by a human. We'd _much_ rather have structured data that we know isn't as volatile (in terms of regexes that break with development churn) nor susceptible to corruption (as the logs are not transactional and
are shared by all CPUs concurrently). For the most part, we rarely
rely on the anything automated consuming kernel printk logs, and the bits that do are there only for historical reasons (read: we haven't figured out how to replace them yet). With almost every single kernel version bump we've had, we've found numerous places where strings in the logs have subtly changed, breaking our infrastructure :( Finding these is a painful process and often shows up late in the deployment process. This is disastrous to our deployment schedules as rebooting our number of machines, well, it takes a while...
I know exactly what you mean, maybe I should say that the error format is continuously changing because development is still ongoing. But also, I don't think that parsing dmesg is the correct approach; I've heard similar troubles reported by other big server farm people and what I'm currently working on is a RAS daemon that hooks into perf thus enabling persistent performance events. This way, you could open a debugfs file (this'll move to sysfs someday) and read the same decoded data by mmaping the perf ringbuffer.
This is still in an alpha stage, though, but once we have something working we could freeze the exported format (think stable tracepoints) so that you can plug your tools into it and forget all dmesg parsing. Here's a link to give you an impression of what I mean:
http://lwn.net/Articles/413260/
This is -v3 and I'm currently working on -v4 which should be better.
Quoted 3 lines
I'm sorry if this is tangential to your comment above, but I feel the need to have folks recognize that
printk()is _not_ a good foundation on which to build automation.
Agreed.
Quoted 4 lines
As for using EDAC, I know we tried using it a few years ago, but have since reverted to processing MCE ourselves. I don't know all the details as to why, however Duncan Laurie might be able to share more (CCed).
It should be in much better shape now :).
Quoted 4 lines
Quoted 3 lines
How about an error thresholding scheme in software then which accumulates the error events and reports only when some configurable thresholds per DRAM device in error have been reached?
Quoted 9 lines
This is pretty much the opposite of what we'd want. We have no use
for anything printed in the logs, though emitting these messages wouldn't be a problem except for those machines which very frequently have MCA events to report. On those machines, the chatter in the logs can potentially wedge our root filesystem (which is tiny) and has the downside that it forces logs to rotate quickly (which means there is less useful data for a human to consume when analyzing what happened on the host). Our policy has been to neuter bits of the kernel that don't know when to stfu :)
Ok, see above. I think with the RAS daemon you could easily make it even send _decoded_ error records over the network to a central collecting machine instead of parsing the logs. Then you can simplify your userspace post-processing too.
[..]
Quoted 7 lines
Quoted 3 lines
Also, there's another hook in the function above that does
edac_mce_parse(mce)(which shouldnt've been there actually) which is used by the Nehalem driveri7core_edacwhich does also decode DRAM ECCs.What should we do with this guy? I'd be happy to send a patch in, but as I mentioned above, we don't use EDAC at all (which is probably why I didn't notice this guy).
I think this is also easy disabled by not configuring EDAC, as I said above. Basically, if you don't enable EDAC, you can drop that patch too and run your kernels without any modification, or am I missing something..?
Thoughts?
Signature · 8 lines
Regards/Gruss, Boris. Advanced Micro Devices GmbH Einsteinring 24, 85609 Dornach General Managers: Alberto Bozzo, Andrew Bowd Registration: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632
Quoted 4 lines · Borislav Petkov
Ok, let me preface this with an even easier suggestion: Can you simply not compile EDAC (which includes
CONFIG_EDAC_DECODE_MCE) in your kernels and the whole issue with decoding disappears simply because no module registers as a decoder...?
The trouble here is that default_decode_mce() is still getting called no matter what :( It didn't really cause problems until you added atomic_notifier_call_chain(&x86_mce_decoder_chain, 0, &m) to machine_check_poll().
Quoted 18 lines · Mike Waychison
Quoted 11 lines
Quoted 10 lines
Quoted 5 lines
On our systems, we do not want to have any "decoders" called on machine check events. These decoders can easily spam our logs and cause space problems on machines that have a lot of correctable error events. We _do_ however want to get the messages delivered via
/dev/mcelogfor userland processing.Ok, question: how do you guys process DRAM ECCs? And more specifically, with a large number of machines, how do you do the mapping from the DRAM ECC error address reported by MCA to a DIMM that's failing in userspace on a particular machine?
Quoted 5 lines
We process machine checks in userland, using carnal knowledge of the memory controller and the board specific addressing of the SPDs on the various i2c busses to deswizzle and make sense of the addresses and symptoms. We then expose this digested data on the network, which is dealt with at the cluster level.
Quoted 5 lines
Right, and this means that you need to know all the memory controller topologies of all the different architectures and also the SPD accessing based on a board type could be a pain. One of the main reasons for fleshing out MCE decoding in the kernel was to avoid needless trouble like that.
It's not that painful for us. Our firmware guys own this userland code :) I can see it being a pain for others however.
Doing this all in userland does have it's upsides as well fwiw. For example, MC4 is usually kept around across a reset, which means that the firmware can pick it up when the system goes down due to a processor context corruption. We rely on these libraries as well to decode egregious uncorrectable memory errors as well as bus errors (like hypertransport sync floods).
*snip*
Quoted 6 lines
I've
heard similar troubles reported by other big server farm people and what I'm currently working on is a RAS daemon that hooks into perf thus enabling persistent performance events. This way, you could open a debugfs file (this'll move to sysfs someday) and read the same decoded data by mmaping the perf ringbuffer.
I'll definitely keep an eye out for your developments with RAS :)
Quoted 5 lines
I think this is also easy disabled by not configuring EDAC, as I said above. Basically, if you don't enable EDAC, you can drop that patch too and run your kernels without any modification, or am I missing something..?
See the comment above. It's the spamming for the default decoder that I wanted to disable specifically, though my approach was a knob to disable decoders generally.
Quoted 6 lines · Mike Waychison
As for using EDAC, I know we tried using it a few years ago, but have since reverted to processing MCE ourselves. I don't know all the details as to why, however Duncan Laurie might be able to share more (CCed).
The short answer is that we needed access to the raw chipset error registers rather than the parsed and collated counters (or printk output) that we got with EDAC.
The long answer is that our goals have changed over time. For a long time our goal with ECC was simply identifying the actual bad DIMM in a system so it can be replaced. For systems which report ECC via machine checks this is done by collecting the physical addresses and converting it with an external utility. For other systems which did not report memory errors via machine checks EDAC was used to poll and decode the chipset error registers and export row+channel sysfs counters because there was not a physical memory address supplied with each event.
However as the scale of our operations grows so too does the number of DIMMs that have to be replaced. By gathering and analyzing complete error data (row, column, bank, rank, etc) we are able to identify if there is a single chip on a module that is bad, which could potentially get repaired rather than replacing the whole module.
Gathering this data is easy enough with machine checks since you have the physical address on which it occurred and doing the translation of that address into a particular DIMM ends up providing the other relevant geometry information along the way. It also has a convenient interface via mcelog that makes it easy to consume the event and do the translation in userspace (as long as you run with a high mce tolerance level) and has other advantages of being able to develop and maintain the utility outside of our internal kernel release schedule.
For platforms that were reporting counters via EDAC there are several values that need to be read from different chipset registers and exported. Because parsing printk output for this data is messy we decided that rather than invent another mcelog type interface (or subvert an existing interface) we might as well do the polling for events in userspace and simply save all the data we care about at that point.
As has been noted this requires us to have intimate knowledge of the hardware that we're running on. It isn't an approach that I would recommend to many and your efforts to do decoding of errors with EDAC is something that most people will benefit from.
-duncan
Borislav Petkov
Acked-byQuoted 10 lines · Mike Waychison
Quoted 4 lines · Borislav Petkov
Ok, let me preface this with an even easier suggestion: Can you simply not compile EDAC (which includes
CONFIG_EDAC_DECODE_MCE) in your kernels and the whole issue with decoding disappears simply because no module registers as a decoder...?The trouble here is that
default_decode_mce()is still getting called no matter what :( It didn't really cause problems until you addedatomic_notifier_call_chain(&x86_mce_decoder_chain, 0, &m)tomachine_check_poll().
Yeah, I figured as much... after hitting send :(. Feel free to add my
to your patch.
Quoted 8 lines
Quoted 5 lines
Right, and this means that you need to know all the memory controller topologies of all the different architectures and also the SPD accessing based on a board type could be a pain. One of the main reasons for fleshing out MCE decoding in the kernel was to avoid needless trouble like that.
It's not that painful for us. Our firmware guys own this userland code :) I can see it being a pain for others however.
Yeah, what we actually need is a chipset-agnostic way (ACPI maybe?) of mapping chip selects to the actual DIMMs so all that above can be avoided...
Quoted 4 lines
Doing this all in userland does have it's upsides as well fwiw. For example, MC4 is usually kept around across a reset, which means that the firmware can pick it up when the system goes down due to a processor context corruption.
True, although not always reliable due to that context corruption. Tony Luck is adding code for writing the error information to a persistent storage _before_ you reset so on platforms with such a device you'll be able to look at MC4 (or any of the MCE regs, for that matter) after reset, which, I think, would make error analysis much more convenient. See http://marc.info/?l=linux-arch&m=129356804427008&w=2.
Quoted 2 lines
We rely on these libraries as well to decode egregious uncorrectable memory errors as well as bus errors (like hypertransport sync floods).
Yeah, I don't think error decoding would help, at least on AMD, with uncorrectable errors causing syncflood. We might do something about it though :).
Quoted 8 lines
Quoted 6 lines
I've
heard similar troubles reported by other big server farm people and what I'm currently working on is a RAS daemon that hooks into perf thus enabling persistent performance events. This way, you could open a debugfs file (this'll move to sysfs someday) and read the same decoded data by mmaping the perf ringbuffer.I'll definitely keep an eye out for your developments with RAS :)
Cool, I think I have the bulk of your requirements now, from your and Duncan's mails. I'm always open for other suggestions too.
Thanks.
Signature · 8 lines
Regards/Gruss, Boris. Advanced Micro Devices GmbH Einsteinring 24, 85609 Dornach General Managers: Alberto Bozzo, Andrew Bowd Registration: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632
PATCH 1/1 x86: Add an option to disable decoding of MCE
v3
This patch applies to v2.6.37.
Updated with documentation of the new option.
Renamed call_decoders() -> decode_mce()
---
On our systems, we do not want to have any "decoders" called on machine check events. These decoders can easily spam our logs and cause space problems on machines that have a lot of correctable error events. We _do_ however want to get the messages delivered via /dev/mcelog for userland processing.
Introduce an interface "dont_decode" that allows us to skip the decoders. We always call the decoders by default.
Google-Bug-Id: 3289142
--- Documentation/x86/x86_64/boot-options.txt | 5 +++++ Documentation/x86/x86_64/machinecheck | 6 ++++++ arch/x86/kernel/cpu/mcheck/mce.c | 24 ++++++++++++++++++------ 3 files changed, 29 insertions(+), 6 deletions(-)
Documentation/x86/x86_64/boot-options.txt +5 -0
@@ -22,6 +22,11 @@ Machine check as corrected are silently cleared by OS. This option will be useful if you have no interest in any of corrected errors. + mce=dont_decode + Disable in-kernel decoding of errors. Setting this boot + option will cause EDAC to be skipped (if enabled) and no + messages to be printed into the logs. Events will still + be available via /dev/mcelog however. mce=ignore_ce Disable features for corrected errors, e.g. polling timer and CMCI. All events reported as corrected are not cleared
Documentation/x86/x86_64/machinecheck +6 -0
@@ -65,6 +65,12 @@ tolerant Note this only makes a difference if the CPU allows recovery from a machine check exception. Current x86 CPUs generally do not. +dont_decode + Disable in-kernel decoding of any errors. Setting this boot + option will cause EDAC to be skipped (if enabled) and no + messages to be printed into the logs. Events will still be + available via /dev/mcelog however. + trigger Program to run when a machine check event is detected. This is an alternative to running mcelog regularly from cron
arch/x86/kernel/cpu/mcheck/mce.c +18 -6
@@ -82,6 +82,7 @@ static int mce_bootlog __read_mostly = -1;static int monarch_timeout__read_mostly =-1 ;static int mce_panic_timeout__read_mostly ;static int mce_dont_log_ce__read_mostly ; +static int mce_dont_decode__read_mostly ;int mce_cmci_disabled__read_mostly ;int mce_ignore_ce__read_mostly ;int mce_ser__read_mostly ;
@@ -209,6 +210,17 @@ void mce_log(struct mce *mce)set_bit (0 , &mce_need_notify); } +static void decode_mce (struct mce *m) +{ +if (mce_dont_decode) +return ; +/* +* Print out human-readable details about the MCE error, +* (if the CPU has an implementation for that) +*/ +atomic_notifier_call_chain (&x86_mce_decoder_chain,0 , m); +} +static void print_mce (struct mce *m) { pr_emerg(HW_ERR "CPU %d: Machine Check Exception: %Lx Bank %d: %016Lx\n",
@@ -234,11 +246,7 @@ static void print_mce(struct mce *m)pr_emerg (HW_ERR "PROCESSOR %u:%x TIME %llu SOCKET %u APIC %x\n" , m->cpuvendor, m->cpuid, m->time, m->socketid, m->apicid); -/* -* Print out human-readable details about the MCE error, -* (if the CPU has an implementation for that) -*/ -atomic_notifier_call_chain (&x86_mce_decoder_chain,0 , m); +decode_mce (m); }#define PANIC_TIMEOUT 5/* 5 seconds */
@@ -588,7 +596,7 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)*/ if (!(flags &MCP_DONTLOG ) && !mce_dont_log_ce) {mce_log (&m); -atomic_notifier_call_chain (&x86_mce_decoder_chain,0 , &m); +decode_mce (&m);add_taint (TAINT_MACHINE_CHECK ); }
@@ -1700,6 +1708,8 @@ static int __init mcheck_enable(char *str) mce_cmci_disabled =1 ; else if (!strcmp(str, "dont_log_ce")) mce_dont_log_ce =1 ; + else if (!strcmp(str, "dont_decode")) + mce_dont_decode =1 ; else if (!strcmp(str, "ignore_ce")) mce_ignore_ce =1 ; else if (!strcmp(str, "bootlog") || !strcmp(str, "nobootlog"))
@@ -1926,6 +1936,7 @@ static SYSDEV_ATTR(trigger, 0644, show_trigger, set_trigger); static SYSDEV_INT_ATTR(tolerant, 0644, tolerant); static SYSDEV_INT_ATTR(monarch_timeout, 0644, monarch_timeout); static SYSDEV_INT_ATTR(dont_log_ce, 0644, mce_dont_log_ce); +static SYSDEV_INT_ATTR(dont_decode, 0644, mce_dont_decode);static struct sysdev_ext_attribute attr_check_interval = { _SYSDEV_ATTR(check_interval, 0644, sysdev_show_int,
@@ -1949,6 +1960,7 @@ static struct sysdev_attribute *mce_attrs[] = { &attr_trigger, &attr_monarch_timeout.attr, &attr_dont_log_ce.attr, + &attr_dont_decode.attr, &attr_ignore_ce.attr, &attr_cmci_disabled.attr,NULL
Signature · 1 line
1.7.3.1
Quoted 6 lines · Borislav Petkov
True, although not always reliable due to that context corruption. Tony Luck is adding code for writing the error information to a persistent storage _before_ you reset so on platforms with such a device you'll be able to look at MC4 (or any of the MCE regs, for that matter) after reset, which, I think, would make error analysis much more convenient. See http://marc.info/?l=linux-arch&m=129356804427008&w=2.
This code is also in linux-next (any next-2011* tag). I'd be very happy to get some testing reports, feedback on the code, etc.
-Tony
Quoted 10 lines · Mike Waychison
figured out how to replace them yet). With almost every single kernel version bump we've had, we've found numerous places where strings in the logs have subtly changed, breaking our infrastructure :( Finding these is a painful process and often shows up late in the deployment process. This is disastrous to our deployment schedules as rebooting our number of machines, well, it takes a while...
I'm sorry if this is tangential to your comment above, but I feel the need to have folks recognize that
printk()is _not_ a good foundation on which to build automation.
Congratulations .... you made the lwn.net "quote of the week"
http://lwn.net/Articles/421784
- wider distribution of this wisdom is a very good thing.
-Tony