aboutsummaryrefslogtreecommitdiff
path: root/softmmu
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2023-03-03 14:36:32 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2023-03-07 12:39:53 +0100
commit33828ca11da08436e1b32f3e79dabce3061a0427 (patch)
tree2f6d756605262869edb3975c2b3a8f059b104f75 /softmmu
parente3a3b6ec8169eab2feb241b4982585001512cd55 (diff)
downloadqemu-33828ca11da08436e1b32f3e79dabce3061a0427.zip
qemu-33828ca11da08436e1b32f3e79dabce3061a0427.tar.gz
qemu-33828ca11da08436e1b32f3e79dabce3061a0427.tar.bz2
physmem: add missing memory barrier
Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: David Hildenbrand <david@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'softmmu')
-rw-r--r--softmmu/physmem.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index 47143ed..a6efd8e 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -2927,6 +2927,8 @@ void cpu_register_map_client(QEMUBH *bh)
qemu_mutex_lock(&map_client_list_lock);
client->bh = bh;
QLIST_INSERT_HEAD(&map_client_list, client, link);
+ /* Write map_client_list before reading in_use. */
+ smp_mb();
if (!qatomic_read(&bounce.in_use)) {
cpu_notify_map_clients_locked();
}
@@ -3116,6 +3118,7 @@ void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len,
qemu_vfree(bounce.buffer);
bounce.buffer = NULL;
memory_region_unref(bounce.mr);
+ /* Clear in_use before reading map_client_list. */
qatomic_mb_set(&bounce.in_use, false);
cpu_notify_map_clients();
}