[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181017155135.GN3121@hirez.programming.kicks-ass.net>
Date: Wed, 17 Oct 2018 17:51:35 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Daniel Borkmann <daniel@...earbox.net>
Cc: alexei.starovoitov@...il.com, paulmck@...ux.vnet.ibm.com,
will.deacon@....com, acme@...hat.com, yhs@...com,
john.fastabend@...il.com, netdev@...r.kernel.org
Subject: Re: [PATCH bpf-next 3/3] bpf, libbpf: use proper barriers in perf
ring buffer walk
On Wed, Oct 17, 2018 at 04:41:56PM +0200, Daniel Borkmann wrote:
> +static __u64 bpf_perf_read_head(struct perf_event_mmap_page *header)
> +{
> + __u64 data_head = READ_ONCE(header->data_head);
> +
> + smp_rmb();
> + return data_head;
> +}
> +
> +static void bpf_perf_write_tail(struct perf_event_mmap_page *header,
> + __u64 data_tail)
> +{
> + smp_mb();
> + header->data_tail = data_tail;
> +}
Same coments, either smp_load_acquire()/smp_store_release() or at the
very least a WRITE_ONCE() there.
Powered by blists - more mailing lists