On Wed, Oct 17, 2018 at 04:41:55PM +0200, Daniel Borkmann wrote:
> @@ -73,7 +73,8 @@ 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();
> +
> +     smp_rmb();
>       return head;
>  }
>  
> @@ -84,7 +85,7 @@ static inline void perf_mmap__write_tail(struct perf_mmap 
> *md, u64 tail)
>       /*
>        * ensure all reads are done before we write the tail out.
>        */
> -     mb();
> +     smp_mb();
>       pc->data_tail = tail;

Ideally that would be a WRITE_ONCE() to avoid store tearing.

Alternatively, I think we can use smp_store_release() here, all we care
about is that the prior loads stay prior.

Similarly, I suppose, we could use smp_load_acquire() for the data_head
load above.

>  }
>  
> -- 
> 2.9.5
> 

Reply via email to