From mboxrd@z Thu Jan 1 00:00:00 1970 From: Borislav Petkov Subject: Re: [PATCH v6 2/4] x86: Cleanup and add a new exception class Date: Mon, 4 Jan 2016 15:22:13 +0100 Message-ID: <20160104142213.GI22941@pd.tnic> References: <18380d9d19d5165822d12532127de2fb7a8b8cc7.1451869360.git.tony.luck@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Return-path: Content-Disposition: inline In-Reply-To: <18380d9d19d5165822d12532127de2fb7a8b8cc7.1451869360.git.tony.luck@intel.com> Sender: linux-kernel-owner@vger.kernel.org To: Tony Luck Cc: Ingo Molnar , Andrew Morton , Andy Lutomirski , Dan Williams , elliott@hpe.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-nvdimm@ml01.01.org, x86@kernel.org List-Id: linux-mm.kvack.org On Wed, Dec 30, 2015 at 10:56:41AM -0800, Tony Luck wrote: > Make per-class functions for exception table fixup. Add #defines > and general prettiness to make it clear how all the parts tie > together. > > Add a new class that fills %rax with the fault number of the exception. > > Signed-off-by: Tony Luck > --- > arch/x86/include/asm/asm.h | 24 ++++++++++----- > arch/x86/include/asm/uaccess.h | 17 ++++++++--- > arch/x86/kernel/kprobes/core.c | 2 +- > arch/x86/kernel/traps.c | 6 ++-- > arch/x86/mm/extable.c | 67 +++++++++++++++++++++++++++--------------- > arch/x86/mm/fault.c | 2 +- > 6 files changed, 79 insertions(+), 39 deletions(-) > > diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h > index b64121ffb2da..1888278d0559 100644 > --- a/arch/x86/include/asm/asm.h > +++ b/arch/x86/include/asm/asm.h > @@ -44,6 +44,7 @@ > > /* Exception table entry */ > > +#define _EXTABLE_BIAS 0x20000000 > /* > * An exception table entry is 64 bits. The first 32 bits are the offset > * from that entry to the potentially faulting instruction. sortextable > @@ -54,26 +55,35 @@ > * address. All of these are generated by relocations, so we can only > * rely on addition. We therefore emit: > * > - * (target - here) + (class) + 0x20000000 > + * (target - here) + (class) + _EXTABLE_BIAS > * > * This has the property that the two high bits are the class and the > * rest is easy to decode. > */ > > -/* There are two bits of extable entry class, added to a signed offset. */ > -#define _EXTABLE_CLASS_DEFAULT 0 /* standard uaccess fixup */ > -#define _EXTABLE_CLASS_EX 0x80000000 /* uaccess + set uaccess_err */ > +/* > + * There are two bits of extable entry class giving four classes > + */ > +#define EXTABLE_CLASS_DEFAULT 0 /* standard uaccess fixup */ > +#define EXTABLE_CLASS_FAULT 1 /* provide fault number as well as fixup */ > +#define EXTABLE_CLASS_EX 2 /* uaccess + set uaccess_err */ > +#define EXTABLE_CLASS_UNUSED 3 /* available for something else */ > > /* > - * The biases are the class constants + 0x20000000, as signed integers. > + * The biases are the class constants + _EXTABLE_BIAS, as signed integers. > * This can't use ordinary arithmetic -- the assembler isn't that smart. > */ > -#define _EXTABLE_BIAS_DEFAULT 0x20000000 > -#define _EXTABLE_BIAS_EX 0x20000000 - 0x80000000 > +#define _EXTABLE_BIAS_DEFAULT _EXTABLE_BIAS > +#define _EXTABLE_BIAS_FAULT _EXTABLE_BIAS + 0x40000000 > +#define _EXTABLE_BIAS_EX _EXTABLE_BIAS - 0x80000000 > +#define _EXTABLE_BIAS_UNUSED _EXTABLE_BIAS - 0x40000000 > > #define _ASM_EXTABLE(from,to) \ > _ASM_EXTABLE_CLASS(from, to, _EXTABLE_BIAS_DEFAULT) > > +#define _ASM_EXTABLE_FAULT(from,to) \ > + _ASM_EXTABLE_CLASS(from, to, _EXTABLE_BIAS_FAULT) > + > #define _ASM_EXTABLE_EX(from,to) \ > _ASM_EXTABLE_CLASS(from, to, _EXTABLE_BIAS_EX) So you're touching those again in patch 2. Why not add those defines to patch 1 directly and diminish the churn? -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply.