mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Xiao Guangrong <guangrong.xiao@gmail.com>
Cc: paulmck@linux.vnet.ibm.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 10:32:42 +0200	[thread overview]
Message-ID: <20180511083242.GJ12217@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <5382d3a8-08e0-5429-0cd3-36f9c69197e1@gmail.com>

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.

  parent reply	other threads:[~2018-05-11  8:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-11  7:25 Xiao Guangrong
2018-05-11  7:33 ` Stefani Seibold
2018-05-11  8:32 ` Peter Zijlstra [this message]
2018-05-11 16:20   ` Paul E. McKenney
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=20180511083242.GJ12217@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=guangrong.xiao@gmail.com \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®