Re: [PATCH] x86/memcpy: Introduce memcpy_mcsafe_fast
From: Linus Torvalds
Date: Mon Apr 20 2020 - 16:56:54 EST
On Mon, Apr 20, 2020 at 1:45 PM Luck, Tony <tony.luck@xxxxxxxxx> wrote:
>
> Another X86 vendor seems to be adding something like that. See MCOMMIT
> in https://www.amd.com/system/files/TechDocs/24594.pdf
That sounds potentially very expensive.
Particularly, as you say, something like the kernel (or
virtualization) may want to at least test for it cheaply on entry or
switch or whatever.
I do think you want the mcommit kind of thing for writing, but I think
the intel model of (no longer pcommit) using a writeback instruction
with a range, and then just sfence is better than a "commit
everything" thing.
But that's just for writing things, and that's fundamentally very
different from the read side errors.
So for the read-side you'd want some kind of "lfence and report"
instruction for the "did I see load errors". Very cheap like lfence,
so that there wouldn't really be a cost for the people if somebody
_really_ want to get notified immediately.
And again, it might just be part of any serializing instruction. I
don't care that much, although overloading "serializing instruction"
even more sounds like a bad idea.
Linus