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

From: Luck, Tony
Date: Fri May 17 2019 - 14:08:18 EST


On Fri, May 17, 2019 at 07:48:17PM +0200, Borislav Petkov wrote:
> @@ -1562,15 +1567,21 @@ static void __mcheck_cpu_init_generic(void)
> static void __mcheck_cpu_init_clear_banks(void)
> {
> struct mce_bank *mce_banks = this_cpu_read(mce_banks_array);
> + u64 msrval;
> int i;
>
> for (i = 0; i < this_cpu_read(mce_num_banks); i++) {
> struct mce_bank *b = &mce_banks[i];
>
> - if (!b->init)
> - continue;
> - wrmsrl(msr_ops.ctl(i), b->ctl);
> - wrmsrl(msr_ops.status(i), 0);
> + if (b->init) {
> + /* Check if any bits are implemented in h/w */
> + wrmsrl(msr_ops.ctl(i), b->ctl);
> + rdmsrl(msr_ops.ctl(i), msrval);
> +
> + b->init = !!msrval;
> +
> + wrmsrl(msr_ops.status(i), 0);
> + }
> }
> }

Am I misreading the diff here? It doesn't look like you
needed to drop the

if (!b->init)
continue;

and thus end up with that extra level on indent for the rest
of the function.

-Tony