RE: [PATCH v3 5/6] x86/MCE: Save MCA control bits that get set in hardware

From: Ghannam, Yazen
Date: Fri Jun 07 2019 - 10:53:59 EST


> -----Original Message-----
> From: Borislav Petkov <bp@xxxxxxxxx>
> Sent: Monday, May 27, 2019 6:29 PM
> To: Ghannam, Yazen <Yazen.Ghannam@xxxxxxx>
> Cc: Luck, Tony <tony.luck@xxxxxxxxx>; linux-edac@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; x86@xxxxxxxxxx
> Subject: Re: [PATCH v3 5/6] x86/MCE: Save MCA control bits that get set in hardware
>
>
> I guess the cleanest way to handle his properly would be to have a
> function called something like __mcheck_cpu_init_banks() which gets
> called in mcheck_cpu_init() after the quirks have run and then does the
> final poking of the banks and sets b->init properly.
>
> __mcheck_cpu_init_clear_banks() should then be renamed to
> __mcheck_cpu_clear_banks() to denote that it only clears the banks and
> would only do:
>
> if (!b->init)
> continue;
>
> wrmsrl(msr_ops.ctl(i), b->ctl);
> wrmsrl(msr_ops.status(i), 0);
>

Would you mind if the function name stayed the same? The reason is that MCA_CTL is written here, which is the "init" part, and MCA_STATUS is cleared.

I can use another name for the check, e.g. __mcheck_cpu_check_banks() or __mcheck_cpu_banks_check_init().

Thanks,
Yazen