Re: [PATCH v5 2/2] x86/mce: Add support for Extended Physical Address MCA changes

Luck, Tony
2022-04-13T15:59:50Z

On Wed, Apr 13, 2022 at 04:54:00PM +0200, Borislav Petkov wrote:
> + if (!mca_cfg.bootlog)
> + m_fl = MCP_DONTLOG;
>
> -/*
> - * Do a final check to see if there are any unused/RAZ banks.
> - *
> - * This must be done after the banks have been initialized and any quirks have
> - * been applied.
> - *
> - * Do not call this from any user-initiated flows, e.g. CPU hotplug or sysfs.
> - * Otherwise, a user who disables a bank will not be able to re-enable it
> - * without a system reboot.
> - */
> -static void __mcheck_cpu_check_banks(void)
> -{
> - struct mce_bank *mce_banks = this_cpu_ptr(mce_banks_array);
> - u64 msrval;
> - int i;
> + /*
> + * Log the machine checks left over from the previous reset. Log them
> + * only, do not start processing them. That will happen in mcheck_late_init()
> + * when all consumers have been registered on the notifier chain.
> + */
> + bitmap_fill(all_banks, MAX_NR_BANKS);
> + machine_check_poll(MCP_UC | MCP_QUEUE_LOG | m_fl, &all_banks);

If MCP_DONTLOG bit is set, then this does little. It will find
banks with valid records, NOT log them, clear them. But then we
loop and clear all banks.

So maybe do:

if (mca_cfg.bootlog) {
bitmap_fill(all_banks, MAX_NR_BANKS);
machine_check_poll(MCP_UC | MCP_QUEUE_LOG, &all_banks);
}

> __mcheck_cpu_init_clear_banks();

This will a new name to indicate that it is logging as well as init & clear.

Otherwise seeems fine.

-Tony