summaryrefslogtreecommitdiff
path: root/tools/perf/bench/mem-memcpy-x86-64-lib.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2018-07-31 07:43:48 +0200
committerIngo Molnar <mingo@kernel.org>2018-07-31 07:43:48 +0200
commitce03b6d2b610b70bb527d14d82c2394adb235e5d (patch)
tree1e73af0e3dea8f7546540245b3660009dab982c8 /tools/perf/bench/mem-memcpy-x86-64-lib.c
parent156c8b58ef5cfd97245928c95669fd4cb0f9c388 (diff)
parent44fe619b1418ff4e9d2f9518a940fbe2fb686a08 (diff)
Merge tag 'perf-urgent-for-mingo-4.18-20180730' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
Pull perf/urgent fixes from Arnaldo Carvalho de Melo: - Update the tools copy of several files, including perf_event.h, powerpc's asm/unistd.h (new io_pgetevents syscall), bpf.h and x86's memcpy_64.s (used in 'perf bench mem'), silencing the respective warnings during the perf tools build. - Fix the build on the alpine:edge distro. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/bench/mem-memcpy-x86-64-lib.c')
-rw-r--r--tools/perf/bench/mem-memcpy-x86-64-lib.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/perf/bench/mem-memcpy-x86-64-lib.c b/tools/perf/bench/mem-memcpy-x86-64-lib.c
new file mode 100644
index 000000000000..4130734dde84
--- /dev/null
+++ b/tools/perf/bench/mem-memcpy-x86-64-lib.c
@@ -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;
+}