Re: [PATCH v14] x86, mce: Add memcpy_mcsafe()
From: Mika PenttilÃ
Date: Thu Mar 10 2016 - 14:27:19 EST
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@xxxxxxxxx>
> 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 */
> + xorq %rax, %rax
> + ret
> + .section .fixup, "ax"
> + /* Return false for any failure */
> + mov $1, %rax
> + ret
But you return 0 == false for success and 1 == true for failure.