From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Crosthwaite <peter.crosthwaite@xilinx.com>,
Markus Armbruster <armbru@redhat.com>
Cc: qemu-trivial <qemu-trivial@nongnu.org>,
"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH] serial-pci: remove memory regions from BAR before destroying them
Date: Mon, 14 Jul 2014 16:20:14 +0200 [thread overview]
Message-ID: <53C3E71E.6080909@redhat.com> (raw)
In-Reply-To: <CAEgOgz77aLSt_vww3LwhT5-kUaJhDnmgdDVVdBfQXQvm-DzSUg@mail.gmail.com>
Il 14/07/2014 14:36, Peter Crosthwaite ha scritto:
> On Thu, Jun 26, 2014 at 5:32 PM, Markus Armbruster <armbru@redhat.com> wrote:
>> Paolo Bonzini <pbonzini@redhat.com> 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 <armbru@redhat.com>
>>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>>
>> Reviewed-by: Markus Armbruster <armbru@redhat.com>
>>
>
> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>
>> 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
WARNING: multiple messages have this Message-ID (diff)
From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Crosthwaite <peter.crosthwaite@xilinx.com>,
Markus Armbruster <armbru@redhat.com>
Cc: qemu-trivial <qemu-trivial@nongnu.org>,
"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] serial-pci: remove memory regions from BAR before destroying them
Date: Mon, 14 Jul 2014 16:20:14 +0200 [thread overview]
Message-ID: <53C3E71E.6080909@redhat.com> (raw)
In-Reply-To: <CAEgOgz77aLSt_vww3LwhT5-kUaJhDnmgdDVVdBfQXQvm-DzSUg@mail.gmail.com>
Il 14/07/2014 14:36, Peter Crosthwaite ha scritto:
> On Thu, Jun 26, 2014 at 5:32 PM, Markus Armbruster <armbru@redhat.com> wrote:
>> Paolo Bonzini <pbonzini@redhat.com> 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 <armbru@redhat.com>
>>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>>
>> Reviewed-by: Markus Armbruster <armbru@redhat.com>
>>
>
> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>
>> 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
next prev parent reply other threads:[~2014-07-14 14:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-25 18:21 [Qemu-trivial] [PATCH] serial-pci: remove memory regions from BAR before destroying them Paolo Bonzini
2014-06-25 18:21 ` [Qemu-devel] " Paolo Bonzini
2014-06-26 7:32 ` [Qemu-trivial] " Markus Armbruster
2014-06-26 7:32 ` Markus Armbruster
2014-06-26 10:08 ` [Qemu-trivial] " Paolo Bonzini
2014-06-26 10:08 ` Paolo Bonzini
2014-07-14 12:36 ` [Qemu-trivial] " Peter Crosthwaite
2014-07-14 12:36 ` Peter Crosthwaite
2014-07-14 14:20 ` Paolo Bonzini [this message]
2014-07-14 14:20 ` Paolo Bonzini
2014-07-14 14:28 ` [Qemu-trivial] " Peter Crosthwaite
2014-07-14 14:28 ` Peter Crosthwaite
2014-07-14 15:25 ` [Qemu-trivial] " Markus Armbruster
2014-07-14 15:25 ` Markus Armbruster
2014-07-15 8:35 ` [Qemu-trivial] " Gerd Hoffmann
2014-07-15 8:35 ` Gerd Hoffmann
2014-07-15 8:39 ` [Qemu-trivial] " Paolo Bonzini
2014-07-15 8:39 ` [Qemu-devel] " Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53C3E71E.6080909@redhat.com \
--to=pbonzini@redhat.com \
--cc=armbru@redhat.com \
--cc=kraxel@redhat.com \
--cc=peter.crosthwaite@xilinx.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.