From 41063e1e7afcb2f13e103720fe96221657f5dbbc Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 18 Mar 2015 14:21:43 +0100 Subject: 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 Message-Id: <1426684909-95030-3-git-send-email-pbonzini@redhat.com> --- include/exec/memory.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/exec/memory.h b/include/exec/memory.h index 0ccfd3b42a..b61c84f62a 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -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 -- cgit v1.2.3