From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0AH4-0001Z7-8M for qemu-devel@nongnu.org; Wed, 03 Jun 2015 11:08:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0AGy-0000u6-Sg for qemu-devel@nongnu.org; Wed, 03 Jun 2015 11:08:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54166) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0AGy-0000tV-NA for qemu-devel@nongnu.org; Wed, 03 Jun 2015 11:08:04 -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 07896369922 for ; Wed, 3 Jun 2015 15:08:04 +0000 (UTC) Message-ID: <556F1850.7090903@redhat.com> Date: Wed, 03 Jun 2015 17:08:00 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1433334157-37665-1-git-send-email-imammedo@redhat.com> <1433334157-37665-3-git-send-email-imammedo@redhat.com> <556EF7AE.8040609@redhat.com> <20150603160526.7727e4e4@nial.brq.redhat.com> In-Reply-To: <20150603160526.7727e4e4@nial.brq.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC 2/2] pc: fix QEMU crashing when more than ~50 memory hotplugged List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: qemu-devel@nongnu.org, mst@redhat.com On 03/06/2015 16:05, Igor Mammedov wrote: >>> > > + rsvd_hva = memory_region_find_rsvd_hva(section->mr); >>> > > + if (rsvd_hva.mr) { >>> > > + start_addr = rsvd_hva.offset_within_address_space; >>> > > + size = int128_get64(rsvd_hva.size); >>> > > + ram = memory_region_get_ram_ptr(rsvd_hva.mr); >>> > > + } else { >>> > > + ram = memory_region_get_ram_ptr(section->mr) + section->offset_within_region; >>> > > + } >> > >> > I don't think this is needed. >> > >> > What _could_ be useful is to merge adjacent ranges even if they are >> > partly unmapped, but your patch doesn't do that. > merging/splitting for adjacent regions is done at following > vhost_dev_(un)assign_memory() but it doesn't cover cases with > gaps in between. > > Trying to make merging/splitting work with gaps might be more > complicated (I haven't tried though), than just passing known > in advance whole rsvd_hva range. > > More over if/when initial memory also converted to rsvd_hva > (aliasing stopped me there for now), we could throw away all > this merging and just keep a single rsvd_hva range for all RAM here. Understood now. This still should be a separate patch. I'm much more confident with the other two (e.g. what happens if a malicious guest writes to memory that is still MAP_NORESERVE), so feel free to post those without RFC tag. But the vhost one really needs mst's eyes. Paolo