Received: from eggs.gnu.org ([2001:4830:134:3::10]:41773) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z1zfs-0007ot-2A for qemu-devel@nongnu.org; Mon, 08 Jun 2015 12:13:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z1zfp-00018i-4e for qemu-devel@nongnu.org; Mon, 08 Jun 2015 12:13:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44295) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z1zfo-00018e-VB for qemu-devel@nongnu.org; Mon, 08 Jun 2015 12:13:17 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id AC85EB5E9B for ; Mon, 8 Jun 2015 16:13:16 +0000 (UTC) Date: Mon, 8 Jun 2015 18:13:14 +0200 From: Igor Mammedov Message-ID: <20150608181314.3ab8fc80@nial.brq.redhat.com> In-Reply-To: <5575B58B.50105@redhat.com> References: <1433776757-61958-1-git-send-email-imammedo@redhat.com> <1433776757-61958-4-git-send-email-imammedo@redhat.com> <5575B58B.50105@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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: Paolo Bonzini Cc: qemu-devel@nongnu.org, mst@redhat.com On Mon, 08 Jun 2015 17:32:27 +0200 Paolo Bonzini wrote: > > > 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 Yep, that's the problem I haven't found solution to so far, any ideas hoe to approach this are appreciated. issue is that we have to re-reserve HVA region first so no other allocation would claim gap and the only way I found was just to call mmap() on it which as side effect invalidates MemoryRegion's backing RAM. > (but thanks for splitting the patches in a way that made the problem > clear!). > > Paolo