• Paolo Bonzini's avatar
    memory: add reference counting to FlatView · 856d7245
    Paolo Bonzini authored
    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: default avatarAnthony Liguori <aliguori@us.ibm.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
memory.c 56.9 KB