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>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-nvdimm@ml01.01.org, x86@kernel.org
Subject: Re: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks
Date: Tue, 15 Dec 2015 14:11:35 +0100	[thread overview]
Message-ID: <20151215131135.GE25973@pd.tnic> (raw)
In-Reply-To: <23b2515da9d06b198044ad83ca0a15ba38c24e6e.1449861203.git.tony.luck@intel.com>

On Thu, Dec 10, 2015 at 04:21:50PM -0800, Tony Luck wrote:
> Using __copy_user_nocache() as inspiration create a memory copy
> routine for use by kernel code with annotations to allow for
> recovery from machine checks.
> 
> Notes:
> 1) Unlike the original we make no attempt to copy all the bytes
>    up to the faulting address. The original achieves that by
>    re-executing the failing part as a byte-by-byte copy,
>    which will take another page fault. We don't want to have
>    a second machine check!
> 2) Likewise the return value for the original indicates exactly
>    how many bytes were not copied. Instead we provide the physical
>    address of the fault (thanks to help from do_machine_check()
> 3) Provide helpful macros to decode the return value.
> 
> Signed-off-by: Tony Luck <tony.luck@intel.com>
> ---
>  arch/x86/include/asm/uaccess_64.h |  5 +++
>  arch/x86/kernel/x8664_ksyms_64.c  |  2 +
>  arch/x86/lib/copy_user_64.S       | 91 +++++++++++++++++++++++++++++++++++++++
>  3 files changed, 98 insertions(+)

...

> + * mcsafe_memcpy - Uncached memory copy with machine check exception handling
> + * Note that we only catch machine checks when reading the source addresses.
> + * Writes to target are posted and don't generate machine checks.
> + * This will force destination/source out of cache for more performance.

... and the non-temporal version is the optimal one even though we're
defaulting to copy_user_enhanced_fast_string for memcpy on modern Intel
CPUs...?

Btw, it should be also inside an ifdef if we're going to ifdef
CONFIG_MCE_KERNEL_RECOVERY everywhere else.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2015-12-15 13:11 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-11 19:13 [PATCHV2 0/3] Machine check recovery when kernel accesses poison Tony Luck
2015-12-10 21:58 ` [PATCHV2 1/3] x86, ras: Add new infrastructure for machine check fixup tables Tony Luck
2015-12-11 20:06   ` Andy Lutomirski
2015-12-11 21:01     ` Luck, Tony
2015-12-12 10:11   ` Borislav Petkov
2015-12-14 17:58     ` Ross Zwisler
2015-12-14 22:27       ` Borislav Petkov
2015-12-15  1:00     ` Luck, Tony
2015-12-15  9:46       ` Borislav Petkov
2015-12-15 10:44         ` Borislav Petkov
2015-12-11  0:14 ` [PATCHV2 2/3] x86, ras: Extend machine check recovery code to annotated ring0 areas Tony Luck
2015-12-11 20:08   ` Andy Lutomirski
2015-12-15 11:43   ` Borislav Petkov
2015-12-15 23:46     ` Luck, Tony
2015-12-11  0:21 ` [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks Tony Luck
2015-12-11 20:09   ` Andy Lutomirski
2015-12-11 21:19     ` Luck, Tony
2015-12-11 21:32       ` Konrad Rzeszutek Wilk
2015-12-11 21:50       ` Andy Lutomirski
2015-12-11 22:17         ` Luck, Tony
2015-12-11 22:20           ` Dan Williams
2015-12-11 22:26             ` Andy Lutomirski
2015-12-11 22:35               ` Luck, Tony
2015-12-11 22:38                 ` Andy Lutomirski
2015-12-11 22:45                   ` Luck, Tony
2015-12-11 22:55                     ` Andy Lutomirski
2015-12-14  8:36                       ` Ingo Molnar
2015-12-14 19:46                         ` Luck, Tony
2015-12-14 20:11                           ` Andy Lutomirski
2015-12-15 13:11   ` Borislav Petkov [this message]
2015-12-15 17:45     ` Dan Williams
2015-12-15 17:53       ` Luck, Tony
2015-12-15 18:21         ` Borislav Petkov
2015-12-15 18:27         ` Dan Williams
2015-12-15 18:35           ` Dan Williams
2015-12-15 18:39             ` Borislav Petkov
2015-12-15 19:19               ` Elliott, Robert (Persistent Memory)
2015-12-15 19:28                 ` Borislav Petkov
2015-12-15 20:25                   ` Elliott, Robert (Persistent Memory)
2015-12-21 17:33                     ` Borislav Petkov

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=20151215131135.GE25973@pd.tnic \
    --to=bp@alien8.de \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.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