From: David Hildenbrand <david@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: qemu-devel@nongnu.org, Collin Walling <walling@linux.ibm.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
Cornelia Huck <cohuck@redhat.com>, Greg Kurz <groug@kaod.org>,
Christian Borntraeger <borntraeger@de.ibm.com>,
qemu-s390x@nongnu.org, qemu-ppc@nongnu.org,
Thomas Huth <thuth@redhat.com>,
Richard Henderson <rth@twiddle.net>,
David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-devel] [PATCH RFC] qdev: Let the hotplug_unplug() caller delete the device
Date: Tue, 4 Dec 2018 16:23:43 +0100 [thread overview]
Message-ID: <fb895afc-ffc1-7cfb-0cf5-97097eaaba9c@redhat.com> (raw)
In-Reply-To: <20181204143345.10fea90e@redhat.com>
On 04.12.18 14:33, Igor Mammedov wrote:
> On Wed, 28 Nov 2018 15:54:55 +0100
> David Hildenbrand <david@redhat.com> wrote:
>
>> When unplugging a device, at one point the device will be destroyed
>> via object_unparent(). This will, one the one hand, unrealize the
>> device hierarchy to be removed, and on the other hand, destroy/free the
>> device hierarchy.
>>
>> When chaining interrupt handlers, we want to overwrite a bus hotplug
>> handler by the machine hotplug handler, to be able to perform
>> some part of the plug/unplug and to forward the calls to the bus hotplug
>> handler.
>>
>> For now, the bus hotplug handler would trigger an object_unparent(), not
>> allowing us to perform some unplug action on a device after we forwarded
>> the call to the bus hotplug handler. The device would be gone at that
>> point.
>>
>> hotplug_handler_unplug(dev) -> calls machine_unplug_handler()
>> machine_unplug_handler(dev) {
>> /* eventually do unplug stuff */
>> bus_unplug_handler(dev) -> calls object_unparent(dev)
>> /* dev is gone, we can't do more unplug stuff */
>> }
>>
>> So move the object_unparent() to the original caller of the unplug. For
>> now, keep the unrealize() at the original places of the
>> object_unparent().
>>
>> hotplug_handler_unplug(dev) -> calls machine_unplug_handler()
>> machine_unplug_handler(dev) {
>> /* eventually do unplug stuff */
>> bus_unplug_handler(dev) -> calls unrealize(dev)
>> /* we can do more unplug stuff but device already unrealized */
>> }
>> object_unparent(dev)
>>
>> In the long run, every unplug action should be factored out of the
>> unrealize() function into the unplug handler (especially for PCI). Then
>> we can get rid of the additonal unrealize() calls and object_unparent()
>> will properly unrealize the device hierarchy after the device has been
>> unplugged.
>>
>> hotplug_handler_unplug(dev) -> calls machine_unplug_handler()
>> machine_unplug_handler(dev) {
>> /* eventually do unplug stuff */
>> bus_unplug_handler(dev) -> only unplugs, does not unrealize
>> /* we can do more unplug stuff */
>> }
>> object_unparent(dev) -> will unrealize
>>
>>
>> The original approach was suggested by Igor Mammedov for the PCI
>> part, but I extended it to all hotplug handlers. I consider this one
>> step into the right direction.
>>
>> Signed-off-by: David Hildenbrand <david@redhat.com>
> Sorry but I've lost track of all hotplug patches that where
> reviewed and pending form merge.
> Lets revisit this patch once those are merged to have a coherent
> view on how things stand.
At least from my side, there is only
[PATCH v3 00/11] pci: hotplug handler reworks
--
Thanks,
David / dhildenb
prev parent reply other threads:[~2018-12-04 15:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-28 14:54 [Qemu-devel] [PATCH RFC] qdev: Let the hotplug_unplug() caller delete the device David Hildenbrand
2018-12-03 16:01 ` Cornelia Huck
2018-12-04 13:19 ` David Hildenbrand
2018-12-04 13:33 ` Igor Mammedov
2018-12-04 15:23 ` David Hildenbrand [this message]
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=fb895afc-ffc1-7cfb-0cf5-97097eaaba9c@redhat.com \
--to=david@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=groug@kaod.org \
--cc=imammedo@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=rth@twiddle.net \
--cc=thuth@redhat.com \
--cc=walling@linux.ibm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).