Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933114AbbLOBB2 (ORCPT ); Mon, 14 Dec 2015 20:01:28 -0500 Received: from mga09.intel.com ([134.134.136.24]:35411 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932795AbbLOBB1 (ORCPT ); Mon, 14 Dec 2015 20:01:27 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,429,1444719600"; d="scan'208";a="871508126" Date: Mon, 14 Dec 2015 17:00:59 -0800 From: "Luck, Tony" To: Borislav Petkov Cc: Ingo Molnar , Andrew Morton , Andy Lutomirski , Dan Williams , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-nvdimm@ml01.01.org, x86@kernel.org Subject: Re: [PATCHV2 1/3] x86, ras: Add new infrastructure for machine check fixup tables Message-ID: <20151215010059.GA17353@agluck-desk.sc.intel.com> References: <456153d09e85f2f139020a051caed3ca8f8fca73.1449861203.git.tony.luck@intel.com> <20151212101142.GA3867@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151212101142.GA3867@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: 2522 Lines: 65 On Sat, Dec 12, 2015 at 11:11:42AM +0100, Borislav Petkov wrote: > > +config MCE_KERNEL_RECOVERY > > + depends on X86_MCE && X86_64 > > + def_bool y > > Shouldn't that depend on NVDIMM or whatnot? Looks too generic now. Not sure what the "whatnot" would be though. Making it depend on X86_MCE should keep it out of the tiny configurations. By the time you have MCE support, this seems like a pretty small incremental change. > > +#ifdef CONFIG_MCE_KERNEL_RECOVERY > > +int fixup_mcexception(struct pt_regs *regs, u64 addr) > > +{ > > If you move the #ifdef here, you can save yourself the ifdeffery in the > header above. I realized I didn't need the inline stub function in the header. > > diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h > > index 1781e54ea6d3..21bb20d1172a 100644 > > --- a/include/asm-generic/vmlinux.lds.h > > +++ b/include/asm-generic/vmlinux.lds.h > > @@ -473,6 +473,12 @@ > > VMLINUX_SYMBOL(__start___ex_table) = .; \ > > *(__ex_table) \ > > VMLINUX_SYMBOL(__stop___ex_table) = .; \ > > + } \ > > + . = ALIGN(align); \ > > + __mcex_table : AT(ADDR(__mcex_table) - LOAD_OFFSET) { \ > > + VMLINUX_SYMBOL(__start___mcex_table) = .; \ > > + *(__mcex_table) \ > > + VMLINUX_SYMBOL(__stop___mcex_table) = .; \ > > Of all the places, this one is missing #ifdef CONFIG_MCE_KERNEL_RECOVERY. Is there some cpp magic to use an #ifdef inside a multi-line macro like this? Impact of not having the #ifdef is two extra symbols (the start/stop ones) in the symbol table of the final binary. If that's unacceptable I can fall back to an earlier unpublished version that had separate EXCEPTION_TABLE and MCEXCEPTION_TABLE macros with both invoked in the x86 vmlinux.lds.S file. > You can make this one a bit more readable by doing: > > /* Given an address, look for it in the machine check exception tables. */ > const struct exception_table_entry * > search_mcexception_tables(unsigned long addr) > { > #ifdef CONFIG_MCE_KERNEL_RECOVERY > return search_extable(__start___mcex_table, > __stop___mcex_table - 1, addr); > #endif > } I got rid of the local variable and the return ... but left the #ifdef/#endif around the whole function. -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/