]> git.proxmox.com Git - qemu.git/commit
memory: add reference counting to FlatView
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 6 May 2013 09:57:21 +0000 (11:57 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 4 Jul 2013 15:42:49 +0000 (17:42 +0200)
commit856d72454f03aea26fd61c728762ef9cd1d71512
tree3b53d53b76eb3f819ded7a9ae493795398ac85c1
parenta9a0c06dd750cca982f21089099207874b960656
memory: add reference counting to FlatView

With this change, a FlatView can be used even after a concurrent
update has replaced it.  Because we do not yet have RCU, we use a
mutex to protect the small critical sections that read/write the
as->current_map pointer.  Accesses to the FlatView can be done
outside the mutex.

If a MemoryRegion will be used after the FlatView is unref-ed (or after
a MemoryListener callback is returned), a reference has to be added to
that MemoryRegion. memory_region_find already does it for the region
that it returns.  The same will be done for address_space_translate
as soon as the dispatch tree is also converted to RCU-style.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
memory.c