From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Xiao Guangrong <guangrong.xiao@gmail.com>,
rostedt@goodmis.org, Lai Jiangshan <jiangshanlai@gmail.com>,
stefani@seibold.net,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: Is read barrier missed in kfifo?
Date: Fri, 11 May 2018 09:20:53 -0700 [thread overview]
Message-ID: <20180511162053.GY26088@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180511083242.GJ12217@hirez.programming.kicks-ass.net>
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
next prev parent reply other threads:[~2018-05-11 16:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-11 7:25 Is read barrier missed in kfifo? Xiao Guangrong
2018-05-11 7:33 ` Stefani Seibold
2018-05-11 8:32 ` Peter Zijlstra
2018-05-11 16:20 ` Paul E. McKenney [this message]
2018-05-14 6:57 ` Peter Zijlstra
2018-05-14 13:25 ` Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180511162053.GY26088@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=guangrong.xiao@gmail.com \
--cc=jiangshanlai@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=stefani@seibold.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.