On 03/28/2017 09:18 PM, Michael S. Tsirkin wrote: > From: Alexey Kardashevskiy <a...@ozlabs.ru> > > The recent introduction of a bus master container added > memory_region_add_subregion() into the PCI device registering path but > missed memory_region_del_subregion() in the unregistering path leaving > a reference to the root memory region of the new container. > > This adds missing memory_region_del_subregion(). > > Fixes: 3716d5902d743 ("pci: introduce a bus master container") > Signed-off-by: Alexey Kardashevskiy <a...@ozlabs.ru> > Reviewed-by: Michael S. Tsirkin <m...@redhat.com> > Signed-off-by: Michael S. Tsirkin <m...@redhat.com> > Reviewed-by: Paolo Bonzini <pbonz...@redhat.com> > --- > hw/pci/pci.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/hw/pci/pci.c b/hw/pci/pci.c > index e6b08e1..bd8043c 100644 > --- a/hw/pci/pci.c > +++ b/hw/pci/pci.c > @@ -869,6 +869,8 @@ static void do_pci_unregister_device(PCIDevice *pci_dev) > pci_dev->bus->devices[pci_dev->devfn] = NULL; > pci_config_free(pci_dev); > > + memory_region_del_subregion(&pci_dev->bus_master_container_region, > + &pci_dev->bus_master_enable_region); > address_space_destroy(&pci_dev->bus_master_as); > } > >
This causes a regression in iotest 051: 051 7s ... - output mismatch (see 051.out.bad) --- /home/bos/jhuston/src/qemu/tests/qemu-iotests/051.pc.out 2017-03-27 12:30:59.945613766 -0400 +++ 051.out.bad 2017-03-30 19:32:20.708131152 -0400 @@ -133,7 +133,10 @@ Testing: -drive if=virtio QEMU X.Y.Z monitor - type 'help' for more information -(qemu) QEMU_PROG: -drive if=virtio: Device needs media, but drive is empty +(qemu) QEMU_PROG: /home/bos/jhuston/src/qemu/memory.c:2078: memory_region_del_subregion: Assertion `subregion->container == mr' failed. +./common.config: line 109: 27667 Aborted (core dumped) ( if [ -n "${QEMU_NEED_PID}" ]; then + echo $BASHPID > "${QEMU_TEST_DIR}/qemu-${_QEMU_HANDLE}.pid"; +fi; exec "$QEMU_PROG" $QEMU_OPTIONS "$@" ) Testing: -drive if=none,id=disk -device ide-cd,drive=disk QEMU X.Y.Z monitor - type 'help' for more information Failures: 051 Failed 1 of 1 tests