qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Liu Ping Fan <pingfank@linux.vnet.ibm.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 3/9] qbus: remove glib_allocated/qom_allocated and use release hook to free memory
Date: Mon, 27 Aug 2012 16:43:15 +0200	[thread overview]
Message-ID: <503B8783.1040809@suse.de> (raw)
In-Reply-To: <873938l8iy.fsf@codemonkey.ws>

Am 27.08.2012 16:22, schrieb Anthony Liguori:
> Andreas Färber <afaerber@suse.de> writes:
> 
>> I wonder how this is gonna work: The device used to be in charge of
>> tearing down its bus children ... now it neither deletes nor finalizes
>> nor unrefs? Is the while loop even still needed?
>>
>> Wouldn't the busses still have the device as parent, referencing it,
>> blocking device_finalize?
> 
> This has never been right..  Just because a controller goes away, it
> doesn't mean that the devices ought to go away too.
> 
> There are different types of "remove" so let's consider each.
> 
> 1) Guest visible eject: if a controller is ejected, then the guest will
>    obviously see everything behind it get removed too.  This is an
>    emulation detail, not a QOM thing.
> 
> 2) Final deletion: this only happens when all references go away.  If
>    you eject a controller but there are still children that reference
>    it, the controller won't go away.  You actually need to delete each
>    individual disk (or whatever is behind it) in order to break the
>    reference counting.
> 
> The eject notifier could walk the full bus and attempt to break the
> connections but honestly, I'd much prefer that we deprecate the current
> device_del interface and just do everything through QOM properties.
> That would mean manually deleting all of the devices behind the bus if
> that's really what you wanted to do.

I think we're talking about different scenarios here...

I was thinking

PCIHostState has-a PCIBus

(not PCIBus has-a PCIDevice) and final deletion.

In that case I would expect that it must be guaranteed that the device
that created the bus has access to the bus until it destroys it. But
IIUC the PCIHostState, once unparented from its SysBus (bad example!),
has a refcount of 1 (its PCIBus) thereby not being finalized?

I do understand your concept of refcounting matches what Java, .NET,
etc. do for objects but combined with the new QBus I feel this is
blurring the encapsulations and expected semantics of the device-centric
functions we have. To me the uninitfn means "the whole object goes away"
and is incompatible with "part of its children may stay behind if there
are still stray references to them"... we can no longer properly access
them then, only devices have canonical paths, so we'd risk piling up
garbage at runtime.

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  reply	other threads:[~2012-08-27 14:44 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-26 15:51 [Qemu-devel] [RFC PATCH 0/9] qom: improve reference counting and hotplug Anthony Liguori
2012-08-26 15:51 ` [Qemu-devel] [PATCH 1/9] savevm: don't rely on paths if we can store a DeviceState object Anthony Liguori
2012-08-26 15:51 ` [Qemu-devel] [PATCH 2/9] object: automatically free objects based on a release function Anthony Liguori
2012-08-27 13:31   ` Andreas Färber
2012-08-26 15:51 ` [Qemu-devel] [PATCH 3/9] qbus: remove glib_allocated/qom_allocated and use release hook to free memory Anthony Liguori
2012-08-27 14:02   ` Andreas Färber
2012-08-27 14:22     ` Anthony Liguori
2012-08-27 14:43       ` Andreas Färber [this message]
2012-08-26 15:51 ` [Qemu-devel] [PATCH 4/9] object: remove object_finalize Anthony Liguori
2012-08-27 15:01   ` Andreas Färber
2012-08-27 15:49     ` Anthony Liguori
2012-08-26 15:51 ` [Qemu-devel] [PATCH 5/9] object: add support for nullable child properties Anthony Liguori
2012-08-26 15:51 ` [Qemu-devel] [PATCH 6/9] qdev: make devices created with device_add nullable so they can be deleted Anthony Liguori
2012-08-26 15:51 ` [Qemu-devel] [PATCH 7/9] qdev: add notifier for when the device loses its parent bus (eject) Anthony Liguori
2012-08-26 15:51 ` [Qemu-devel] [PATCH 8/9] qdev: make qdev_set_parent_bus() just set a link property Anthony Liguori
2012-08-27  7:22   ` liu ping fan
2012-08-27 13:12     ` Anthony Liguori
2012-08-26 15:51 ` [Qemu-devel] [PATCH 9/9] hotplug: refactor hotplug to leverage new QOM functions Anthony Liguori
2012-08-27  7:22   ` liu ping fan
2012-08-27  7:22 ` [Qemu-devel] [RFC PATCH 0/9] qom: improve reference counting and hotplug liu ping fan
2012-08-27 11:46   ` Andreas Färber
2012-08-27 12:09     ` Paolo Bonzini
2012-08-27 13:15       ` Anthony Liguori
2012-10-09 17:15 ` Vasilis Liaskovitis

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=503B8783.1040809@suse.de \
    --to=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=pingfank@linux.vnet.ibm.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).