All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>,
	linux-kernel@vger.kernel.org,
	Alan Stern <stern@rowland.harvard.edu>,
	Andrea Parri <andrea.parri@amarulasolutions.com>,
	Will Deacon <will.deacon@arm.com>,
	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,
	Jonathan Corbet <corbet@lwn.net>,
	Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Matt Turner <mattst88@gmail.com>, Arnd Bergmann <arnd@arndb.de>,
	Luc Van Oostenryck <luc.vanoostenryck@gmail.com>,
	linux-doc@vger.kernel.org, linux-alpha@vger.kernel.org,
	linux-sparse@vger.kernel.org
Subject: Re: [PATCH RFC 3/4] barriers: convert a control to a data dependency
Date: Mon, 7 Jan 2019 16:54:23 +0100	[thread overview]
Message-ID: <20190107155423.GM2218@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20190107082223-mutt-send-email-mst@kernel.org>

On Mon, Jan 07, 2019 at 08:36:36AM -0500, Michael S. Tsirkin wrote:
> On Mon, Jan 07, 2019 at 10:46:10AM +0100, Peter Zijlstra wrote:

> > How about naming the thing: dependent_ptr() ? That is without any (r)mb
> > implications at all. The address dependency is strictly weaker than an
> > rmb in that it will only order the two loads in qestion and not, like
> > rmb, any prior to any later load.
> 
> So I'm fine with this as it's enough for virtio, but I would like to point out two things:
> 
> 1. E.g. on x86 both SMP and DMA variants can be NOPs but
> the madatory one can't, so assuming we do not want
> it to be stronger than rmp then either we want
> smp_dependent_ptr(), dma_dependent_ptr(), dependent_ptr()
> or we just will specify that dependent_ptr() works for
> both DMA and SMP.

The latter; the construct simply generates dependent loads. It is up to
the CPU as to what all that works for.

> 2. Down the road, someone might want to order a store after a load.
> Address dependency does that for us too. Assuming we make
> dependent_ptr a NOP on x86, we will want an mb variant
> which isn't a NOP on x86. Will we want to rename
> dependent_ptr to dependent_ptr_rmb at that point?

Not sure; what is the actual overhead of the construct on x86 vs the
NOP?

WARNING: multiple messages have this Message-ID (diff)
From: Peter Zijlstra <peterz@infradead.org>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Andrea Parri <andrea.parri@amarulasolutions.com>,
	linux-doc@vger.kernel.org, Akira Yokosawa <akiyks@gmail.com>,
	Will Deacon <will.deacon@arm.com>,
	virtualization@lists.linux-foundation.org,
	David Howells <dhowells@redhat.com>,
	linux-arch@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
	linux-sparse@vger.kernel.org,
	Alan Stern <stern@rowland.harvard.edu>,
	Matt Turner <mattst88@gmail.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Boqun Feng <boqun.feng@gmail.com>, Arnd Bergmann <arnd@arndb.de>,
	Daniel Lustig <dlustig@nvidia.com>,
	Nicholas Piggin <npiggin@gmail.com>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Luc Maranget <luc.maranget@inria.fr>,
	Richard Henderson <rth@twiddle.net>,
	Jade Alglave <j.alglave@ucl.ac.uk>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-alpha@vger.kernel.org,
	Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: Re: [PATCH RFC 3/4] barriers: convert a control to a data dependency
Date: Mon, 7 Jan 2019 16:54:23 +0100	[thread overview]
Message-ID: <20190107155423.GM2218@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20190107082223-mutt-send-email-mst@kernel.org>

On Mon, Jan 07, 2019 at 08:36:36AM -0500, Michael S. Tsirkin wrote:
> On Mon, Jan 07, 2019 at 10:46:10AM +0100, Peter Zijlstra wrote:

> > How about naming the thing: dependent_ptr() ? That is without any (r)mb
> > implications at all. The address dependency is strictly weaker than an
> > rmb in that it will only order the two loads in qestion and not, like
> > rmb, any prior to any later load.
> 
> So I'm fine with this as it's enough for virtio, but I would like to point out two things:
> 
> 1. E.g. on x86 both SMP and DMA variants can be NOPs but
> the madatory one can't, so assuming we do not want
> it to be stronger than rmp then either we want
> smp_dependent_ptr(), dma_dependent_ptr(), dependent_ptr()
> or we just will specify that dependent_ptr() works for
> both DMA and SMP.

The latter; the construct simply generates dependent loads. It is up to
the CPU as to what all that works for.

> 2. Down the road, someone might want to order a store after a load.
> Address dependency does that for us too. Assuming we make
> dependent_ptr a NOP on x86, we will want an mb variant
> which isn't a NOP on x86. Will we want to rename
> dependent_ptr to dependent_ptr_rmb at that point?

Not sure; what is the actual overhead of the construct on x86 vs the
NOP?

  reply	other threads:[~2019-01-07 15:54 UTC|newest]

Thread overview: 94+ 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 ` 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-02 20:57   ` Michael S. Tsirkin
2019-01-02 20:57   ` Michael S. Tsirkin
2019-01-08 17:44   ` Nick Desaulniers
2019-01-08 17:44     ` Nick Desaulniers
2019-01-08 17:44     ` Nick Desaulniers
2019-01-08 18:50     ` Michael S. Tsirkin
2019-01-08 18:50       ` Michael S. Tsirkin
2019-01-08 18:50       ` Michael S. Tsirkin
2019-01-08 18:50     ` Michael S. Tsirkin
2019-01-09 10:35     ` Miguel Ojeda
2019-01-09 10:35       ` Miguel Ojeda
2019-01-09 10:35       ` Miguel Ojeda
2019-01-09 14:50       ` Michael S. Tsirkin
2019-01-09 14:50         ` Michael S. Tsirkin
2019-01-09 14:50         ` Michael S. Tsirkin
2019-01-19 18:35         ` Miguel Ojeda
2019-01-19 18:35           ` Miguel Ojeda
2019-01-20 14:43           ` Michael S. Tsirkin
2019-01-20 14:43           ` Michael S. Tsirkin
2019-01-20 14:43             ` Michael S. Tsirkin
2019-01-20 15:36             ` Miguel Ojeda
2019-01-20 15:36               ` Miguel Ojeda
2019-01-09 14:50       ` Michael S. Tsirkin
2019-01-10  2:36       ` Michael S. Tsirkin
2019-01-10  2:36         ` Michael S. Tsirkin
2019-01-10  2:36         ` Michael S. Tsirkin
2019-01-10 13:41         ` Dan Carpenter
2019-01-10 13:41           ` Dan Carpenter
2019-01-10 13:41           ` Dan Carpenter
2019-01-10 14:08           ` Michael S. Tsirkin
2019-01-10 14:08             ` Michael S. Tsirkin
2019-01-10 14:08             ` Michael S. Tsirkin
2019-01-10 13:41         ` Dan Carpenter
2019-01-10  2:36       ` Michael S. Tsirkin
2019-01-02 20:57 ` Michael S. Tsirkin
2019-01-02 20:57 ` [PATCH RFC 2/4] include/linux/compiler.h: allow memory operands Michael S. Tsirkin
2019-01-02 20:57 ` Michael S. Tsirkin
2019-01-07 17:54   ` Will Deacon
2019-01-07 17:54     ` Will Deacon
2019-01-07 18:16     ` Michael S. Tsirkin
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 20:57   ` Michael S. Tsirkin
2019-01-02 20:57   ` Michael S. Tsirkin
2019-01-02 21:00   ` Matthew Wilcox
2019-01-02 21:00   ` Matthew Wilcox
2019-01-02 21:00     ` Matthew Wilcox
2019-01-02 21:00     ` Matthew Wilcox
2019-01-02 21:24     ` Michael S. Tsirkin
2019-01-02 21:24     ` Michael S. Tsirkin
2019-01-02 21:24       ` Michael S. Tsirkin
2019-01-02 21:24       ` Michael S. Tsirkin
2019-01-07  3:58   ` Jason Wang
2019-01-07  3:58     ` Jason Wang
2019-01-07  4:23     ` Michael S. Tsirkin
2019-01-07  4:23       ` Michael S. Tsirkin
2019-01-07  4:23       ` Michael S. Tsirkin
2019-01-07  4:23       ` Michael S. Tsirkin
2019-01-07  6:50       ` Jason Wang
2019-01-07  6:50         ` Jason Wang
2019-01-07  6:50         ` Jason Wang
2019-01-07  6:50         ` Jason Wang
2019-01-07  9:46       ` Peter Zijlstra
2019-01-07  9:46         ` Peter Zijlstra
2019-01-07 13:36         ` Michael S. Tsirkin
2019-01-07 13:36           ` Michael S. Tsirkin
2019-01-07 15:54           ` Peter Zijlstra [this message]
2019-01-07 15:54             ` Peter Zijlstra
2019-01-07 16:22             ` Michael S. Tsirkin
2019-01-07 16:22               ` Michael S. Tsirkin
2019-01-07 16:22               ` Michael S. Tsirkin
2019-01-07 16:22             ` Michael S. Tsirkin
2019-01-07 19:02           ` Paul E. McKenney
2019-01-07 19:02             ` Paul E. McKenney
2019-01-07 19:02             ` Paul E. McKenney
2019-01-07 19:13             ` Michael S. Tsirkin
2019-01-07 19:13             ` Michael S. Tsirkin
2019-01-07 19:13               ` Michael S. Tsirkin
2019-01-07 19:13               ` Michael S. Tsirkin
2019-01-07 19:25               ` Paul E. McKenney
2019-01-07 19:25                 ` Paul E. McKenney
2019-01-07 19:25                 ` Paul E. McKenney
2019-01-02 20:57 ` Michael S. Tsirkin
2019-01-02 20:58 ` [PATCH RFC 4/4] virtio: use dependent_ptr_mb Michael S. Tsirkin
2019-01-02 20:58 ` Michael S. Tsirkin
2019-01-02 21:36 ` [PATCH RFC 0/4] barriers using data dependency Alan Stern
2019-01-02 21:36   ` Alan Stern
2019-01-02 23:04   ` Michael S. Tsirkin
2019-01-02 23:04     ` Michael S. Tsirkin
2019-01-03 15:11     ` Alan Stern
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=20190107155423.GM2218@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=akiyks@gmail.com \
    --cc=andrea.parri@amarulasolutions.com \
    --cc=arnd@arndb.de \
    --cc=boqun.feng@gmail.com \
    --cc=corbet@lwn.net \
    --cc=dhowells@redhat.com \
    --cc=dlustig@nvidia.com \
    --cc=ink@jurassic.park.msu.ru \
    --cc=j.alglave@ucl.ac.uk \
    --cc=jasowang@redhat.com \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=luc.maranget@inria.fr \
    --cc=luc.vanoostenryck@gmail.com \
    --cc=mattst88@gmail.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=npiggin@gmail.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=rth@twiddle.net \
    --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 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.