summaryrefslogtreecommitdiff
path: root/include/exec/memory.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-03-18 14:21:43 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2015-04-30 16:55:32 +0200
commit41063e1e7afcb2f13e103720fe96221657f5dbbc (patch)
treece78dca7d90917ffc9bfe45fcec5dfba0f8a9320 /include/exec/memory.h
parent4c6637525290dc863a00be7f58fc11d07b780bd4 (diff)
downloadqemu-41063e1e7afcb2f13e103720fe96221657f5dbbc.zip
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>
Diffstat (limited to 'include/exec/memory.h')
-rw-r--r--include/exec/memory.h4
1 files changed, 3 insertions, 1 deletions
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