From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49860) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z1z2T-0004ng-3I for qemu-devel@nongnu.org; Mon, 08 Jun 2015 11:32:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z1z2L-0004IG-GP for qemu-devel@nongnu.org; Mon, 08 Jun 2015 11:32:37 -0400 Received: from mail-wi0-x22e.google.com ([2a00:1450:400c:c05::22e]:37935) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z1z2L-0004Hi-Ak for qemu-devel@nongnu.org; Mon, 08 Jun 2015 11:32:29 -0400 Received: by wibdq8 with SMTP id dq8so89584383wib.1 for ; Mon, 08 Jun 2015 08:32:28 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <5575B58B.50105@redhat.com> Date: Mon, 08 Jun 2015 17:32:27 +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: > +void qemu_ram_unmap_hva(ram_addr_t addr) > +{ > + RAMBlock *block = find_ram_block(addr); > + > + assert(block); > + mmap(block->host, block->used_length, PROT_NONE, > + MAP_FIXED | MAP_NORESERVE | MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); > +} > + Hmm, this is not good. :( The area at block->host can be in use, for example via memory_region_ref/memory_region_unref. This can happen a bit after the memory_region_del_subregion. So you can SEGV if you simply make a synchronous update. I'm not sure if there is a solution (but thanks for splitting the patches in a way that made the problem clear!). Paolo