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


Groups > linux.kernel > #1355337

Re: [PATCH v14] x86, mce: Add memcpy_mcsafe()

From Mika Penttilä <mika.penttila@nextfour.com>
Newsgroups linux.kernel
Subject Re: [PATCH v14] x86, mce: Add memcpy_mcsafe()
Date 2016-03-10 20:30 +0100
Message-ID <rberv-312-3@gated-at.bofh.it> (permalink)
References <r6cTo-2cE-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 18.02.2016 21:47, Tony Luck wrote:
> Make use of the EXTABLE_FAULT exception table entries to write
> a kernel copy routine that doesn't crash the system if it
> encounters a machine check. Prime use case for this is to copy
> from large arrays of non-volatile memory used as storage.
>
> We have to use an unrolled copy loop for now because current
> hardware implementations treat a machine check in "rep mov"
> as fatal. When that is fixed we can simplify.
>
> Signed-off-by: Tony Luck <tony.luck@intel.com>
> ---
>
> Is this what we want now?  Return type is a "bool". True means
> that we copied OK, false means that it didn't (this is all that
> Dan says that he needs).  Dropped all the complex code to figure
> out how many bytes we didn't copy as Linus says this isn't the
> right place to do this (and besides we should just make "rep mov"
>
> +
> +	/* Copy successful. Return true */
> +.L_done_memcpy_trap:
> +	xorq %rax, %rax
> +	ret
> +ENDPROC(memcpy_mcsafe)
> +
> +	.section .fixup, "ax"
> +	/* Return false for any failure */
> +.L_memcpy_mcsafe_fail:
> +	mov	$1, %rax
> +	ret
> +
>
But you return 0 == false for success and 1 == true for failure.

--Mika

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


Thread

Re: [PATCH v14] x86, mce: Add memcpy_mcsafe() Mika Penttilä <mika.penttila@nextfour.com> - 2016-03-10 20:30 +0100
  RE: [PATCH v14] x86, mce: Add memcpy_mcsafe() "Luck, Tony" <tony.luck@intel.com> - 2016-03-10 20:40 +0100
    Re: [PATCH v14] x86, mce: Add memcpy_mcsafe() Tony Luck <tony.luck@gmail.com> - 2016-03-11 23:20 +0100
      Re: [PATCH v14] x86, mce: Add memcpy_mcsafe() Dan Williams <dan.j.williams@intel.com> - 2016-03-11 23:20 +0100
      Re: [PATCH v14] x86, mce: Add memcpy_mcsafe() Ingo Molnar <mingo@kernel.org> - 2016-03-12 18:20 +0100
        Re: [PATCH v14] x86, mce: Add memcpy_mcsafe() Linus Torvalds <torvalds@linux-foundation.org> - 2016-03-13 02:20 +0100
          Re: [PATCH v14] x86, mce: Add memcpy_mcsafe() Ingo Molnar <mingo@kernel.org> - 2016-03-13 10:30 +0100
            [PATCH] x86/mm, x86/mce: Fix return type/value for memcpy_mcsafe() Tony Luck <tony.luck@intel.com> - 2016-03-14 23:40 +0100
              [tip:x86/urgent] x86/mm, x86/mce: Fix return type/value for  memcpy_mcsafe() tip-bot for Tony Luck <tipbot@zytor.com> - 2016-03-16 09:40 +0100

csiph-web