From 49b24afcb11d682d82747f706e3bd6174fe84062 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 16 Dec 2015 10:30:47 +0100 Subject: 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 --- include/exec/memory.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'include') 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. */ -- cgit v1.2.3