summaryrefslogtreecommitdiff
path: root/util/rcu.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-02-11 17:15:18 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2015-02-11 21:48:40 +0100
commita464982499b2f637f6699e3d03e0a9d2e0b5288b (patch)
treeb8d0505ddd878d73c3da801d4f0f9d72d7927ec3 /util/rcu.c
parenta7d1d636797ec1b30ca4dae02f9e1eb2d6b2c439 (diff)
downloadqemu-a464982499b2f637f6699e3d03e0a9d2e0b5288b.tar.gz
qemu-a464982499b2f637f6699e3d03e0a9d2e0b5288b.tar.bz2
qemu-a464982499b2f637f6699e3d03e0a9d2e0b5288b.zip
rcu: run RCU callbacks under the BQL
This needs to go away sooner or later, but one complication is the complex VFIO data structures that are modified in instance_finalize. Take a shortcut for now. Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Tested-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'util/rcu.c')
-rw-r--r--util/rcu.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/util/rcu.c b/util/rcu.c
index 486d7b6cc2..bd73b8eb47 100644
--- a/util/rcu.c
+++ b/util/rcu.c
@@ -35,6 +35,7 @@
#include "qemu/rcu.h"
#include "qemu/atomic.h"
#include "qemu/thread.h"
+#include "qemu/main-loop.h"
/*
* Global grace period counter. Bit 0 is always one in rcu_gp_ctr.
@@ -237,20 +238,24 @@ static void *call_rcu_thread(void *opaque)
atomic_sub(&rcu_call_count, n);
synchronize_rcu();
+ qemu_mutex_lock_iothread();
while (n > 0) {
node = try_dequeue();
while (!node) {
+ qemu_mutex_unlock_iothread();
qemu_event_reset(&rcu_call_ready_event);
node = try_dequeue();
if (!node) {
qemu_event_wait(&rcu_call_ready_event);
node = try_dequeue();
}
+ qemu_mutex_lock_iothread();
}
n--;
node->func(node);
}
+ qemu_mutex_unlock_iothread();
}
abort();
}