From: Paolo Bonzini <pbonzini@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 23/30] bus: do not unref hotplug handler
Date: Wed, 22 Feb 2017 12:33:25 +0100 [thread overview]
Message-ID: <967ff11e-ed7c-85b9-2c67-b3fb5335769e@redhat.com> (raw)
In-Reply-To: <20170221141451.28305-24-marcandre.lureau@redhat.com>
On 21/02/2017 15:14, Marc-André Lureau wrote:
> Apparently, none of the bus owner give a reference to the hotplug
> handler property, do not unref it on bus release.
>
> Furthermore, a bus is allowed to be its own hotplug handler, which can
> be seen in qbus_set_bus_hotplug_handler() function. However, in this
> case, the reference can't be given to the property, or this will create
> a cyclic dependency and the bus will never be free.
>
> Each bus owner should manage the lifecycle of the hotplug handler.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Almost all qbus_set_hotplug_handler callers are using it to set the
parent device (that is, the "adapter" or "bridge", whatever you want to
call it) as the hotplug handler.
The exception is piix4_update_bus_hotplug. This one is the only case
where OBJ_PROP_LINK_UNREF_ON_RELEASE would be right. Luckily, there
_is_ a reference to that device somewhere else to keep it alive, namely
in /machine's acpi-device prop. So this case is a bit hacky (not your
fault) but works as well. In addition the PIIX4_PM device is not
hot(un)pluggable.
Can you please add a comment to piix4_update_bus_hotplug explaining that
the PIIX4PMState cannot outlive the PCIBus, because /machine keeps it alive?
>
> diff --git a/hw/core/bus.c b/hw/core/bus.c
> index cf383fc1af..4651f24486 100644
> --- a/hw/core/bus.c
> +++ b/hw/core/bus.c
> @@ -197,7 +197,7 @@ static void qbus_initfn(Object *obj)
> TYPE_HOTPLUG_HANDLER,
> (Object **)&bus->hotplug_handler,
> object_property_allow_set_link,
> - OBJ_PROP_LINK_UNREF_ON_RELEASE,
> + 0,
> NULL);
> object_property_add_bool(obj, "realized",
> bus_get_realized, bus_set_realized, NULL);
> --
> 2.11.0.295.gd7dffce1c.dirty
>
>
>
next prev parent reply other threads:[~2017-02-22 11:33 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-21 14:14 [Qemu-devel] [PATCH v2 00/30] Various memory leak fixes Marc-André Lureau
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 01/30] qtest: fix a memory leak Marc-André Lureau
2017-02-21 16:40 ` Philippe Mathieu-Daudé
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 02/30] tests: fix qmp response leak Marc-André Lureau
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 03/30] tests: fix leaks in test-io-channel-command Marc-André Lureau
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 04/30] timer: use an inline function for free Marc-André Lureau
2017-02-22 11:33 ` Paolo Bonzini
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 05/30] glib-compat: add g_test_add_data_func_full fallback Marc-André Lureau
2017-02-21 19:15 ` Eric Blake
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 06/30] tests: fix ptimer leaks Marc-André Lureau
2017-02-22 11:33 ` Paolo Bonzini
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 07/30] tests: fix endianness-test leaks Marc-André Lureau
2017-02-21 16:40 ` Philippe Mathieu-Daudé
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 08/30] tests: fix q35-test leaks Marc-André Lureau
2017-02-28 23:05 ` Eric Blake
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 09/30] tests: fix vhost-user-test leaks Marc-André Lureau
2017-02-28 23:09 ` Eric Blake
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 10/30] tests: fix ide-test leaks Marc-André Lureau
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 11/30] tests: fix hd-geo-test leaks Marc-André Lureau
2017-02-27 13:59 ` Markus Armbruster
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 12/30] tests: fix bios-tables-test leak Marc-André Lureau
2017-02-27 14:03 ` Markus Armbruster
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 13/30] tests: fix ipmi-kcs-test leak Marc-André Lureau
2017-02-21 16:41 ` Philippe Mathieu-Daudé
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 14/30] tests: fix ipmi-bt-test leak Marc-André Lureau
2017-02-21 16:42 ` Philippe Mathieu-Daudé
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 15/30] pc: pcihp: avoid adding ACPI_PCIHP_PROP_BSEL twice Marc-André Lureau
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 16/30] tests: fix eepro100-test leak Marc-André Lureau
2017-02-21 14:42 ` Stefan Weil
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 17/30] tests: fix tco-test leaks Marc-André Lureau
2017-02-28 23:10 ` Eric Blake
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 18/30] tests: fix e1000-test leak Marc-André Lureau
2017-02-21 16:42 ` Philippe Mathieu-Daudé
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 19/30] tests: fix i440fx-test leaks Marc-André Lureau
2017-02-27 14:05 ` Markus Armbruster
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 20/30] tests: fix e1000e leaks Marc-André Lureau
2017-02-27 14:12 ` Markus Armbruster
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 21/30] tests: fix virtio-scsi-test leak Marc-André Lureau
2017-02-22 11:33 ` Paolo Bonzini
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 22/30] tests: fix virtio-9p-test leaks Marc-André Lureau
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 23/30] bus: do not unref hotplug handler Marc-André Lureau
2017-02-22 11:33 ` Paolo Bonzini [this message]
2017-02-22 13:03 ` Marc-André Lureau
2017-02-22 13:04 ` Paolo Bonzini
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 24/30] usb: replace handle_destroy with unrealize Marc-André Lureau
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 25/30] usb: release the created buses Marc-André Lureau
2017-02-21 22:59 ` Gerd Hoffmann
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 26/30] tests: allows to run single test in usb-hcd-ehci-test Marc-André Lureau
2017-02-21 16:45 ` Philippe Mathieu-Daudé
2017-02-21 23:01 ` Gerd Hoffmann
2017-02-22 8:36 ` Marc-André Lureau
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 27/30] tests: fix usb-test leaks Marc-André Lureau
2017-02-21 22:59 ` Gerd Hoffmann
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 28/30] tests: add specialized device_find function Marc-André Lureau
2017-02-28 23:21 ` Eric Blake
2017-03-01 7:59 ` Marc-André Lureau
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 29/30] tests: fix virtio-blk-test leaks Marc-André Lureau
2017-02-28 23:22 ` Eric Blake
2017-02-21 14:14 ` [Qemu-devel] [PATCH v2 30/30] migration: fix id leak regression Marc-André Lureau
2017-02-21 14:19 ` Dr. David Alan Gilbert
2017-02-21 17:04 ` Philippe Mathieu-Daudé
2017-02-22 8:41 ` Marc-André Lureau
2017-02-28 9:50 ` Dr. David Alan Gilbert
2017-02-27 11:04 ` [Qemu-devel] [PATCH v2 00/30] Various memory leak fixes Marc-André Lureau
2017-02-28 23:23 ` Eric Blake
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=967ff11e-ed7c-85b9-2c67-b3fb5335769e@redhat.com \
--to=pbonzini@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@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 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).