linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Tony Luck <tony.luck@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andy Lutomirski <luto@kernel.org>,
	Dan Williams <dan.j.williams@intel.com>,
	elliott@hpe.com, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, linux-nvdimm@ml01.01.org, x86@kernel.org
Subject: Re: [PATCH v6 2/4] x86: Cleanup and add a new exception class
Date: Mon, 4 Jan 2016 15:22:13 +0100	[thread overview]
Message-ID: <20160104142213.GI22941@pd.tnic> (raw)
In-Reply-To: <18380d9d19d5165822d12532127de2fb7a8b8cc7.1451869360.git.tony.luck@intel.com>

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 <tony.luck@intel.com>
> ---
>  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.

  reply	other threads:[~2016-01-04 14:22 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-04  1:02 [PATCH v6 0/4] Machine check recovery when kernel accesses poison Tony Luck
2015-12-30 17:59 ` [PATCH v6 1/4] x86: Clean up extable entry format (and free up a bit) Andy Lutomirski
2016-01-04  1:37   ` Tony Luck
2016-01-04  7:49     ` Ingo Molnar
2016-01-04 12:07   ` Borislav Petkov
2016-01-04 17:26     ` Tony Luck
2016-01-04 18:08       ` Andy Lutomirski
2016-01-04 18:59         ` Tony Luck
2016-01-04 19:05           ` Andy Lutomirski
2016-01-04 21:02         ` Borislav Petkov
2016-01-04 22:29           ` Andy Lutomirski
2016-01-04 23:02             ` Borislav Petkov
2016-01-04 23:04               ` Borislav Petkov
2016-01-04 23:25               ` Andy Lutomirski
2016-01-05 11:20                 ` Borislav Petkov
2016-01-04 23:11         ` Tony Luck
2015-12-30 18:56 ` [PATCH v6 2/4] x86: Cleanup and add a new exception class Tony Luck
2016-01-04 14:22   ` Borislav Petkov [this message]
2016-01-04 17:00     ` Luck, Tony
2016-01-04 20:32       ` Borislav Petkov
2016-01-04 22:23         ` Andy Lutomirski
2015-12-31 19:40 ` [PATCH v6 3/4] x86, mce: Check for faults tagged in EXTABLE_CLASS_FAULT exception table entries Tony Luck
2015-12-31 19:43 ` [PATCH v6 4/4] x86, mce: Add __mcsafe_copy() Tony Luck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160104142213.GI22941@pd.tnic \
    --to=bp@alien8.de \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=elliott@hpe.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nvdimm@ml01.01.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).