[PATCH v3 2/6] x86/uaccess: Avoid barrier_nospec() in 64-bit __get_user()
Linus Torvalds
torvalds at linux-foundation.org
Sat Nov 16 12:27:06 AEDT 2024
On Fri, 15 Nov 2024 at 15:06, Josh Poimboeuf <jpoimboe at kernel.org> wrote:
>
> It's sad that __get_user() is now slower than get_user() on x86, it kind
> of defeats the whole point!
Well, honestly, we've been trying to get away from __get_user() and
__put_user() for a long long time.
With CLAC/STAC, it's been probably a decade or two since __get_user()
and friends were actually a worthwhile optimization, so let's just
strive to get rid of the ones that matter.
So I think the thing to do is
(a) find out which __get_user() it is that matters so much for that load
Do you have a profile somewhere?
(b) convert them to use "unsafe_get_user()", with that whole
if (can_do_masked_user_access())
from = masked_user_access_begin(from);
else if (!user_read_access_begin(from, sizeof(*from)))
return -EFAULT;
sequence before it.
And if it's just a single __get_user() (rather than a sequence of
them), just convert it to get_user().
Hmm?
Linus
More information about the Linuxppc-dev
mailing list