Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752683AbbKJLVb (ORCPT ); Tue, 10 Nov 2015 06:21:31 -0500 Received: from mail.skyhub.de ([78.46.96.112]:60485 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752245AbbKJLV3 (ORCPT ); Tue, 10 Nov 2015 06:21:29 -0500 Date: Tue, 10 Nov 2015 12:21:16 +0100 From: Borislav Petkov To: Tony Luck Cc: linux-kernel@vger.kernel.org, linux-edac@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH 1/3] x86, ras: Add new infrastructure for machine check fixup tables Message-ID: <20151110112116.GC19187@pd.tnic> References: <5bf6f812a7dd2b619487c57987e29b3884c6c4ec.1447093568.git.tony.luck@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <5bf6f812a7dd2b619487c57987e29b3884c6c4ec.1447093568.git.tony.luck@intel.com> 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: 3026 Lines: 95 On Fri, Nov 06, 2015 at 12:57:03PM -0800, Tony Luck wrote: > Copy the existing page fault fixup mechanisms to create a new table > to be used when fixing machine checks. Note: > 1) At this time we only provide a macro to annotate assembly code > 2) We assume all fixups will in code builtin to the kernel. > > Signed-off-by: Tony Luck > --- > arch/x86/include/asm/asm.h | 7 +++++++ > arch/x86/include/asm/uaccess.h | 1 + > arch/x86/mm/extable.c | 16 ++++++++++++++++ > include/asm-generic/vmlinux.lds.h | 6 ++++++ > include/linux/module.h | 1 + > kernel/extable.c | 14 ++++++++++++++ > 6 files changed, 45 insertions(+) > > diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h > index 189679aba703..f2fa7973f18f 100644 > --- a/arch/x86/include/asm/asm.h > +++ b/arch/x86/include/asm/asm.h > @@ -58,6 +58,13 @@ > .long (to) - . + 0x7ffffff0 ; \ > .popsection > > +# define _ASM_MCEXTABLE(from, to) \ Maybe add an intermediary macro which abstracts the table name: #define __ASM_EXTABLE(from, to, table) ... and then do #define _ASM_EXTABLE(from, to) __ASM_EXTABLE(from, to, "__ex_table") #define _ASM_MCEXTABLE(from, to) __ASM_EXTABLE(from, to, "__mcex_table") > + .pushsection "__mcex_table", "a" ; \ > + .balign 8 ; \ > + .long (from) - . ; \ > + .long (to) - . ; \ > + .popsection > + > # define _ASM_NOKPROBE(entry) \ > .pushsection "_kprobe_blacklist","aw" ; \ > _ASM_ALIGN ; \ > diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h > index a8df874f3e88..b8231301a224 100644 > --- a/arch/x86/include/asm/uaccess.h > +++ b/arch/x86/include/asm/uaccess.h > @@ -111,6 +111,7 @@ struct exception_table_entry { > #define ARCH_HAS_SEARCH_EXTABLE > > extern int fixup_exception(struct pt_regs *regs); > +extern int fixup_mcexception(struct pt_regs *regs); > extern int early_fixup_exception(unsigned long *ip); > > /* > diff --git a/arch/x86/mm/extable.c b/arch/x86/mm/extable.c > index 903ec1e9c326..5b328ae00365 100644 > --- a/arch/x86/mm/extable.c > +++ b/arch/x86/mm/extable.c > @@ -49,6 +49,22 @@ int fixup_exception(struct pt_regs *regs) > return 0; > } > > +int fixup_mcexception(struct pt_regs *regs) > +{ > + const struct exception_table_entry *fixup; > + unsigned long new_ip; > + > + fixup = search_mcexception_tables(regs->ip); > + if (fixup) { > + new_ip = ex_fixup_addr(fixup); > + > + regs->ip = new_ip; > + return 1; > + } > + > + return 0; > +} Yeah, all that duplication might raise some brows but I'd guess special-handling MCA in the normal exception paths might make the code a bit too ugly... -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. -- 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/