[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 7/9] physmem: add missing memory barrier
From: |
Paolo Bonzini |
Subject: |
[PATCH v2 7/9] physmem: add missing memory barrier |
Date: |
Mon, 6 Mar 2023 23:33:04 +0100 |
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
softmmu/physmem.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index 47143edb4f6c..a6efd8e8dd11 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();
}
--
2.39.1
- [PATCH v2 0/9] Fix missing memory barriers on ARM, Paolo Bonzini, 2023/03/06
- [PATCH v2 1/9] qatomic: add smp_mb__before/after_rmw(), Paolo Bonzini, 2023/03/06
- [PATCH v2 2/9] qemu-thread-posix: cleanup, fix, document QemuEvent, Paolo Bonzini, 2023/03/06
- [PATCH v2 3/9] qemu-thread-win32: cleanup, fix, document QemuEvent, Paolo Bonzini, 2023/03/06
- [PATCH v2 4/9] edu: add smp_mb__after_rmw(), Paolo Bonzini, 2023/03/06
- [PATCH v2 5/9] aio-wait: switch to smp_mb__after_rmw(), Paolo Bonzini, 2023/03/06
- [PATCH v2 6/9] qemu-coroutine-lock: add smp_mb__after_rmw(), Paolo Bonzini, 2023/03/06
- [PATCH v2 7/9] physmem: add missing memory barrier,
Paolo Bonzini <=
- [PATCH v2 8/9] async: update documentation of the memory barriers, Paolo Bonzini, 2023/03/06
- Re: [PATCH v2 8/9] async: update documentation of the memory barriers, Stefan Hajnoczi, 2023/03/06
- Re: [PATCH v2 8/9] async: update documentation of the memory barriers, Richard Henderson, 2023/03/06
- Re: [PATCH v2 8/9] async: update documentation of the memory barriers, Paolo Bonzini, 2023/03/07
- Re: [PATCH v2 8/9] async: update documentation of the memory barriers, Richard Henderson, 2023/03/07
- Re: [PATCH v2 8/9] async: update documentation of the memory barriers, Paolo Bonzini, 2023/03/07
- Re: [PATCH v2 8/9] async: update documentation of the memory barriers, Richard Henderson, 2023/03/07
- Re: [PATCH v2 8/9] async: update documentation of the memory barriers, Paolo Bonzini, 2023/03/08
- Re: [PATCH v2 8/9] async: update documentation of the memory barriers, Richard Henderson, 2023/03/08
- Re: [PATCH v2 8/9] async: update documentation of the memory barriers, Paolo Bonzini, 2023/03/08