path: root/tools/perf/bench/mem-memcpy-x86-64-lib.c
diff options
authorLinus Torvalds <torvalds@linux-foundation.org>2018-08-05 09:13:07 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2018-08-05 09:13:07 -0700
commit0cdf6d4607df37804955530e153cee2d363c426e (patch)
tree202d7d60f31cbf09b111e51210c663af580d1fca /tools/perf/bench/mem-memcpy-x86-64-lib.c
parentb9fb1fc7f921e4f52bc753d9147d1b6be6d0b675 (diff)
parentce03b6d2b610b70bb527d14d82c2394adb235e5d (diff)
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Thomas Gleixner: "A set of fixes for perf: Kernel side: - Fix the hardcoded index of extra PCI devices on Broadwell which caused a resource conflict and triggered warnings on CPU hotplug. Tooling: - 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" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf/x86/intel/uncore: Fix hardcoded index of Broadwell extra PCI devices perf tools: Fix the build on the alpine:edge distro tools arch: Update arch/x86/lib/memcpy_64.S copy used in 'perf bench mem memcpy' tools headers uapi: Refresh linux/bpf.h copy tools headers powerpc: Update asm/unistd.h copy to pick new tools headers uapi: Update tools's copy of linux/perf_event.h
Diffstat (limited to 'tools/perf/bench/mem-memcpy-x86-64-lib.c')
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;