[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180511162053.GY26088@linux.vnet.ibm.com>
Date: Fri, 11 May 2018 09:20:53 -0700
From: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Xiao Guangrong <guangrong.xiao@...il.com>, rostedt@...dmis.org,
Lai Jiangshan <jiangshanlai@...il.com>, stefani@...bold.net,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: Is read barrier missed in kfifo?
On Fri, May 11, 2018 at 10:32:42AM +0200, Peter Zijlstra wrote:
> On Fri, May 11, 2018 at 03:25:18PM +0800, Xiao Guangrong wrote:
> >
> > Hi,
> >
> > Currently, there is no read barrier between reading the index
> > (kfifo.in) and fetching the real data from the fifo.
> >
> > I am afraid that will cause the vfifo is observed as not empty
> > however the data is not actually ready for read. Right?
>
> That code is decidedly dodgy indeed. I can only see smp_wmb() but no
> matching barriers at all -- therefore the code is almost certainly as
> good as not having any barriers at all.
>
> I would suggest you try and convert the code to smp_store_release() and
> smp_load_acquire() while you're at it.
Isn't this one of the places where we rely on control dependencies?
Thanx, Paul
Powered by blists - more mailing lists