x86/mce: Avoid reading every machine check bank register twice.
authorTony Luck <tony.luck@intel.com>
Wed, 18 Apr 2012 22:19:40 +0000 (15:19 -0700)
committerTony Luck <tony.luck@intel.com>
Thu, 19 Apr 2012 16:12:43 +0000 (09:12 -0700)
commit95022b8cf6ed7f3292b60c8e85fe59a12bfb1c9e
treed0af3bb590eadc51cf0ad8f08a4b91fad2cd3433
parent0034102808e0dbbf3a2394b82b1bb40b5778de9e
x86/mce: Avoid reading every machine check bank register twice.

Reading machine check bank registers is slow. There is a trend of
increasing the number of banks, and the number of cores. The main section
of do_machine_check() is a serialized section where each cpu in turn
checks every bank. Even on a little two socket SandyBridge-EP system
that multiplies out as:

2 sockets * 8 cores * 2 hyperthreads * 20 banks = 640 MSRs

We already scan the banks in parallel in mce_no_way_out() to see if there
is a fatal error anywhere in the system. If we build a cache of VALID
bits during this scan, we can avoid uselessly re-reading banks that have
no data. Note that this cache is only a hint. If the valid bit is set in a
shared bank, all cpus that share that bank will see it during the parallel
scan, but the first to find it in the sequential scan will (usually) clear
the bank.

Acked-by: Borislav Petkov <borislav.petkov@amd.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
arch/x86/kernel/cpu/mcheck/mce.c