forked from shenki/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tools arch: Update arch/x86/lib/memcpy_64.S copy used in 'perf bench …
…mem memcpy' To cope with the changes in: 12c8913 ("x86/asm/memcpy_mcsafe: Add write-protection-fault handling") 60622d6 ("x86/asm/memcpy_mcsafe: Return bytes remaining") bd13154 ("x86/asm/memcpy_mcsafe: Add labels for __memcpy_mcsafe() write fault handling") da7bc9c ("x86/asm/memcpy_mcsafe: Remove loop unrolling") This needed introducing a file with a copy of the mcsafe_handle_tail() function, that is used in the new memcpy_64.S file, as well as a dummy mcsafe_test.h header. Testing it: $ nm ~/bin/perf | grep mcsafe 0000000000484130 T mcsafe_handle_tail 0000000000484300 T __memcpy_mcsafe $ $ perf bench mem memcpy # Running 'mem/memcpy' benchmark: # function 'default' (Default memcpy() provided by glibc) # Copying 1MB bytes ... 44.389205 GB/sec # function 'x86-64-unrolled' (unrolled memcpy() in arch/x86/lib/memcpy_64.S) # Copying 1MB bytes ... 22.710756 GB/sec # function 'x86-64-movsq' (movsq-based memcpy() in arch/x86/lib/memcpy_64.S) # Copying 1MB bytes ... 42.459239 GB/sec # function 'x86-64-movsb' (movsb-based memcpy() in arch/x86/lib/memcpy_64.S) # Copying 1MB bytes ... 42.459239 GB/sec $ This silences this perf tools build warning: Warning: Kernel ABI header at 'tools/arch/x86/lib/memcpy_64.S' differs from latest version at 'arch/x86/lib/memcpy_64.S' Cc: Adrian Hunter <[email protected]> Cc: Dan Williams <[email protected]> Cc: David Ahern <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mika Penttilä <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Tony Luck <[email protected]> Cc: Wang Nan <[email protected]> Link: https://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
- Loading branch information
Showing
5 changed files
with
93 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
#ifndef _MCSAFE_TEST_H_ | ||
#define _MCSAFE_TEST_H_ | ||
|
||
.macro MCSAFE_TEST_CTL | ||
.endm | ||
|
||
.macro MCSAFE_TEST_SRC reg count target | ||
.endm | ||
|
||
.macro MCSAFE_TEST_DST reg count target | ||
.endm | ||
#endif /* _MCSAFE_TEST_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* From code in arch/x86/lib/usercopy_64.c, copied to keep tools/ copy | ||
* of the kernel's arch/x86/lib/memcpy_64.s used in 'perf bench mem memcpy' | ||
* happy. | ||
*/ | ||
#include <linux/types.h> | ||
|
||
unsigned long __memcpy_mcsafe(void *dst, const void *src, size_t cnt); | ||
unsigned long mcsafe_handle_tail(char *to, char *from, unsigned len); | ||
|
||
unsigned long mcsafe_handle_tail(char *to, char *from, unsigned len) | ||
{ | ||
for (; len; --len, to++, from++) { | ||
/* | ||
* Call the assembly routine back directly since | ||
* memcpy_mcsafe() may silently fallback to memcpy. | ||
*/ | ||
unsigned long rem = __memcpy_mcsafe(to, from, 1); | ||
|
||
if (rem) | ||
break; | ||
} | ||
return len; | ||
} |