Re: [PATCH v3 1/6] x86/uaccess: Avoid barrier_nospec() in 64-bit copy_from_user()

2024-10-29 Thread Josh Poimboeuf
On Tue, Oct 29, 2024 at 04:03:31PM -1000, Linus Torvalds wrote: > Hmm. So it strikes me that this still does the "access_ok()", but > that's pointless for the actual pointer masking case. One of the whole > points of the pointer masking is that we can just do this without > actually checking the ad

Re: [PATCH v3 1/6] x86/uaccess: Avoid barrier_nospec() in 64-bit copy_from_user()

2024-10-29 Thread Linus Torvalds
On Mon, 28 Oct 2024 at 15:56, Josh Poimboeuf wrote: > > The barrier_nospec() in 64-bit copy_from_user() is slow. Instead use > pointer masking to force the user pointer to all 1's if the access_ok() > mispredicted true for an invalid address. > > The kernel test robot reports a 2.6% improvement i

Re: [PATCH v3 1/6] x86/uaccess: Avoid barrier_nospec() in 64-bit copy_from_user()

2024-10-29 Thread Kirill A . Shutemov
On Mon, Oct 28, 2024 at 06:56:14PM -0700, Josh Poimboeuf wrote: > The barrier_nospec() in 64-bit copy_from_user() is slow. Instead use > pointer masking to force the user pointer to all 1's if the access_ok() > mispredicted true for an invalid address. > > The kernel test robot reports a 2.6% imp

[PATCH v3 1/6] x86/uaccess: Avoid barrier_nospec() in 64-bit copy_from_user()

2024-10-28 Thread Josh Poimboeuf
The barrier_nospec() in 64-bit copy_from_user() is slow. Instead use pointer masking to force the user pointer to all 1's if the access_ok() mispredicted true for an invalid address. The kernel test robot reports a 2.6% improvement in the per_thread_ops benchmark (see link below). To avoid regre