From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47028) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z1ywE-0008NP-CZ for qemu-devel@nongnu.org; Mon, 08 Jun 2015 11:26:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z1yw9-0008KC-9p for qemu-devel@nongnu.org; Mon, 08 Jun 2015 11:26:10 -0400 Received: from mail-wi0-x233.google.com ([2a00:1450:400c:c05::233]:37527) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z1yw9-0008Jz-16 for qemu-devel@nongnu.org; Mon, 08 Jun 2015 11:26:05 -0400 Received: by wifx6 with SMTP id x6so90906204wif.0 for ; Mon, 08 Jun 2015 08:26:04 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <5575B40A.3000502@redhat.com> Date: Mon, 08 Jun 2015 17:26:02 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1433776757-61958-1-git-send-email-imammedo@redhat.com> <1433776757-61958-4-git-send-email-imammedo@redhat.com> In-Reply-To: <1433776757-61958-4-git-send-email-imammedo@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC v2 3/6] memory: support unmapping of MemoryRegion mapped into HVA parent List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov , qemu-devel@nongnu.org Cc: mst@redhat.com On 08/06/2015 17:19, Igor Mammedov wrote: > + assert(!subregion->hva_mapped); > if (rsvd_hva.mr) { > + subregion->hva_mapped = true; > qemu_ram_remap_hva(mr->ram_addr, > memory_region_get_ram_ptr(rsvd_hva.mr) + > rsvd_hva.offset_within_region); > @@ -1788,6 +1790,15 @@ void memory_region_del_subregion(MemoryRegion *mr, > { > memory_region_transaction_begin(); > assert(subregion->container == mr); > + > + if (mr->ram) { "if (subregion->hva_mapped)" I think would replace this "if" and the one below. Paolo > + MemoryRegionSection rsvd_hva = memory_region_find_hva_range(mr); > + > + if (rsvd_hva.mr) { > + qemu_ram_unmap_hva(mr->ram_addr); > + } > + } > +