]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
x86/mce: Add wrapper for struct mce to export vendor specific info
authorAvadhut Naik <avadhut.naik@amd.com>
Tue, 22 Oct 2024 19:36:27 +0000 (19:36 +0000)
committerBorislav Petkov (AMD) <bp@alien8.de>
Wed, 30 Oct 2024 16:18:59 +0000 (17:18 +0100)
commit750fd23926f1507cc826b5a4fdd4bfc7283e7723
treedf9b035e01d6f501e4eef7a66d2be0c03a122583
parent754269ccf03d68da15b9e5cdd26a6464b81cec67
x86/mce: Add wrapper for struct mce to export vendor specific info

Currently, exporting new additional machine check error information
involves adding new fields for the same at the end of the struct mce.
This additional information can then be consumed through mcelog or
tracepoint.

However, as new MSRs are being added (and will be added in the future)
by CPU vendors on their newer CPUs with additional machine check error
information to be exported, the size of struct mce will balloon on some
CPUs, unnecessarily, since those fields are vendor-specific. Moreover,
different CPU vendors may export the additional information in varying
sizes.

The problem particularly intensifies since struct mce is exposed to
userspace as part of UAPI. It's bloating through vendor-specific data
should be avoided to limit the information being sent out to userspace.

Add a new structure mce_hw_err to wrap the existing struct mce. The same
will prevent its ballooning since vendor-specifc data, if any, can now be
exported through a union within the wrapper structure and through
__dynamic_array in mce_record tracepoint.

Furthermore, new internal kernel fields can be added to the wrapper
struct without impacting the user space API.

  [ bp: Restore reverse x-mas tree order of function vars declarations. ]

Suggested-by: Borislav Petkov (AMD) <bp@alien8.de>
Signed-off-by: Avadhut Naik <avadhut.naik@amd.com>
Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
Link: https://lore.kernel.org/r/20241022194158.110073-2-avadhut.naik@amd.com
arch/x86/include/asm/mce.h
arch/x86/kernel/cpu/mce/amd.c
arch/x86/kernel/cpu/mce/apei.c
arch/x86/kernel/cpu/mce/core.c
arch/x86/kernel/cpu/mce/genpool.c
arch/x86/kernel/cpu/mce/inject.c
arch/x86/kernel/cpu/mce/internal.h
include/trace/events/mce.h