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

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] 94+ messages in thread

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

Thread overview: 94+ 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 ` 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
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

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.