Messages in this thread | ![/](/images/icornerl.gif) | | Date | Tue, 10 Nov 2015 14:11:35 -0800 | From | "Luck, Tony" <> | Subject | Re: [PATCH 2/3] x86, ras: Extend machine check recovery code to annotated ring0 areas |
| |
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
| ![\](/images/icornerr.gif) |