aboutsummaryrefslogtreecommitdiff
path: root/util
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 /util
parent77a8b8462b02a10aea5cad389a8f9260f79ede36 (diff)
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 'util')
-rw-r--r--util/rcu.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/util/rcu.c b/util/rcu.c
index 7366dc50dd..5676c22bd1 100644
--- a/util/rcu.c
+++ b/util/rcu.c
@@ -93,10 +93,10 @@ static void wait_for_readers(void)
}
/* Here, order the stores to index->waiting before the loads of
- * index->ctr. Pairs with smp_mb() in rcu_read_unlock(),
+ * index->ctr. Pairs with smp_mb_placeholder() in rcu_read_unlock(),
* ensuring that the loads of index->ctr are sequentially consistent.
*/
- smp_mb();
+ smp_mb_global();
QLIST_FOREACH_SAFE(index, &registry, node, tmp) {
if (!rcu_gp_ongoing(&index->ctr)) {
@@ -145,9 +145,9 @@ void synchronize_rcu(void)
qemu_mutex_lock(&rcu_sync_lock);
/* Write RCU-protected pointers before reading p_rcu_reader->ctr.
- * Pairs with smp_mb() in rcu_read_lock().
+ * Pairs with smp_mb_placeholder() in rcu_read_lock().
*/
- smp_mb();
+ smp_mb_global();
qemu_mutex_lock(&rcu_registry_lock);
if (!QLIST_EMPTY(&registry)) {
@@ -376,6 +376,7 @@ static void rcu_init_child(void)
static void __attribute__((__constructor__)) rcu_init(void)
{
+ smp_mb_global_init();
#ifdef CONFIG_POSIX
pthread_atfork(rcu_init_lock, rcu_init_unlock, rcu_init_child);
#endif