From: "Michael S. Tsirkin" <mst@redhat.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-kernel@vger.kernel.org, Jason Wang <jasowang@redhat.com>,
Andrea Parri <andrea.parri@amarulasolutions.com>,
Will Deacon <will.deacon@arm.com>,
Peter Zijlstra <peterz@infradead.org>,
Boqun Feng <boqun.feng@gmail.com>,
Nicholas Piggin <npiggin@gmail.com>,
David Howells <dhowells@redhat.com>,
Jade Alglave <j.alglave@ucl.ac.uk>,
Luc Maranget <luc.maranget@inria.fr>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Akira Yokosawa <akiyks@gmail.com>,
Daniel Lustig <dlustig@nvidia.com>,
linux-arch@vger.kernel.org, netdev@vger.kernel.org,
virtualization@lists.linux-foundation.org
Subject: Re: [PATCH RFC 0/4] barriers using data dependency
Date: Wed, 2 Jan 2019 18:04:31 -0500 [thread overview]
Message-ID: <20190102175247-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1901021629150.1375-100000@iolanthe.rowland.org>
On Wed, Jan 02, 2019 at 04:36:40PM -0500, Alan Stern wrote:
> On Wed, 2 Jan 2019, Michael S. Tsirkin wrote:
>
> > So as explained in Documentation/memory-barriers.txt e.g.
> > a load followed by a store require a full memory barrier,
> > to avoid store being ordered before the load.
> > Similarly load-load requires a read memory barrier.
> >
> > Thinking about it, we can actually create a data dependency
> > by mixing the first loaded value into the pointer being
> > accessed.
> >
> > This adds an API for this and uses it in virtio.
> >
> > Written over the holiday and build tested only so far.
>
> You are using the terminology from memory-barriers.txt, referring to
> the new dependency you create as a data dependency. However,
> tools/memory-model/* uses a more precise name, calling it an address
> dependency. Could you change the comments in the patches to use this
> name instead?
Sure, sounds good. While I'm at it, should memory-barriers.txt be
switched over too?
> > This patchset is also suboptimal on e.g. x86 where e.g. smp_rmb is a nop.
>
> This should be easy to fix with an architecture-specific override.
>
> Alan Stern
Absolutely. It does however mean that we'll need several
variants: mb/rmb, smp/dma/virt/mandatory.
I am still trying to decide whether it's good since it documents the
kind of barrier that we are trying to use - or bad since it's more
verbose and makes you choose one where they are all pretty cheap.
> > Sending out for early feedback/flames.
> >
> > Michael S. Tsirkin (4):
> > include/linux/compiler*.h: fix OPTIMIZER_HIDE_VAR
> > include/linux/compiler.h: allow memory operands
> > barriers: convert a control to a data dependency
> > virtio: use dependent_ptr_mb
> >
> > Documentation/memory-barriers.txt | 20 ++++++++++++++++++++
> > arch/alpha/include/asm/barrier.h | 1 +
> > drivers/virtio/virtio_ring.c | 6 ++++--
> > include/asm-generic/barrier.h | 18 ++++++++++++++++++
> > include/linux/compiler-clang.h | 5 ++---
> > include/linux/compiler-gcc.h | 4 ----
> > include/linux/compiler-intel.h | 4 +---
> > include/linux/compiler.h | 8 +++++++-
> > 8 files changed, 53 insertions(+), 13 deletions(-)
next prev parent reply other threads:[~2019-01-02 23:04 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-02 20:57 [PATCH RFC 0/4] barriers using data dependency Michael S. Tsirkin
2019-01-02 20:57 ` [PATCH RFC 1/4] include/linux/compiler*.h: fix OPTIMIZER_HIDE_VAR Michael S. Tsirkin
2019-01-08 17:44 ` Nick Desaulniers
2019-01-08 18:50 ` Michael S. Tsirkin
2019-01-09 10:35 ` Miguel Ojeda
2019-01-09 14:50 ` Michael S. Tsirkin
2019-01-19 18:35 ` Miguel Ojeda
2019-01-20 14:43 ` Michael S. Tsirkin
2019-01-20 15:36 ` Miguel Ojeda
2019-01-10 2:36 ` Michael S. Tsirkin
2019-01-10 13:41 ` Dan Carpenter
2019-01-10 14:08 ` Michael S. Tsirkin
2019-01-02 20:57 ` [PATCH RFC 2/4] include/linux/compiler.h: allow memory operands Michael S. Tsirkin
2019-01-07 17:54 ` Will Deacon
2019-01-07 18:16 ` Michael S. Tsirkin
2019-01-02 20:57 ` [PATCH RFC 3/4] barriers: convert a control to a data dependency Michael S. Tsirkin
2019-01-02 21:00 ` Matthew Wilcox
2019-01-02 21:24 ` Michael S. Tsirkin
2019-01-07 3:58 ` Jason Wang
2019-01-07 4:23 ` Michael S. Tsirkin
2019-01-07 6:50 ` Jason Wang
2019-01-07 9:46 ` Peter Zijlstra
2019-01-07 13:36 ` Michael S. Tsirkin
2019-01-07 15:54 ` Peter Zijlstra
2019-01-07 16:22 ` Michael S. Tsirkin
2019-01-07 19:02 ` Paul E. McKenney
2019-01-07 19:13 ` Michael S. Tsirkin
2019-01-07 19:25 ` Paul E. McKenney
2019-01-02 20:58 ` [PATCH RFC 4/4] virtio: use dependent_ptr_mb Michael S. Tsirkin
2019-01-02 21:36 ` [PATCH RFC 0/4] barriers using data dependency Alan Stern
2019-01-02 23:04 ` Michael S. Tsirkin [this message]
2019-01-03 15:11 ` Alan Stern
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=20190102175247-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=akiyks@gmail.com \
--cc=andrea.parri@amarulasolutions.com \
--cc=boqun.feng@gmail.com \
--cc=dhowells@redhat.com \
--cc=dlustig@nvidia.com \
--cc=j.alglave@ucl.ac.uk \
--cc=jasowang@redhat.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luc.maranget@inria.fr \
--cc=netdev@vger.kernel.org \
--cc=npiggin@gmail.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=stern@rowland.harvard.edu \
--cc=virtualization@lists.linux-foundation.org \
--cc=will.deacon@arm.com \
/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;
as well as URLs for NNTP newsgroup(s).