serial-pci: remove memory regions from BAR before destroying them
PATCH 1/1 serial-pci: remove memory regions from BAR before destroying them
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)
--- hw/char/serial-pci.c | 1 + 1 file changed, 1 insertion(+)
hw/char/serial-pci.c +1 -0
@@ -148,6 +148,7 @@ static void multi_serial_pci_exit(PCIDevice *dev)for (i =0 ; i < pci->ports; i++) { s = pci->state + i;serial_exit_core (s); +memory_region_del_subregion (&pci->iobar, &s->io);memory_region_destroy (&s->io);g_free (pci->name[i]); }
Signature · 1 line
1.9.3
Quoted 9 lines · Paolo Bonzini
Otherwise, hot-unplug of pci-serial-2x trips the assertion in
memory_region_destroy:(qemu)
device_delgg
(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 <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>
Would it make sense to add a "must not contain subregions" to memory_region_destroy()'s function comment?
Il 26/06/2014 09:32, Markus Armbruster ha scritto:
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Reported-by Markus Armbruster <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>Reviewed-by Markus Armbruster <[email protected]>Would it make sense to add a "must not contain subregions" to memory_region_destroy()'s function comment?
I don't know, in the end the assertion is pretty self-explanatory. If we add hotplug support to libqos, we can test it.
Paolo
Peter Crosthwaite
Reviewed-byQuoted 5 lines · Markus Armbruster
Quoted 3 lines · Paolo Bonzini
Otherwise, hot-unplug of pci-serial-2x trips the assertion in
memory_region_destroy:
Quoted 9 lines
Quoted 6 lines
(qemu)
device_delgg
(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 <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>Reviewed-by Markus Armbruster <[email protected]>
Quoted 3 lines
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 all contained subregions automatically rather than assert? Destroying a container should imply removing the subregion relationship and simply orphan the subregion.
Regards,
Peter
Il 14/07/2014 14:36, Peter Crosthwaite ha scritto:
Quoted 16 lines · Markus Armbruster
Quoted 5 lines
Quoted 3 lines · Paolo Bonzini
Otherwise, hot-unplug of pci-serial-2x trips the assertion in
memory_region_destroy:Quoted 9 lines
Quoted 6 lines
(qemu)
device_delgg
(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 <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>Reviewed-by Markus Armbruster <[email protected]>
Quoted 7 lines
Reviewed-by Peter Crosthwaite <[email protected]>Quoted 3 lines
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.
Quoted 3 lines
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
Quoted 29 lines · Paolo Bonzini
Il 14/07/2014 14:36, Peter Crosthwaite ha scritto:
Quoted 27 lines
Quoted 12 lines · Markus Armbruster
Quoted 9 lines · Paolo Bonzini
Otherwise, hot-unplug of pci-serial-2x trips the assertion in
memory_region_destroy:(qemu)
device_delgg
(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)Quoted 6 lines
Quoted 2 lines
Reported-by Markus Armbruster <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>Reviewed-by Markus Armbruster <[email protected]>Reviewed-by Peter Crosthwaite <[email protected]>Quoted 3 lines
Would it make sense to add a "must not contain subregions" to memory_region_destroy()'s function comment?
Quoted 6 lines
Quoted 1 line
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 ismemory_region_destroy.
Yes, bad choice of words by me. What I was going for was "un-contain" I guess.
Regards,
Peter
Quoted 18 lines
The parent object of a memory region is a device; the _container_ of a memory region is another memory region.
Quoted 3 lines
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_destroyoptional (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 makememory_region_del_subregionalso optional.Paolo
Quoted 12 lines · Peter Crosthwaite
Quoted 11 lines · Markus Armbruster
Quoted 9 lines · Paolo Bonzini
Otherwise, hot-unplug of pci-serial-2x trips the assertion in
memory_region_destroy:(qemu)
device_delgg
(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)
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Reported-by Markus Armbruster <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>Reviewed-by Markus Armbruster <[email protected]>Reviewed-by Peter Crosthwaite <[email protected]>
Nominating for 2.1, just to be explicit.
[...]
Quoted 17 lines · Markus Armbruster
Quoted 15 lines · Peter Crosthwaite
Quoted 14 lines · Markus Armbruster
Quoted 11 lines · Paolo Bonzini
Otherwise, hot-unplug of pci-serial-2x trips the assertion in
memory_region_destroy:(qemu)
device_delgg
(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 <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Reviewed-by Markus Armbruster <[email protected]>Reviewed-by Peter Crosthwaite <[email protected]>Nominating for 2.1, just to be explicit.
[...]
Hmm, is trivial out of service? I remember thinking "Ok, trivial patch, qemu-trivial is cc'ed, that'll pick it up, nothing to do for me."
cheers,
Gerd
PS: Saw paolo sticked the patch into one of his pull requests meanwhile.
Il 15/07/2014 10:35, Gerd Hoffmann ha scritto:
Quoted 21 lines · Markus Armbruster
Quoted 20 lines
Quoted 18 lines · Peter Crosthwaite
Quoted 16 lines · Markus Armbruster
Quoted 11 lines · Paolo Bonzini
Otherwise, hot-unplug of pci-serial-2x trips the assertion in
memory_region_destroy:(qemu)
device_delgg
(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 <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>Reviewed-by Markus Armbruster <[email protected]>
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Reviewed-by Peter Crosthwaite <[email protected]>Nominating for 2.1, just to be explicit.
[...]
Hmm, is trivial out of service? I remember thinking "Ok, trivial patch, qemu-trivial is cc'ed, that'll pick it up, nothing to do for me."
I think it's more likely that Michael went on vacation, from a quick look at his posting history.
Paolo