]> git.baikalelectronics.ru Git - kernel.git/commit
x86/mce: Defer processing of early errors
authorBorislav Petkov <bp@alien8.de>
Tue, 24 Aug 2021 00:31:29 +0000 (17:31 -0700)
committerBorislav Petkov <bp@suse.de>
Tue, 24 Aug 2021 08:40:58 +0000 (10:40 +0200)
commit1c8d2f770b32cdfca5b0ea4855f714bcd2becc52
treeecc7480906fcaa89b90f2d82910fe7bc8936cc59
parentce1c8ff730a9d52cea6c427c4d2fbd6de7a3061a
x86/mce: Defer processing of early errors

When a fatal machine check results in a system reset, Linux does not
clear the error(s) from machine check bank(s) - hardware preserves the
machine check banks across a warm reset.

During initialization of the kernel after the reboot, Linux reads, logs,
and clears all machine check banks.

But there is a problem. In:

  e9a1be223bb5 ("x86/mce: Factor out and deprecate the /dev/mcelog driver")

the call to mce_register_decode_chain() moved later in the boot
sequence. This means that /dev/mcelog doesn't see those early error
logs.

This was partially fixed by:

  479cd2be983d ("x86/MCE: Dump MCE to dmesg if no consumers")

which made sure that the logs were not lost completely by printing
to the console. But parsing console logs is error prone. Users of
/dev/mcelog should expect to find any early errors logged to standard
places.

Add a new flag MCP_QUEUE_LOG to machine_check_poll() to be used in early
machine check initialization to indicate that any errors found should
just be queued to genpool. When mcheck_late_init() is called it will
call mce_schedule_work() to actually log and flush any errors queued in
the genpool.

 [ Based on an original patch, commit message by and completely
   productized by Tony Luck. ]

Fixes: e9a1be223bb5 ("x86/mce: Factor out and deprecate the /dev/mcelog driver")
Reported-by: Sumanth Kamatala <skamatala@juniper.net>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20210824003129.GA1642753@agluck-desk2.amr.corp.intel.com
arch/x86/include/asm/mce.h
arch/x86/kernel/cpu/mce/core.c