Re: [PATCH 2/3] x86, ras: Extend machine check recovery code to annotated ring0 areas

Luck, Tony
2015-11-10T22:11:37Z

On Tue, Nov 10, 2015 at 12:21:42PM +0100, Borislav Petkov wrote:
> You could save a precious indentation level here:
>
> if (cfg->tolerant == 3)
> goto clear;
>
> and add the "clear" label below.
>
> clear:
> if (worst > 0)
> mce_report_event(regs);
> mce_wrmsrl(MSR_IA32_MCG_STATUS, 0)
>
> > if (no_way_out)
> > mce_panic("Fatal machine check on current CPU", &m, msg);
> > if (worst == MCE_AR_SEVERITY) {
> > - recover_paddr = m.addr;
> > - if (!(m.mcgstatus & MCG_STATUS_RIPV))
> > - flags |= MF_MUST_KILL;
> > + if ((m.cs & 3) == 3) {
> > + recover_paddr = m.addr;
> > + if (!(m.mcgstatus & MCG_STATUS_RIPV))
> > + flags |= MF_MUST_KILL;
> > + } else if (fixup_mcexception(regs)) {
> > + regs->ax = BIT(63) | m.addr;
> > + } else
> > + mce_panic("Failed kernel mode recovery",
> > + &m, NULL);
> > } else if (kill_it) {
> > force_sig(SIGBUS, current);
> > }

That would be tidier ... the inside of the "if" has been gradually growing
with added recovery paths. I had to fold the mce_panic() line to shut
checkpatch up.

But I'm not really sure what tolerant==3 people really want here. By skipping
the recovery code they doom themselves to hitting the machine check again.

-Tony