From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59576) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X6h7N-00053S-NZ for qemu-devel@nongnu.org; Mon, 14 Jul 2014 10:20:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X6h7H-00084s-MC for qemu-devel@nongnu.org; Mon, 14 Jul 2014 10:20:37 -0400 Message-ID: <53C3E71E.6080909@redhat.com> Date: Mon, 14 Jul 2014 16:20:14 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1403720497-5318-1-git-send-email-pbonzini@redhat.com> <877g442kie.fsf@blackfin.pond.sub.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] serial-pci: remove memory regions from BAR before destroying them List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite , Markus Armbruster Cc: qemu-trivial , "qemu-devel@nongnu.org Developers" , Gerd Hoffmann Il 14/07/2014 14:36, Peter Crosthwaite ha scritto: > On Thu, Jun 26, 2014 at 5:32 PM, Markus Armbruster wrote: >> Paolo Bonzini writes: >> >>> Otherwise, hot-unplug of pci-serial-2x trips the assertion >>> in memory_region_destroy: >>> >>> (qemu) device_del gg >>> (qemu) qemu-system-x86_64: /work/armbru/tmp/qemu/memory.c:1021: memory_region_destroy: Assertion `((&mr->subregions)->tqh_first == ((void *)0))' failed. >>> Aborted (core dumped) >>> >>> Reported-by: Markus Armbruster >>> Signed-off-by: Paolo Bonzini >> >> Reviewed-by: Markus Armbruster >> > > Reviewed-by: Peter Crosthwaite > >> Would it make sense to add a "must not contain subregions" to >> memory_region_destroy()'s function comment? >> > > Any reason to just not patch the memory region finaliser to unparent Note that unparent for memory regions is _not_ memory_region_del_subregion. It is memory_region_destroy. The parent object of a memory region is a device; the _container_ of a memory region is another memory region. > all contained subregions automatically rather than assert? Destroying > a container should imply removing the subregion relationship and > simply orphan the subregion. This makes sense since we will soon make memory_region_destroy optional (devices will automatically destroy their memory regions). Before QOMification, however, I think the assert was a useful debugging tool, guaranteeing that owners of memory regions were destroyed in the right order. So we could indeed revisit this in 2.2 and make memory_region_del_subregion also optional. Paolo