diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2015-12-16 10:30:47 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2015-12-17 17:33:48 +0100 |
commit | 49b24afcb11d682d82747f706e3bd6174fe84062 (patch) | |
tree | 21df80016e7b1139a9d4619f5e2c0f7345449673 /include | |
parent | c8ee0a445a6a85635e962c0346bc7b1259c1a3f5 (diff) |
exec: always call qemu_get_ram_ptr within rcu_read_lock
Simplify the code and document the assumption. The only caller
that is not within rcu_read_lock is memory_region_get_ram_ptr.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/exec/memory.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/exec/memory.h b/include/exec/memory.h index 0f07159bb4..9bbd247c38 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -656,8 +656,13 @@ int memory_region_get_fd(MemoryRegion *mr); * memory_region_get_ram_ptr: Get a pointer into a RAM memory region. * * Returns a host pointer to a RAM memory region (created with - * memory_region_init_ram() or memory_region_init_ram_ptr()). Use with - * care. + * memory_region_init_ram() or memory_region_init_ram_ptr()). + * + * Use with care; by the time this function returns, the returned pointer is + * not protected by RCU anymore. If the caller is not within an RCU critical + * section and does not hold the iothread lock, it must have other means of + * protecting the pointer, such as a reference to the region that includes + * the incoming ram_addr_t. * * @mr: the memory region being queried. */ |