mcelog, fix buffer overflow warning

The current code does (flags & MCE_OVERFLOW) in the buffer overflow check.
MCE_OVERFLOW is defined as 0 (the bit position) and the check is always
false.

This patch resolves the problem by correctly using the MCE_OVERFLOW as a
bit position.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Add better decoding support for Haswell server processors

Software developer manual rev 052 released in September 2014
provides more detail on the MSCOD values for PCU, QPI and IMC banks.

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
More compact data structures for reporting SNB/IVB memory controller errors

While working on Haswell server support we cloned ivy-bridge.c as
a base - and then noticed that the tables to report MSCOD values
in memory controller banks did not report correctly when more than
one bit was set in the field, so converted it to use SBITFIELD()
entries for each bit.

It isn't clear whether Sandy Bridge or Ivy Bridge will ever report
more than one bit set in their memory controller MSCOD fields - but
it is worth converting them too for a more compact representation.

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Update some Xeon CPU names to official names

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Add a trigger for IO-MCA errors

mcelog socket triggers currently only trigger on memory
(and possibly yellow bit) errors.

This patch enables mcelog to trigger a custom action on
the Bus and Interconnect errors, including IO MCA.

[AK: Minor cleanups. Fix warnings.]
Signed-off-by: Rui Wang <rui.y.wang@intel.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Fix incorrect asprintf in yellow.c

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Add a trigger for unknown machine check errors

Mcelog now triggers custom actions on all kinds of
errors, either defined or undefined.

[AK: Slightly improve comments. Fix warnings.]
Signed-off-by: Rui Wang <rui.y.wang@intel.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Do not exit if imc_log setting fails

This can happen on virtual guests, in this case vmware:
https://bugzilla.novell.com/show_bug.cgi?id=827616

[AK: Improve warning message]
Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Return by default if no CPU matches in set_imc_log

Do not issue uninitialized msr values if set_imc_log is called on
unsupported CPUs.

This is code clean up (makes it more robust).

Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Skip Hardware error prefix

The kernel prefixes the lines that we want to parse with both the
module name ("mce") and the HW_ERR indicator ("[Hardware Error]") both
suffixed with a ":".  Allow users to paste the raw kernel output from
serial console or dmesg(8) output by making mcelog skip over this to
get to the meat of the message.

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Add a test case for iomca and unknown triggers

Signed-off-by: Andi Kleen <ak@linux.intel.com>