RE: [PATCH v6 2/4] x86/mce: Remove __mcheck_cpu_init_early()

From: Luck, Tony
Date: Tue Jan 03 2023 - 15:54:57 EST


> Yeah, looking at this, before and after the change, what we are and were
> doing here is silly. Those flags are global for the whole system but we
> do set them on each CPU - unnecessarily, ofc ;-\ - because we don't have
> a BSP MCE init call.
>
> That above happens on the mcheck_cpu_init() path which is per-CPU.
>
> However, if we had to be precise and correct, this flags setup should
> happen in a function called
>
> mcheck_bsp_init()
>
> or so which gets called at the end of identify_boot_cpu() and which does
> all the *once* actions there like allocate the gen pool, run the quirks
> which need to run only once on the BSP and so on.
>
> So that we don't have to do unnecessary work on every CPU.
>
> Tony, thoughts?
>
> I think we should start working towards this - doesn't have to be done
> immediately but I think a proper separation of what runs where - once
> on the BSP or on every CPU - is needed here. Unless I'm missing an
> important angle, which is entirely possible.

Cleanup sounds good. But do we need a new mcheck_bsp_init() function?

Can the "only once" stuff be done from mcheck_init()? Or does it rely on
things that aren't set up that early?

-Tony