• Ingo Molnar's avatar
    x86: mce: Use safer ways to access MCE registers · 11868a2d
    Ingo Molnar authored
    Use rdmsrl_safe() when accessing MCE registers. While in
    theory we always 'know' which ones are safe to access from
    the capability bits, there's a lot of hardware variations
    and reality might differ from theory, as it did in this case:
    
       http://bugzilla.kernel.org/show_bug.cgi?id=14204
    
    [    0.010016] mce: CPU supports 5 MCE banks
    [    0.011029] general protection fault: 0000 [#1]
    [    0.011998] last sysfs file:
    [    0.011998] Modules linked in:
    [    0.011998]
    [    0.011998] Pid: 0, comm: swapper Not tainted (2.6.31_router #1) HP Vectra
    [    0.011998] EIP: 0060:[<c100d9b9>] EFLAGS: 00010246 CPU: 0
    [    0.011998] EIP is at mce_rdmsrl+0x19/0x60
    [    0.011998] EAX: 00000000 EBX: 00000001 ECX: 00000407 EDX: 08000000
    [    0.011998] ESI: 00000000 EDI: 8c000000 EBP: 00000405 ESP: c17d5eac
    
    So WARN_ONCE() instead of crashing the box.
    
    ( also fix a number of stylistic inconsistencies in the code. )
    
    Note, we might still crash in wrmsrl() if we get that far, but
    we shouldnt if the registers are truly inaccessible.
    Reported-by: default avatarGNUtoo <GNUtoo@no-log.org>
    Cc: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
    Cc: Huang Ying <ying.huang@intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    LKML-Reference: <bug-14204-5438@http.bugzilla.kernel.org/>
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    11868a2d
mce.c 47.7 KB