diff options
author | Ingo Molnar <mingo@kernel.org> | 2018-07-31 01:43:48 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2018-07-31 01:43:48 -0400 |
commit | ce03b6d2b610b70bb527d14d82c2394adb235e5d (patch) | |
tree | 1e73af0e3dea8f7546540245b3660009dab982c8 | |
parent | 156c8b58ef5cfd97245928c95669fd4cb0f9c388 (diff) | |
parent | 44fe619b1418ff4e9d2f9518a940fbe2fb686a08 (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>
-rw-r--r-- | tools/arch/powerpc/include/uapi/asm/unistd.h | 1 | ||||
-rw-r--r-- | tools/arch/x86/include/asm/mcsafe_test.h | 13 | ||||
-rw-r--r-- | tools/arch/x86/lib/memcpy_64.S | 112 | ||||
-rw-r--r-- | tools/include/uapi/linux/bpf.h | 28 | ||||
-rw-r--r-- | tools/include/uapi/linux/perf_event.h | 2 | ||||
-rw-r--r-- | tools/perf/arch/x86/util/pmu.c | 1 | ||||
-rw-r--r-- | tools/perf/arch/x86/util/tsc.c | 1 | ||||
-rw-r--r-- | tools/perf/bench/Build | 1 | ||||
-rw-r--r-- | tools/perf/bench/mem-memcpy-x86-64-asm.S | 1 | ||||
-rw-r--r-- | tools/perf/bench/mem-memcpy-x86-64-lib.c | 24 | ||||
-rw-r--r-- | tools/perf/perf.h | 1 | ||||
-rw-r--r-- | tools/perf/util/header.h | 1 | ||||
-rw-r--r-- | tools/perf/util/namespaces.h | 1 |
13 files changed, 124 insertions, 63 deletions
diff --git a/tools/arch/powerpc/include/uapi/asm/unistd.h b/tools/arch/powerpc/include/uapi/asm/unistd.h index ac5ba55066dd..985534d0b448 100644 --- a/tools/arch/powerpc/include/uapi/asm/unistd.h +++ b/tools/arch/powerpc/include/uapi/asm/unistd.h | |||
@@ -399,5 +399,6 @@ | |||
399 | #define __NR_pkey_free 385 | 399 | #define __NR_pkey_free 385 |
400 | #define __NR_pkey_mprotect 386 | 400 | #define __NR_pkey_mprotect 386 |
401 | #define __NR_rseq 387 | 401 | #define __NR_rseq 387 |
402 | #define __NR_io_pgetevents 388 | ||
402 | 403 | ||
403 | #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ | 404 | #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ |
diff --git a/tools/arch/x86/include/asm/mcsafe_test.h b/tools/arch/x86/include/asm/mcsafe_test.h new file mode 100644 index 000000000000..2ccd588fbad4 --- /dev/null +++ b/tools/arch/x86/include/asm/mcsafe_test.h | |||
@@ -0,0 +1,13 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
2 | #ifndef _MCSAFE_TEST_H_ | ||
3 | #define _MCSAFE_TEST_H_ | ||
4 | |||
5 | .macro MCSAFE_TEST_CTL | ||
6 | .endm | ||
7 | |||
8 | .macro MCSAFE_TEST_SRC reg count target | ||
9 | .endm | ||
10 | |||
11 | .macro MCSAFE_TEST_DST reg count target | ||
12 | .endm | ||
13 | #endif /* _MCSAFE_TEST_H_ */ | ||
diff --git a/tools/arch/x86/lib/memcpy_64.S b/tools/arch/x86/lib/memcpy_64.S index 9a53a06e5a3e..298ef1479240 100644 --- a/tools/arch/x86/lib/memcpy_64.S +++ b/tools/arch/x86/lib/memcpy_64.S | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <linux/linkage.h> | 3 | #include <linux/linkage.h> |
4 | #include <asm/errno.h> | 4 | #include <asm/errno.h> |
5 | #include <asm/cpufeatures.h> | 5 | #include <asm/cpufeatures.h> |
6 | #include <asm/mcsafe_test.h> | ||
6 | #include <asm/alternative-asm.h> | 7 | #include <asm/alternative-asm.h> |
7 | #include <asm/export.h> | 8 | #include <asm/export.h> |
8 | 9 | ||
@@ -183,12 +184,15 @@ ENTRY(memcpy_orig) | |||
183 | ENDPROC(memcpy_orig) | 184 | ENDPROC(memcpy_orig) |
184 | 185 | ||
185 | #ifndef CONFIG_UML | 186 | #ifndef CONFIG_UML |
187 | |||
188 | MCSAFE_TEST_CTL | ||
189 | |||
186 | /* | 190 | /* |
187 | * memcpy_mcsafe_unrolled - memory copy with machine check exception handling | 191 | * __memcpy_mcsafe - memory copy with machine check exception handling |
188 | * Note that we only catch machine checks when reading the source addresses. | 192 | * Note that we only catch machine checks when reading the source addresses. |
189 | * Writes to target are posted and don't generate machine checks. | 193 | * Writes to target are posted and don't generate machine checks. |
190 | */ | 194 | */ |
191 | ENTRY(memcpy_mcsafe_unrolled) | 195 | ENTRY(__memcpy_mcsafe) |
192 | cmpl $8, %edx | 196 | cmpl $8, %edx |
193 | /* Less than 8 bytes? Go to byte copy loop */ | 197 | /* Less than 8 bytes? Go to byte copy loop */ |
194 | jb .L_no_whole_words | 198 | jb .L_no_whole_words |
@@ -204,58 +208,33 @@ ENTRY(memcpy_mcsafe_unrolled) | |||
204 | subl $8, %ecx | 208 | subl $8, %ecx |
205 | negl %ecx | 209 | negl %ecx |
206 | subl %ecx, %edx | 210 | subl %ecx, %edx |
207 | .L_copy_leading_bytes: | 211 | .L_read_leading_bytes: |
208 | movb (%rsi), %al | 212 | movb (%rsi), %al |
213 | MCSAFE_TEST_SRC %rsi 1 .E_leading_bytes | ||
214 | MCSAFE_TEST_DST %rdi 1 .E_leading_bytes | ||
215 | .L_write_leading_bytes: | ||
209 | movb %al, (%rdi) | 216 | movb %al, (%rdi) |
210 | incq %rsi | 217 | incq %rsi |
211 | incq %rdi | 218 | incq %rdi |
212 | decl %ecx | 219 | decl %ecx |
213 | jnz .L_copy_leading_bytes | 220 | jnz .L_read_leading_bytes |
214 | 221 | ||
215 | .L_8byte_aligned: | 222 | .L_8byte_aligned: |
216 | /* Figure out how many whole cache lines (64-bytes) to copy */ | ||
217 | movl %edx, %ecx | ||
218 | andl $63, %edx | ||
219 | shrl $6, %ecx | ||
220 | jz .L_no_whole_cache_lines | ||
221 | |||
222 | /* Loop copying whole cache lines */ | ||
223 | .L_cache_w0: movq (%rsi), %r8 | ||
224 | .L_cache_w1: movq 1*8(%rsi), %r9 | ||
225 | .L_cache_w2: movq 2*8(%rsi), %r10 | ||
226 | .L_cache_w3: movq 3*8(%rsi), %r11 | ||
227 | movq %r8, (%rdi) | ||
228 | movq %r9, 1*8(%rdi) | ||
229 | movq %r10, 2*8(%rdi) | ||
230 | movq %r11, 3*8(%rdi) | ||
231 | .L_cache_w4: movq 4*8(%rsi), %r8 | ||
232 | .L_cache_w5: movq 5*8(%rsi), %r9 | ||
233 | .L_cache_w6: movq 6*8(%rsi), %r10 | ||
234 | .L_cache_w7: movq 7*8(%rsi), %r11 | ||
235 | movq %r8, 4*8(%rdi) | ||
236 | movq %r9, 5*8(%rdi) | ||
237 | movq %r10, 6*8(%rdi) | ||
238 | movq %r11, 7*8(%rdi) | ||
239 | leaq 64(%rsi), %rsi | ||
240 | leaq 64(%rdi), %rdi | ||
241 | decl %ecx | ||
242 | jnz .L_cache_w0 | ||
243 | |||
244 | /* Are there any trailing 8-byte words? */ | ||
245 | .L_no_whole_cache_lines: | ||
246 | movl %edx, %ecx | 223 | movl %edx, %ecx |
247 | andl $7, %edx | 224 | andl $7, %edx |
248 | shrl $3, %ecx | 225 | shrl $3, %ecx |
249 | jz .L_no_whole_words | 226 | jz .L_no_whole_words |
250 | 227 | ||
251 | /* Copy trailing words */ | 228 | .L_read_words: |
252 | .L_copy_trailing_words: | ||
253 | movq (%rsi), %r8 | 229 | movq (%rsi), %r8 |
254 | mov %r8, (%rdi) | 230 | MCSAFE_TEST_SRC %rsi 8 .E_read_words |
255 | leaq 8(%rsi), %rsi | 231 | MCSAFE_TEST_DST %rdi 8 .E_write_words |
256 | leaq 8(%rdi), %rdi | 232 | .L_write_words: |
233 | movq %r8, (%rdi) | ||
234 | addq $8, %rsi | ||
235 | addq $8, %rdi | ||
257 | decl %ecx | 236 | decl %ecx |
258 | jnz .L_copy_trailing_words | 237 | jnz .L_read_words |
259 | 238 | ||
260 | /* Any trailing bytes? */ | 239 | /* Any trailing bytes? */ |
261 | .L_no_whole_words: | 240 | .L_no_whole_words: |
@@ -264,38 +243,55 @@ ENTRY(memcpy_mcsafe_unrolled) | |||
264 | 243 | ||
265 | /* Copy trailing bytes */ | 244 | /* Copy trailing bytes */ |
266 | movl %edx, %ecx | 245 | movl %edx, %ecx |
267 | .L_copy_trailing_bytes: | 246 | .L_read_trailing_bytes: |
268 | movb (%rsi), %al | 247 | movb (%rsi), %al |
248 | MCSAFE_TEST_SRC %rsi 1 .E_trailing_bytes | ||
249 | MCSAFE_TEST_DST %rdi 1 .E_trailing_bytes | ||
250 | .L_write_trailing_bytes: | ||
269 | movb %al, (%rdi) | 251 | movb %al, (%rdi) |
270 | incq %rsi | 252 | incq %rsi |
271 | incq %rdi | 253 | incq %rdi |
272 | decl %ecx | 254 | decl %ecx |
273 | jnz .L_copy_trailing_bytes | 255 | jnz .L_read_trailing_bytes |
274 | 256 | ||
275 | /* Copy successful. Return zero */ | 257 | /* Copy successful. Return zero */ |
276 | .L_done_memcpy_trap: | 258 | .L_done_memcpy_trap: |
277 | xorq %rax, %rax | 259 | xorq %rax, %rax |
278 | ret | 260 | ret |
279 | ENDPROC(memcpy_mcsafe_unrolled) | 261 | ENDPROC(__memcpy_mcsafe) |
280 | EXPORT_SYMBOL_GPL(memcpy_mcsafe_unrolled) | 262 | EXPORT_SYMBOL_GPL(__memcpy_mcsafe) |
281 | 263 | ||
282 | .section .fixup, "ax" | 264 | .section .fixup, "ax" |
283 | /* Return -EFAULT for any failure */ | 265 | /* |
284 | .L_memcpy_mcsafe_fail: | 266 | * Return number of bytes not copied for any failure. Note that |
285 | mov $-EFAULT, %rax | 267 | * there is no "tail" handling since the source buffer is 8-byte |
268 | * aligned and poison is cacheline aligned. | ||
269 | */ | ||
270 | .E_read_words: | ||
271 | shll $3, %ecx | ||
272 | .E_leading_bytes: | ||
273 | addl %edx, %ecx | ||
274 | .E_trailing_bytes: | ||
275 | mov %ecx, %eax | ||
286 | ret | 276 | ret |
287 | 277 | ||
278 | /* | ||
279 | * For write fault handling, given the destination is unaligned, | ||
280 | * we handle faults on multi-byte writes with a byte-by-byte | ||
281 | * copy up to the write-protected page. | ||
282 | */ | ||
283 | .E_write_words: | ||
284 | shll $3, %ecx | ||
285 | addl %edx, %ecx | ||
286 | movl %ecx, %edx | ||
287 | jmp mcsafe_handle_tail | ||
288 | |||
288 | .previous | 289 | .previous |
289 | 290 | ||
290 | _ASM_EXTABLE_FAULT(.L_copy_leading_bytes, .L_memcpy_mcsafe_fail) | 291 | _ASM_EXTABLE_FAULT(.L_read_leading_bytes, .E_leading_bytes) |
291 | _ASM_EXTABLE_FAULT(.L_cache_w0, .L_memcpy_mcsafe_fail) | 292 | _ASM_EXTABLE_FAULT(.L_read_words, .E_read_words) |
292 | _ASM_EXTABLE_FAULT(.L_cache_w1, .L_memcpy_mcsafe_fail) | 293 | _ASM_EXTABLE_FAULT(.L_read_trailing_bytes, .E_trailing_bytes) |
293 | _ASM_EXTABLE_FAULT(.L_cache_w2, .L_memcpy_mcsafe_fail) | 294 | _ASM_EXTABLE(.L_write_leading_bytes, .E_leading_bytes) |
294 | _ASM_EXTABLE_FAULT(.L_cache_w3, .L_memcpy_mcsafe_fail) | 295 | _ASM_EXTABLE(.L_write_words, .E_write_words) |
295 | _ASM_EXTABLE_FAULT(.L_cache_w4, .L_memcpy_mcsafe_fail) | 296 | _ASM_EXTABLE(.L_write_trailing_bytes, .E_trailing_bytes) |
296 | _ASM_EXTABLE_FAULT(.L_cache_w5, .L_memcpy_mcsafe_fail) | ||
297 | _ASM_EXTABLE_FAULT(.L_cache_w6, .L_memcpy_mcsafe_fail) | ||
298 | _ASM_EXTABLE_FAULT(.L_cache_w7, .L_memcpy_mcsafe_fail) | ||
299 | _ASM_EXTABLE_FAULT(.L_copy_trailing_words, .L_memcpy_mcsafe_fail) | ||
300 | _ASM_EXTABLE_FAULT(.L_copy_trailing_bytes, .L_memcpy_mcsafe_fail) | ||
301 | #endif | 297 | #endif |
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index 59b19b6a40d7..b7db3261c62d 100644 --- a/tools/include/uapi/linux/bpf.h +++ b/tools/include/uapi/linux/bpf.h | |||
@@ -1857,7 +1857,8 @@ union bpf_attr { | |||
1857 | * is resolved), the nexthop address is returned in ipv4_dst | 1857 | * is resolved), the nexthop address is returned in ipv4_dst |
1858 | * or ipv6_dst based on family, smac is set to mac address of | 1858 | * or ipv6_dst based on family, smac is set to mac address of |
1859 | * egress device, dmac is set to nexthop mac address, rt_metric | 1859 | * egress device, dmac is set to nexthop mac address, rt_metric |
1860 | * is set to metric from route (IPv4/IPv6 only). | 1860 | * is set to metric from route (IPv4/IPv6 only), and ifindex |
1861 | * is set to the device index of the nexthop from the FIB lookup. | ||
1861 | * | 1862 | * |
1862 | * *plen* argument is the size of the passed in struct. | 1863 | * *plen* argument is the size of the passed in struct. |
1863 | * *flags* argument can be a combination of one or more of the | 1864 | * *flags* argument can be a combination of one or more of the |
@@ -1873,9 +1874,10 @@ union bpf_attr { | |||
1873 | * *ctx* is either **struct xdp_md** for XDP programs or | 1874 | * *ctx* is either **struct xdp_md** for XDP programs or |
1874 | * **struct sk_buff** tc cls_act programs. | 1875 | * **struct sk_buff** tc cls_act programs. |
1875 | * Return | 1876 | * Return |
1876 | * Egress device index on success, 0 if packet needs to continue | 1877 | * * < 0 if any input argument is invalid |
1877 | * up the stack for further processing or a negative error in case | 1878 | * * 0 on success (packet is forwarded, nexthop neighbor exists) |
1878 | * of failure. | 1879 | * * > 0 one of **BPF_FIB_LKUP_RET_** codes explaining why the |
1880 | * * packet is not forwarded or needs assist from full stack | ||
1879 | * | 1881 | * |
1880 | * int bpf_sock_hash_update(struct bpf_sock_ops_kern *skops, struct bpf_map *map, void *key, u64 flags) | 1882 | * int bpf_sock_hash_update(struct bpf_sock_ops_kern *skops, struct bpf_map *map, void *key, u64 flags) |
1881 | * Description | 1883 | * Description |
@@ -2612,6 +2614,18 @@ struct bpf_raw_tracepoint_args { | |||
2612 | #define BPF_FIB_LOOKUP_DIRECT BIT(0) | 2614 | #define BPF_FIB_LOOKUP_DIRECT BIT(0) |
2613 | #define BPF_FIB_LOOKUP_OUTPUT BIT(1) | 2615 | #define BPF_FIB_LOOKUP_OUTPUT BIT(1) |
2614 | 2616 | ||
2617 | enum { | ||
2618 | BPF_FIB_LKUP_RET_SUCCESS, /* lookup successful */ | ||
2619 | BPF_FIB_LKUP_RET_BLACKHOLE, /* dest is blackholed; can be dropped */ | ||
2620 | BPF_FIB_LKUP_RET_UNREACHABLE, /* dest is unreachable; can be dropped */ | ||
2621 | BPF_FIB_LKUP_RET_PROHIBIT, /* dest not allowed; can be dropped */ | ||
2622 | BPF_FIB_LKUP_RET_NOT_FWDED, /* packet is not forwarded */ | ||
2623 | BPF_FIB_LKUP_RET_FWD_DISABLED, /* fwding is not enabled on ingress */ | ||
2624 | BPF_FIB_LKUP_RET_UNSUPP_LWT, /* fwd requires encapsulation */ | ||
2625 | BPF_FIB_LKUP_RET_NO_NEIGH, /* no neighbor entry for nh */ | ||
2626 | BPF_FIB_LKUP_RET_FRAG_NEEDED, /* fragmentation required to fwd */ | ||
2627 | }; | ||
2628 | |||
2615 | struct bpf_fib_lookup { | 2629 | struct bpf_fib_lookup { |
2616 | /* input: network family for lookup (AF_INET, AF_INET6) | 2630 | /* input: network family for lookup (AF_INET, AF_INET6) |
2617 | * output: network family of egress nexthop | 2631 | * output: network family of egress nexthop |
@@ -2625,7 +2639,11 @@ struct bpf_fib_lookup { | |||
2625 | 2639 | ||
2626 | /* total length of packet from network header - used for MTU check */ | 2640 | /* total length of packet from network header - used for MTU check */ |
2627 | __u16 tot_len; | 2641 | __u16 tot_len; |
2628 | __u32 ifindex; /* L3 device index for lookup */ | 2642 | |
2643 | /* input: L3 device index for lookup | ||
2644 | * output: device index from FIB lookup | ||
2645 | */ | ||
2646 | __u32 ifindex; | ||
2629 | 2647 | ||
2630 | union { | 2648 | union { |
2631 | /* inputs to lookup */ | 2649 | /* inputs to lookup */ |
diff --git a/tools/include/uapi/linux/perf_event.h b/tools/include/uapi/linux/perf_event.h index b8e288a1f740..eeb787b1c53c 100644 --- a/tools/include/uapi/linux/perf_event.h +++ b/tools/include/uapi/linux/perf_event.h | |||
@@ -143,6 +143,8 @@ enum perf_event_sample_format { | |||
143 | PERF_SAMPLE_PHYS_ADDR = 1U << 19, | 143 | PERF_SAMPLE_PHYS_ADDR = 1U << 19, |
144 | 144 | ||
145 | PERF_SAMPLE_MAX = 1U << 20, /* non-ABI */ | 145 | PERF_SAMPLE_MAX = 1U << 20, /* non-ABI */ |
146 | |||
147 | __PERF_SAMPLE_CALLCHAIN_EARLY = 1ULL << 63, | ||
146 | }; | 148 | }; |
147 | 149 | ||
148 | /* | 150 | /* |
diff --git a/tools/perf/arch/x86/util/pmu.c b/tools/perf/arch/x86/util/pmu.c index 63a74c32ddc5..e33ef5bc31c5 100644 --- a/tools/perf/arch/x86/util/pmu.c +++ b/tools/perf/arch/x86/util/pmu.c | |||
@@ -1,6 +1,7 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
2 | #include <string.h> | 2 | #include <string.h> |
3 | 3 | ||
4 | #include <linux/stddef.h> | ||
4 | #include <linux/perf_event.h> | 5 | #include <linux/perf_event.h> |
5 | 6 | ||
6 | #include "../../util/intel-pt.h" | 7 | #include "../../util/intel-pt.h" |
diff --git a/tools/perf/arch/x86/util/tsc.c b/tools/perf/arch/x86/util/tsc.c index 06bae7023a51..950539f9a4f7 100644 --- a/tools/perf/arch/x86/util/tsc.c +++ b/tools/perf/arch/x86/util/tsc.c | |||
@@ -2,6 +2,7 @@ | |||
2 | #include <stdbool.h> | 2 | #include <stdbool.h> |
3 | #include <errno.h> | 3 | #include <errno.h> |
4 | 4 | ||
5 | #include <linux/stddef.h> | ||
5 | #include <linux/perf_event.h> | 6 | #include <linux/perf_event.h> |
6 | 7 | ||
7 | #include "../../perf.h" | 8 | #include "../../perf.h" |
diff --git a/tools/perf/bench/Build b/tools/perf/bench/Build index 60bf11943047..eafce1a130a1 100644 --- a/tools/perf/bench/Build +++ b/tools/perf/bench/Build | |||
@@ -7,6 +7,7 @@ perf-y += futex-wake-parallel.o | |||
7 | perf-y += futex-requeue.o | 7 | perf-y += futex-requeue.o |
8 | perf-y += futex-lock-pi.o | 8 | perf-y += futex-lock-pi.o |
9 | 9 | ||
10 | perf-$(CONFIG_X86_64) += mem-memcpy-x86-64-lib.o | ||
10 | perf-$(CONFIG_X86_64) += mem-memcpy-x86-64-asm.o | 11 | perf-$(CONFIG_X86_64) += mem-memcpy-x86-64-asm.o |
11 | perf-$(CONFIG_X86_64) += mem-memset-x86-64-asm.o | 12 | perf-$(CONFIG_X86_64) += mem-memset-x86-64-asm.o |
12 | 13 | ||
diff --git a/tools/perf/bench/mem-memcpy-x86-64-asm.S b/tools/perf/bench/mem-memcpy-x86-64-asm.S index b43f8d2a34ec..9ad015a1e202 100644 --- a/tools/perf/bench/mem-memcpy-x86-64-asm.S +++ b/tools/perf/bench/mem-memcpy-x86-64-asm.S | |||
@@ -6,6 +6,7 @@ | |||
6 | #define altinstr_replacement text | 6 | #define altinstr_replacement text |
7 | #define globl p2align 4; .globl | 7 | #define globl p2align 4; .globl |
8 | #define _ASM_EXTABLE_FAULT(x, y) | 8 | #define _ASM_EXTABLE_FAULT(x, y) |
9 | #define _ASM_EXTABLE(x, y) | ||
9 | 10 | ||
10 | #include "../../arch/x86/lib/memcpy_64.S" | 11 | #include "../../arch/x86/lib/memcpy_64.S" |
11 | /* | 12 | /* |
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 @@ | |||
1 | /* | ||
2 | * From code in arch/x86/lib/usercopy_64.c, copied to keep tools/ copy | ||
3 | * of the kernel's arch/x86/lib/memcpy_64.s used in 'perf bench mem memcpy' | ||
4 | * happy. | ||
5 | */ | ||
6 | #include <linux/types.h> | ||
7 | |||
8 | unsigned long __memcpy_mcsafe(void *dst, const void *src, size_t cnt); | ||
9 | unsigned long mcsafe_handle_tail(char *to, char *from, unsigned len); | ||
10 | |||
11 | unsigned long mcsafe_handle_tail(char *to, char *from, unsigned len) | ||
12 | { | ||
13 | for (; len; --len, to++, from++) { | ||
14 | /* | ||
15 | * Call the assembly routine back directly since | ||
16 | * memcpy_mcsafe() may silently fallback to memcpy. | ||
17 | */ | ||
18 | unsigned long rem = __memcpy_mcsafe(to, from, 1); | ||
19 | |||
20 | if (rem) | ||
21 | break; | ||
22 | } | ||
23 | return len; | ||
24 | } | ||
diff --git a/tools/perf/perf.h b/tools/perf/perf.h index a1a97956136f..d215714f48df 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <time.h> | 5 | #include <time.h> |
6 | #include <stdbool.h> | 6 | #include <stdbool.h> |
7 | #include <linux/types.h> | 7 | #include <linux/types.h> |
8 | #include <linux/stddef.h> | ||
8 | #include <linux/perf_event.h> | 9 | #include <linux/perf_event.h> |
9 | 10 | ||
10 | extern bool test_attr__enabled; | 11 | extern bool test_attr__enabled; |
diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h index 90d4577a92dc..6d7fe44aadc0 100644 --- a/tools/perf/util/header.h +++ b/tools/perf/util/header.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #ifndef __PERF_HEADER_H | 2 | #ifndef __PERF_HEADER_H |
3 | #define __PERF_HEADER_H | 3 | #define __PERF_HEADER_H |
4 | 4 | ||
5 | #include <linux/stddef.h> | ||
5 | #include <linux/perf_event.h> | 6 | #include <linux/perf_event.h> |
6 | #include <sys/types.h> | 7 | #include <sys/types.h> |
7 | #include <stdbool.h> | 8 | #include <stdbool.h> |
diff --git a/tools/perf/util/namespaces.h b/tools/perf/util/namespaces.h index 760558dcfd18..cae1a9a39722 100644 --- a/tools/perf/util/namespaces.h +++ b/tools/perf/util/namespaces.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #define __PERF_NAMESPACES_H | 10 | #define __PERF_NAMESPACES_H |
11 | 11 | ||
12 | #include <sys/types.h> | 12 | #include <sys/types.h> |
13 | #include <linux/stddef.h> | ||
13 | #include <linux/perf_event.h> | 14 | #include <linux/perf_event.h> |
14 | #include <linux/refcount.h> | 15 | #include <linux/refcount.h> |
15 | #include <linux/types.h> | 16 | #include <linux/types.h> |