[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/30] exec.c: ensure all AddressSpaceDispatch update
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 05/30] exec.c: ensure all AddressSpaceDispatch updates under RCU |
Date: |
Tue, 1 Nov 2016 17:29:18 +0100 |
From: Alex Bennée <address@hidden>
The memory_dispatch field is meant to be protected by RCU so we should
use the correct primitives when accessing it. This race was flagged up
by the ThreadSanitizer.
Signed-off-by: Alex Bennée <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
exec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/exec.c b/exec.c
index 4d08581..a19ed21 100644
--- a/exec.c
+++ b/exec.c
@@ -493,7 +493,7 @@ address_space_translate_for_iotlb(CPUState *cpu, int asidx,
hwaddr addr,
hwaddr *xlat, hwaddr *plen)
{
MemoryRegionSection *section;
- AddressSpaceDispatch *d = cpu->cpu_ases[asidx].memory_dispatch;
+ AddressSpaceDispatch *d =
atomic_rcu_read(&cpu->cpu_ases[asidx].memory_dispatch);
section = address_space_translate_internal(d, addr, xlat, plen, false);
@@ -2376,7 +2376,7 @@ static void tcg_commit(MemoryListener *listener)
* may have split the RCU critical section.
*/
d = atomic_rcu_read(&cpuas->as->dispatch);
- cpuas->memory_dispatch = d;
+ atomic_rcu_set(&cpuas->memory_dispatch, d);
tlb_flush(cpuas->cpu, 1);
}
--
2.7.4
- [Qemu-devel] [PULL v2 00/30] Misc patches for 2016-10-31, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 01/30] checkpatch: tweak "struct should normally be const" warning, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 02/30] nbd: Use CoQueue for free_sema instead of CoMutex, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 04/30] tests: send error_report to test log, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 03/30] qemu-error: remove dependency of stubs on monitor, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 05/30] exec.c: ensure all AddressSpaceDispatch updates under RCU,
Paolo Bonzini <=
- [Qemu-devel] [PULL 07/30] exec.c: check memory backend file size with 'size' option, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 06/30] exec.c: do not truncate non-empty memory backend file, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 08/30] nbd: Add qemu-nbd -D for human-readable description, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 10/30] nbd: Rename NBDRequest to NBDRequestData, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 09/30] nbd: Treat flags vs. command type as separate fields, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 13/30] nbd: Share common reply-sending code in server, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 11/30] nbd: Rename NbdClientSession to NBDClientSession, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 14/30] nbd: Send message along with server NBD_REP_ERR errors, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 15/30] nbd: Share common option-sending code in client, Paolo Bonzini, 2016/11/01
- [Qemu-devel] [PULL 18/30] nbd: Less allocation during NBD_OPT_LIST, Paolo Bonzini, 2016/11/01