Re: [PATCH] perf/ring_buffer: Fix exposing a temporarily decreased data_head.

From: Yabin Cui
Date: Fri May 17 2019 - 14:01:24 EST


> > - local_inc(&rb->nest);
> > + rb->nest++;
> > + barrier();

> Urgh; almost but not quite. You just lost the 'volatile' qualifier and
> now the compiler can mess things up for you.

I thought the barriers added could force the compiler to forget what it knows
about rb->nest, and do the write as been told to. I appreciate it if you can
tell me more details about it. Anyway, it's a good choice to be protective
and always use WRITE_ONCE/READ_ONCE for rb->nest.

> What I'm going to do is split this into two patches, one fixes the
> problem and marked for backport, and one changing away from local_t.

I read the split patches. They totally LGTM. Thanks for all your help
and rapid reply! I appreciate it :)