virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC 0/4] barriers using data dependency
@ 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
                   ` (7 more replies)
  0 siblings, 8 replies; 23+ messages in thread
From: Michael S. Tsirkin @ 2019-01-02 20:57 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrea Parri, linux-arch, Paul E. McKenney, Peter Zijlstra,
	Daniel Lustig, Akira Yokosawa, Will Deacon, Nicholas Piggin,
	virtualization, David Howells, Alan Stern, netdev, Luc Maranget,
	Jade Alglave, Boqun Feng

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.

This patchset is also suboptimal on e.g. x86 where e.g. smp_rmb is a nop.

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(-)

-- 
MST

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2019-01-20 14:43 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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-02 20:57 ` [PATCH RFC 2/4] include/linux/compiler.h: allow memory operands 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:58 ` [PATCH RFC 4/4] virtio: use dependent_ptr_mb Michael S. Tsirkin
     [not found] ` <Pine.LNX.4.44L0.1901021629150.1375-100000@iolanthe.rowland.org>
2019-01-02 23:04   ` [PATCH RFC 0/4] barriers using data dependency Michael S. Tsirkin
     [not found] ` <20190102205715.14054-4-mst@redhat.com>
2019-01-02 21:00   ` [PATCH RFC 3/4] barriers: convert a control to a " Matthew Wilcox
     [not found]   ` <20190102210024.GJ6310@bombadil.infradead.org>
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
     [not found]           ` <20190107190236.GF1215@linux.ibm.com>
2019-01-07 19:13             ` Michael S. Tsirkin
     [not found] ` <20190102205715.14054-3-mst@redhat.com>
2019-01-07 17:54   ` [PATCH RFC 2/4] include/linux/compiler.h: allow memory operands Will Deacon
2019-01-07 18:16     ` Michael S. Tsirkin
     [not found] ` <20190102205715.14054-2-mst@redhat.com>
     [not found]   ` <CAKwvOdk3b6mnpTEEyY-JFrej8K12w9oTMLqi7q5aNiRMyJo6Ow@mail.gmail.com>
2019-01-08 18:50     ` [PATCH RFC 1/4] include/linux/compiler*.h: fix OPTIMIZER_HIDE_VAR Michael S. Tsirkin
     [not found]     ` <CANiq72nEiw8+cZNnBOwF1ehv232ZJe5qzhdbaTEg0rOoV2p4sg@mail.gmail.com>
2019-01-09 14:50       ` Michael S. Tsirkin
2019-01-10  2:36       ` Michael S. Tsirkin
     [not found]       ` <20190109213543-mutt-send-email-mst@kernel.org>
2019-01-10 13:41         ` Dan Carpenter
     [not found]       ` <20190109094959-mutt-send-email-mst@kernel.org>
     [not found]         ` <CANiq72npFGsoHmBQUSNRLohDmMBNQFka8AcmhMz--QU1v2Aorg@mail.gmail.com>
2019-01-20 14:43           ` Michael S. Tsirkin

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).