x86/mce: Use arch atomic and bit helpers
authorBorislav Petkov <bp@suse.de>
Fri, 4 Feb 2022 08:30:15 +0000 (09:30 +0100)
committerBorislav Petkov <bp@suse.de>
Sun, 13 Feb 2022 21:08:27 +0000 (22:08 +0100)
commitf11445ba7a1160b87615e3f863a9e66c85189399
treec3b112eda547064b88cda1ce205db22e0e59b179
parentc0f6799de2a08f3860e8c13f85a7b9db51563ee0
x86/mce: Use arch atomic and bit helpers

The arch helpers do not have explicit KASAN instrumentation. Use them in
noinstr code.

Inline a couple more functions with single call sites, while at it:

mce_severity_amd_smca() has a single call-site which is noinstr so force
the inlining and fix:

  vmlinux.o: warning: objtool: mce_severity_amd.constprop.0()+0xca: call to \
  mce_severity_amd_smca() leaves .noinstr.text section

Always inline mca_msr_reg():

     text    data     bss     dec     hex filename
  16065240        128031326       36405368        180501934       ac23dae vmlinux.before
  16065240        128031294       36405368        180501902       ac23d8e vmlinux.after

and mce_no_way_out() as the latter one is used only once, to fix:

  vmlinux.o: warning: objtool: mce_read_aux()+0x53: call to mca_msr_reg() leaves .noinstr.text section
  vmlinux.o: warning: objtool: do_machine_check()+0xc9: call to mce_no_way_out() leaves .noinstr.text section

Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Marco Elver <elver@google.com>
Link: https://lore.kernel.org/r/20220204083015.17317-4-bp@alien8.de
arch/x86/kernel/cpu/mce/core.c
arch/x86/kernel/cpu/mce/internal.h
arch/x86/kernel/cpu/mce/severity.c