cpus-common: stop using mb_set/mb_read
Use a store-release at the end of the work item, and a load-acquire when
waiting for the item to be completed. This is the standard message passing
pattern and is both enough and clearer than mb_read/mb_set.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/cpus-common.c b/cpus-common.c
index b0047e4..a53716d 100644
--- a/cpus-common.c
+++ b/cpus-common.c
@@ -157,7 +157,7 @@
wi.exclusive = false;
queue_work_on_cpu(cpu, &wi);
- while (!qatomic_mb_read(&wi.done)) {
+ while (!qatomic_load_acquire(&wi.done)) {
CPUState *self_cpu = current_cpu;
qemu_cond_wait(&qemu_work_cond, mutex);
@@ -363,7 +363,7 @@
if (wi->free) {
g_free(wi);
} else {
- qatomic_mb_set(&wi->done, true);
+ qatomic_store_release(&wi->done, true);
}
}
qemu_mutex_unlock(&cpu->work_mutex);