diff options
author | 2018-10-19 13:43:09 -0700 | |
---|---|---|
committer | 2018-10-19 13:43:09 -0700 | |
commit | 2929ad29a3015120ab64c86f362fc2a590ceb69c (patch) | |
tree | dce79eaf0705b6bc3eaf0c8592fb36893427246b /tools/perf | |
parent | selftests/bpf: add missing executables to .gitignore (diff) | |
parent | bpf, libbpf: use correct barriers in perf ring buffer walk (diff) | |
download | linux-dev-2929ad29a3015120ab64c86f362fc2a590ceb69c.tar.xz linux-dev-2929ad29a3015120ab64c86f362fc2a590ceb69c.zip |
Merge branch 'improve_perf_barriers'
Daniel Borkmann says:
====================
This set first adds smp_* barrier variants to tools infrastructure
and updates perf and libbpf to make use of them. For details, please
see individual patches, thanks!
Arnaldo, if there are no objections, could this be routed via bpf-next
with Acked-by's due to later dependencies in libbpf? Alternatively,
I could also get the 2nd patch out during merge window, but perhaps
it's okay to do in one go as there shouldn't be much conflict in perf
itself.
Thanks!
v1 -> v2:
- add common helper and switch to acquire/release variants
when possible, thanks Peter!
====================
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/mmap.h | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/tools/perf/util/mmap.h b/tools/perf/util/mmap.h index 05a6d47c7956..8f6531fd4dad 100644 --- a/tools/perf/util/mmap.h +++ b/tools/perf/util/mmap.h @@ -4,7 +4,7 @@ #include <linux/compiler.h> #include <linux/refcount.h> #include <linux/types.h> -#include <asm/barrier.h> +#include <linux/ring_buffer.h> #include <stdbool.h> #include "auxtrace.h" #include "event.h" @@ -71,21 +71,12 @@ void perf_mmap__consume(struct perf_mmap *map); static inline u64 perf_mmap__read_head(struct perf_mmap *mm) { - struct perf_event_mmap_page *pc = mm->base; - u64 head = READ_ONCE(pc->data_head); - rmb(); - return head; + return ring_buffer_read_head(mm->base); } static inline void perf_mmap__write_tail(struct perf_mmap *md, u64 tail) { - struct perf_event_mmap_page *pc = md->base; - - /* - * ensure all reads are done before we write the tail out. - */ - mb(); - pc->data_tail = tail; + ring_buffer_write_tail(md->base, tail); } union perf_event *perf_mmap__read_forward(struct perf_mmap *map); |