From: Jens Freimann <jfreimann@redhat.com>
To: Damien Hedde <damien.hedde@greensocs.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
Eduardo Habkost <ehabkost@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
QEMU Developers <qemu-devel@nongnu.org>,
Stefan Hajnoczi <stefanha@redhat.com>,
Igor Mammedov <imammedo@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: qom device lifecycle interaction with hotplug/hotunplug ?
Date: Wed, 18 Dec 2019 16:14:43 +0100 [thread overview]
Message-ID: <20191218151443.gwh647paandzoboz@jenstp.localdomain> (raw)
In-Reply-To: <54dc79b4-d033-7990-2f8d-e3787a2803d8@greensocs.com>
On Wed, Dec 11, 2019 at 01:52:33PM +0100, Damien Hedde wrote:
>On 12/4/19 7:51 PM, Eduardo Habkost wrote:
>> On Wed, Dec 04, 2019 at 05:21:25PM +0100, Jens Freimann wrote:
>>> On Wed, Dec 04, 2019 at 11:35:37AM -0300, Eduardo Habkost wrote:
>>>> On Wed, Dec 04, 2019 at 10:18:24AM +0100, Jens Freimann wrote:
>>>>> On Tue, Dec 03, 2019 at 06:40:04PM -0300, Eduardo Habkost wrote:
>>>>>> +jfreimann, +mst
>And if migration fails this same device is plugged back using
>failover_replug_primary():
>> static bool failover_replug_primary(VirtIONet *n, Error **errp)
>> {
>> [...]
>> qdev_set_parent_bus(n->primary_dev, n->primary_bus);
>> [...]
>> hotplug_ctrl = qdev_get_hotplug_handler(n->primary_dev);
>> if (hotplug_ctrl) {
>> hotplug_handler_pre_plug(hotplug_ctrl, n->primary_dev, &err);
>> if (err) {
>> goto out;
>> }
>> hotplug_handler_plug(hotplug_ctrl, n->primary_dev, errp);
>> }
>> [...]
>> }
>
>My concern is about the qdev_set_parent_bus() call above (because I
>touch this function in my series) and don't want to have side effects there.
>
>I looked at the code and thought the partial unplug has the effect of
>cutting off the unplug procedure just before doing the qdev real unplug.
>In pcie_unplug_device() we return before doing the object_unparent():
>> static void pcie_unplug_device(PCIBus *bus, PCIDevice *dev, ...
>> {
>> [...]
>> if (dev->partially_hotplugged) {
>> dev->qdev.pending_deleted_event = false;
>> return;
>> }
>> hotplug_handler_unplug(hotplug_ctrl, DEVICE(dev), &error_abort);
>> object_unparent(OBJECT(dev));
>> }
>
>From my understanding, object_unparent() is the only way to really
>unplug a device from a bus regarding qdev (and it also unrealizes the
>device). So I have the feeling that qdev_set_parent_bus() here is a
>no-op (because primary_dev is already on primary_bus).
I tested this now and it really is a no-op. It was required in a
earlier version of the patches and I missed to remove it when I
reworked the re-plug functionality.
I will send a patch to remove it.
regards
Jens
next prev parent reply other threads:[~2019-12-18 15:16 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-28 16:00 qom device lifecycle interaction with hotplug/hotunplug ? Peter Maydell
2019-11-28 16:33 ` Eduardo Habkost
2019-11-29 12:40 ` Igor Mammedov
2019-11-29 19:53 ` Eduardo Habkost
2019-11-28 17:27 ` Igor Mammedov
2019-11-28 17:57 ` Peter Maydell
2019-11-29 12:26 ` Igor Mammedov
2019-11-29 12:45 ` Peter Maydell
2019-11-29 13:05 ` Damien Hedde
2019-11-29 14:23 ` Igor Mammedov
2019-11-29 20:05 ` Eduardo Habkost
2019-11-30 11:10 ` Peter Maydell
2019-12-03 21:40 ` Eduardo Habkost
2019-12-04 9:18 ` Jens Freimann
2019-12-04 14:35 ` Eduardo Habkost
2019-12-04 16:21 ` Jens Freimann
2019-12-04 18:51 ` Eduardo Habkost
2019-12-11 12:52 ` Damien Hedde
2019-12-18 15:14 ` Jens Freimann [this message]
2019-12-11 16:01 ` Igor Mammedov
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=20191218151443.gwh647paandzoboz@jenstp.localdomain \
--to=jfreimann@redhat.com \
--cc=damien.hedde@greensocs.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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).