summary refs log tree commit diff stats
path: root/include/qemu/rcu.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2018-02-16 10:04:18 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2018-03-12 16:12:47 +0100
commitc8d3877e48c4f57381d72eaf8d016bff12ce2d7c (patch)
tree204fd1c6da69bdfab70ac5e25007c67195d3e78f /include/qemu/rcu.h
parent77a8b8462b02a10aea5cad389a8f9260f79ede36 (diff)
downloadfocaccia-qemu-c8d3877e48c4f57381d72eaf8d016bff12ce2d7c.tar.gz
focaccia-qemu-c8d3877e48c4f57381d72eaf8d016bff12ce2d7c.zip
membarrier: introduce qemu/sys_membarrier.h
This new header file provides heavy-weight "global" memory barriers that
enforce memory ordering on each running thread belonging to the current
process.  For now, use a dummy implementation that issues memory barriers
on both sides (matching what QEMU has been doing so far).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/qemu/rcu.h')
-rw-r--r--include/qemu/rcu.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/qemu/rcu.h b/include/qemu/rcu.h
index 625f09ac09..22876d1428 100644
--- a/include/qemu/rcu.h
+++ b/include/qemu/rcu.h
@@ -27,6 +27,7 @@
 #include "qemu/thread.h"
 #include "qemu/queue.h"
 #include "qemu/atomic.h"
+#include "qemu/sys_membarrier.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -82,7 +83,7 @@ static inline void rcu_read_lock(void)
     atomic_set(&p_rcu_reader->ctr, ctr);
 
     /* Write p_rcu_reader->ctr before reading RCU-protected pointers.  */
-    smp_mb();
+    smp_mb_placeholder();
 }
 
 static inline void rcu_read_unlock(void)
@@ -96,13 +97,13 @@ static inline void rcu_read_unlock(void)
 
     /* Ensure that the critical section is seen to precede the
      * store to p_rcu_reader->ctr.  Together with the following
-     * smp_mb(), this ensures writes to p_rcu_reader->ctr
+     * smp_mb_placeholder(), this ensures writes to p_rcu_reader->ctr
      * are sequentially consistent.
      */
     atomic_store_release(&p_rcu_reader->ctr, 0);
 
     /* Write p_rcu_reader->ctr before reading p_rcu_reader->waiting.  */
-    smp_mb();
+    smp_mb_placeholder();
     if (unlikely(atomic_read(&p_rcu_reader->waiting))) {
         atomic_set(&p_rcu_reader->waiting, false);
         qemu_event_set(&rcu_gp_event);