On Wed, 8 Jul 2015 19:42:21 +0200
Paolo Bonzini <pbonz...@redhat.com> wrote:

> 
> 
> On 08/07/2015 16:58, Igor Mammedov wrote:
> > I'll drop this patch in favor of dedicated
> > memory_region_add_subregion_to_hva() API that can fail and return
> > error.
> 
> Isn't the deletion of subregion that is done too early for your work?
> 
> You don't want the hot-unplug to complete until all the
> address_space_unmaps have completed, if I understand correctly.
yep, region deletion + unmapping from HVA is delayed
until MemoryRegion.destructor is called see 8/8
   memory_region_add_subregion_common() {
       subregion->destructor = memory_region_destructor_hva_ram; 
   }
where default ram destructor is overridden by HVA specific one.

so though delete_subregion() deleted region from current view
that region is still hanging in HVA and old views until ALL
references to it are gone including backend.

When the last reference is gone MemoryRegion.destructor is called and
it unmaps region from HVA range and removes region from hva_mapped_head
list which allows memory_region_add_subregion_to_hva() to check if
range is free to use or error out if it still occupied by old region.

> 
> Paolo


Reply via email to