memory: add reference counting to FlatView

Enterprise / Virtualization / QEMU - Paolo Bonzini [redhat.com] - 4 July 2013 10:42 UTC

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.

856d724 memory: add reference counting to FlatView
memory.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 69 insertions(+), 10 deletions(-)

Upstream: git.qemu.org


  • Share