Re: [PATCH 2/4] x86/mce: Get rid of machine_check_vector

From: Borislav Petkov
Date: Mon Sep 20 2021 - 04:15:29 EST


On Mon, Sep 20, 2021 at 09:42:22AM +0200, Rasmus Villemoes wrote:
> And, since in the concrete case mca_config just has four bool members
> before the bitfields, we see that the 1-bit bitfields are put within the
> first 8 bytes of the struct, while the __reserved field gets an entire
> u64 all to itself:

I probably should move that into alignment.

> But why the messy mix between 1-bit bitfields and _Bools in the first place?

My intention was to convert those boolean flags into a bitfield.
But you can't convert them all, unfortunately:

In file included from ./include/linux/miscdevice.h:7,
from arch/x86/kernel/cpu/mce/core.c:14:
./include/linux/device.h:148:64: error: cannot take address of bit-field ‘dont_log_ce’
148 | { __ATTR(_name, _mode, device_show_bool, device_store_bool), &(_var) }
| ^
arch/x86/kernel/cpu/mce/core.c:2415:8: note: in expansion of macro ‘DEVICE_BOOL_ATTR’
2415 | static DEVICE_BOOL_ATTR(dont_log_ce, 0644, mca_cfg.dont_log_ce);
| ^~~~~~~~~~~~~~~~
make[4]: *** [scripts/Makefile.build:277: arch/x86/kernel/cpu/mce/core.o] Error 1
make[3]: *** [scripts/Makefile.build:540: arch/x86/kernel/cpu/mce] Error 2
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [scripts/Makefile.build:540: arch/x86/kernel/cpu] Error 2
make[1]: *** [scripts/Makefile.build:540: arch/x86/kernel] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1874: arch/x86] Error 2
make: *** Waiting for unfinished jobs....

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette