exec: move rcu_read_lock/unlock to address_space_translate callers

Once address_space_translate will be called outside the BQL, the returned
MemoryRegion might disappear as soon as the RCU read-side critical section
ends.  Avoid this by moving the critical section to the callers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1426684909-95030-3-git-send-email-pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2015-03-18 14:21:43 +01:00
parent 4c66375252
commit 41063e1e7a
4 changed files with 40 additions and 7 deletions

View file

@ -1233,7 +1233,9 @@ void address_space_stq(AddressSpace *as, hwaddr addr, uint64_t val,
#endif
/* address_space_translate: translate an address range into an address space
* into a MemoryRegion and an address range into that section
* into a MemoryRegion and an address range into that section. Should be
* called from an RCU critical section, to avoid that the last reference
* to the returned region disappears after address_space_translate returns.
*
* @as: #AddressSpace to be accessed
* @addr: address within that address space