Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751889AbbKJWLh (ORCPT ); Tue, 10 Nov 2015 17:11:37 -0500 Received: from mga03.intel.com ([134.134.136.65]:34558 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751615AbbKJWLg (ORCPT ); Tue, 10 Nov 2015 17:11:36 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,272,1444719600"; d="scan'208";a="833335746" Date: Tue, 10 Nov 2015 14:11:35 -0800 From: "Luck, Tony" To: Borislav Petkov Cc: linux-kernel@vger.kernel.org, linux-edac@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH 2/3] x86, ras: Extend machine check recovery code to annotated ring0 areas Message-ID: <20151110221134.GC28172@agluck-desk.sc.intel.com> References: <20151110112142.GD19187@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151110112142.GD19187@pd.tnic> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1524 Lines: 45 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/