mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-05-02 18:15:03 -04:00
x86: don't use REP_GOOD or ERMS for user memory copies
The modern target to use is FSRM (Fast Short REP MOVS), and the other cases should only be used for bigger areas (ie mainly things like page clearing). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
@@ -18,9 +18,7 @@
|
||||
|
||||
/* Handles exceptions in both to and from, but doesn't do access_ok */
|
||||
__must_check unsigned long
|
||||
copy_user_enhanced_fast_string(void *to, const void *from, unsigned len);
|
||||
__must_check unsigned long
|
||||
copy_user_generic_string(void *to, const void *from, unsigned len);
|
||||
copy_user_fast_string(void *to, const void *from, unsigned len);
|
||||
__must_check unsigned long
|
||||
copy_user_generic_unrolled(void *to, const void *from, unsigned len);
|
||||
|
||||
@@ -30,15 +28,12 @@ copy_user_generic(void *to, const void *from, unsigned len)
|
||||
unsigned ret;
|
||||
|
||||
/*
|
||||
* If CPU has ERMS feature, use copy_user_enhanced_fast_string.
|
||||
* Otherwise, if CPU has rep_good feature, use copy_user_generic_string.
|
||||
* If CPU has FSRM feature, use 'rep movs'.
|
||||
* Otherwise, use copy_user_generic_unrolled.
|
||||
*/
|
||||
alternative_call_2(copy_user_generic_unrolled,
|
||||
copy_user_generic_string,
|
||||
X86_FEATURE_REP_GOOD,
|
||||
copy_user_enhanced_fast_string,
|
||||
X86_FEATURE_ERMS,
|
||||
alternative_call(copy_user_generic_unrolled,
|
||||
copy_user_fast_string,
|
||||
X86_FEATURE_FSRM,
|
||||
ASM_OUTPUT2("=a" (ret), "=D" (to), "=S" (from),
|
||||
"=d" (len)),
|
||||
"1" (to), "2" (from), "3" (len)
|
||||
|
||||
Reference in New Issue
Block a user