diff options
| author | Alex Bennée | 2016-10-21 17:34:18 +0200 |
|---|---|---|
| committer | Paolo Bonzini | 2016-11-01 16:06:57 +0100 |
| commit | f35e44e7645edbb08e35b111c10c2fc57e2905c7 (patch) | |
| tree | 7b818227243f7f62dcdabc4db83f23d9f474298a | |
| parent | tests: send error_report to test log (diff) | |
| download | qemu-f35e44e7645edbb08e35b111c10c2fc57e2905c7.tar.gz qemu-f35e44e7645edbb08e35b111c10c2fc57e2905c7.tar.xz qemu-f35e44e7645edbb08e35b111c10c2fc57e2905c7.zip | |
exec.c: ensure all AddressSpaceDispatch updates under RCU
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 <alex.bennee@linaro.org>
Message-Id: <20161021153418.21571-1-alex.bennee@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| -rw-r--r-- | exec.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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); } |
