From: Javier Gonzalez <javier@cnexlabs.com>
To: "Matias Bjørling" <mb@lightnvm.io>
Cc: Heiner Litz <hlitz@ucsc.edu>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
Marcin Dziegielewski <marcin.dziegielewski@intel.com>,
"Konopko, Igor J" <igor.j.konopko@intel.com>
Subject: Re: [PATCH] lightnvm: pblk: Add read memory barrier when reading from rb
Date: Thu, 28 Jun 2018 08:15:29 +0000 [thread overview]
Message-ID: <2A35B284-70C5-4EB5-AF4F-63012383295B@cnexlabs.com> (raw)
In-Reply-To: <3f640809-3093-55da-6014-91b98d7ae642@lightnvm.io>
[-- Attachment #1: Type: text/plain, Size: 1818 bytes --]
> On 28 Jun 2018, at 09.59, Matias Bjørling <mb@lightnvm.io> wrote:
>
> On 06/28/2018 01:31 AM, Heiner Litz wrote:
>> There is a control dependency between two disjoint variables (only read data if flags == WRITTEN). Because x86-TSO allows re-ordering of loads the control dependency can be violated.
>
> I'm sorry, I do not see it :)
>
> Here is my understanding:
>
> entry->w_ctx.flags is used as a flagging mechanism to wait for data to become available when "flags" has PBLK_WRITTEN_DATA.
>
> The later access to entry->data is independent of this. It is assumed that entry->w_ctx.flags is the guarding barrier.
This is correct. The motivation is to allow several producers to fill the
buffer simultaneously.
>
> Here is the titbit from the control dependency section that makes me
> say that the entry->data loads is not possible to be done before
> entry->w_ctx.flags:
>
> " (*) Control dependencies apply only to the then-clause and else-clause
> of the if-statement containing the control dependency, including
> any functions that these two clauses call. Control dependencies
> do -not- apply to code following the if-statement containing the
> control dependency."
>
> The read of entry->data must come after the READ_ONCE of entry->w_ctx.flags.
>
I also understood it this way when implementing the barrier, but after
an offline discussion with Heiner, he convinced me that reordering could
occur.
>> BTW: ARM has an even more relaxed memory model and also allows to
>> re-order writes. If we want to support ARM correctly, I think we also
>> need to insert a memory barrier between writing data and writing
>> flags (and there might be a couple other places where we need to
>> check).
Heiner: Can you develop on this?
Javier
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2018-06-28 8:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1529535298-15465-1-git-send-email-hlitz@ucsc.edu>
[not found] ` <4ef758b3-f9f0-42b5-c202-6f1491f027aa@lightnvm.io>
[not found] ` <CAJbgVnUmP6UgA1Mu_do0OLVg2gXrbp7opCVhA6aRD07fxjjk1g@mail.gmail.com>
2018-06-28 7:59 ` [PATCH] lightnvm: pblk: Add read memory barrier when reading from rb Matias Bjørling
2018-06-28 8:15 ` Javier Gonzalez [this message]
2018-07-03 10:14 ` Heiner Litz
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=2A35B284-70C5-4EB5-AF4F-63012383295B@cnexlabs.com \
--to=javier@cnexlabs.com \
--cc=hlitz@ucsc.edu \
--cc=igor.j.konopko@intel.com \
--cc=linux-block@vger.kernel.org \
--cc=marcin.dziegielewski@intel.com \
--cc=mb@lightnvm.io \
/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