Re: [PATCH v11 3/4] x86, mce: Add __mcsafe_copy()

From: Ingo Molnar
Date: Thu Feb 18 2016 - 13:51:25 EST



* Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:

> On Wed, Feb 17, 2016 at 10:20 AM, Tony Luck <tony.luck@xxxxxxxxx> wrote:
> >
> > If we faulted during the copy, then 'trapnr' will say which type
> > of trap (X86_TRAP_PF or X86_TRAP_MC) and 'remain' says how many
> > bytes were not copied.
>
> So apart from the naming, a couple of questions:
>
> - I'd like to see the actual *use* case explained, not just what it does.
>
> - why does this use the complex - and slower, on modern machines -
> unrolled manual memory copy, when you might as well just use a single
>
> rep ; movsb
>
> which not only makes it smaller, but makes the exception fixup trivial.
>
> - why not make the "bytes remaining" the same as for a user-space
> copy (ie return it as the return value)?
>
> - at that point, it ends up looking a *lot* like uaccess_try/catch,
> which gets the error code from current_thread_info()->uaccess_err
>
> Hmm?

memcpy_try()/memcpy_catch() definitely has a nice ring to it.

Thanks,

Ingo