Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1292168

Re: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks

From Borislav Petkov <bp@alien8.de>
Newsgroups linux.kernel
Subject Re: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks
Date 2015-12-15 14:20 +0100
Message-ID <qFXGi-4AF-13@gated-at.bofh.it> (permalink)
References <qEBHP-ir-5@gated-at.bofh.it> <qEBHQ-ir-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 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/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover  from machine checks Borislav Petkov <bp@alien8.de> - 2015-12-15 14:20 +0100
  Re: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover  from machine checks Dan Williams <dan.j.williams@intel.com> - 2015-12-15 18:50 +0100
    RE: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover  from machine checks "Luck, Tony" <tony.luck@intel.com> - 2015-12-15 19:00 +0100
      Re: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover  from machine checks Borislav Petkov <bp@alien8.de> - 2015-12-15 19:30 +0100
      Re: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover  from machine checks Dan Williams <dan.j.williams@intel.com> - 2015-12-15 19:30 +0100
        Re: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover  from machine checks Dan Williams <dan.j.williams@intel.com> - 2015-12-15 19:40 +0100
          Re: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover  from machine checks Borislav Petkov <bp@alien8.de> - 2015-12-15 19:40 +0100
            Re: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover  from machine checks Borislav Petkov <bp@alien8.de> - 2015-12-15 20:30 +0100
              RE: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover  from machine checks "Elliott, Robert (Persistent Memory)" <elliott@hpe.com> - 2015-12-15 21:30 +0100
                Re: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover  from machine checks Borislav Petkov <bp@alien8.de> - 2015-12-21 18:40 +0100
            RE: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover  from machine checks "Elliott, Robert (Persistent Memory)" <elliott@hpe.com> - 2015-12-15 20:30 +0100

csiph-web