lkml.org 
[lkml]   [2018]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Is read barrier missed in kfifo?
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.

\
 
 \ /
  Last update: 2018-05-11 10:33    [W:0.043 / U:4.268 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site