From: Anthony Liguori <anthony@codemonkey.ws>
To: Kevin Wolf <kwolf@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
Jan Kiszka <jan.kiszka@siemens.com>,
qemu-devel@nongnu.org, Luiz Capitulino <lcapitulino@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 00/20] qom: dynamic properties and composition tree
Date: Fri, 16 Dec 2011 08:54:43 -0600 [thread overview]
Message-ID: <4EEB5BB3.4030105@codemonkey.ws> (raw)
In-Reply-To: <4EEB5337.1060800@redhat.com>
On 12/16/2011 08:18 AM, Kevin Wolf wrote:
> Am 16.12.2011 14:51, schrieb Anthony Liguori:
>> On 12/16/2011 06:24 AM, Paolo Bonzini wrote:
>>> On 12/16/2011 11:36 AM, Kevin Wolf wrote:
>>>>> I think actually this is not the biggest problem. child properties are
>>>>> dynamic, and it's not a problem IMO if they are created like that.
>>>>
>>>> That they are added in an init function is an indicator that they aren't
>>>> really dynamic.
>>>
>>> That's true. However, another indicator is that anything that does not have a
>>> struct field is also not really static. :)
>>>
>>> So right now, child properties are all "dynamic" in this sense. This could
>>> change when Anthony converts buses to QOM. The bus right now is embedded into
>>> the HBA's struct, is not a pointer. This likely would change when buses are
>>> QOM-ized, but then the bus would indeed be a 100% static child.
>>>
>>>> I think having a child property that can be NULL could be
>>>> reasonable.
>>>
>>> I think Anthony convinced me this is not the case (unlike links). Even if buses
>>> and similar objects are changed to pointers because the implementation needs
>>> that, those pointers should never be NULL (or if they can, the child property
>>> should not exist when they are NULL).
>>
>> What I would like to get to eventually is:
>>
>> struct ISASerial {
>> Device parent;
>>
>> UART _child uart;
>> ISABus _link *bus;
>> };
>>
>> A child should be able to be part of the parent devices memory with its life
>> cycle bound to the parents life cycle. This is why a child property shouldn't
>> be nullable.
>
> I don't think being bound to the life cycle (that is, from realize on)
> implies anything about being nullable.
>
> For example, imagine two different types of UARTs with a compatible
> interface, and you could choose whether to have one or the other on the
> board. Maybe you could even use none at all (probably doesn't make a lot
> of sense in this example, but I figure it might in other contexts).
What you're describing is what a link<> is. Whenever you want the ability to
make a choice (including the choice of None), a link<> is the type of property
to use.
But too much choice can be a bad thing. In many cases, you just want to have a
child device for the purposes code sharing. An ISA serial device embedding a
UART is a good example of this.
Yes, you could make a UARTInterface and have the ISA serial device expose a
link<UARTInterface> but that's roughly equivalent to having every chip on your
motherboard be connected with a DIP package instead of being soldered on the
board. You could do it, but it would be very expensive and cumbersome.
> So even though once the device is realized, the UART is bound to the
> life cycle of your ISASerial, you wouldn't want to have the UART type
> hard-coded, but leave the user a choice. Would this be modelled as a
> link rather than a child?
Yes. I'm not terribly sure how this would work yet. A link and a child
property both acquire references to a device and release a reference to a device
at destruction time.
For a child property, the reference held by the parent is the only reference in
existing. For non-child properties, the 'peripheral' container also holds a
reference (since you want to be able to assign the device somewhere else in the
device model).
I'm not sure tying life cycles for a user created device makes sense. If a user
creates a device, IMO, the user should be the one to destroy the device.
Regards,
Anthony Liguori
>
> Kevin
>
next prev parent reply other threads:[~2011-12-16 14:55 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-12 20:29 [Qemu-devel] [PATCH v3 00/20] qom: dynamic properties and composition tree Anthony Liguori
2011-12-12 20:29 ` [Qemu-devel] [PATCH v3 01/20] qom: add a reference count to qdev objects Anthony Liguori
2011-12-12 20:29 ` [Qemu-devel] [PATCH v3 02/20] qom: add new dynamic property infrastructure based on Visitors (v2) Anthony Liguori
2011-12-12 20:29 ` [Qemu-devel] [PATCH v3 03/20] qom: register legacy properties as new style properties (v2) Anthony Liguori
2011-12-12 20:29 ` [Qemu-devel] [PATCH v3 04/20] qom: introduce root device Anthony Liguori
2011-12-12 20:29 ` [Qemu-devel] [PATCH v3 05/20] qdev: provide an interface to return canonical path from root (v2) Anthony Liguori
2011-12-12 20:29 ` [Qemu-devel] [PATCH v3 06/20] qdev: provide a path resolution (v2) Anthony Liguori
2011-12-12 20:29 ` [Qemu-devel] [PATCH v3 07/20] qom: add child properties (composition) (v3) Anthony Liguori
2011-12-12 20:29 ` [Qemu-devel] [PATCH v3 08/20] qom: add link properties (v2) Anthony Liguori
2011-12-12 20:29 ` [Qemu-devel] [PATCH v3 09/20] qapi: allow a 'gen' key to suppress code generation Anthony Liguori
2011-12-12 20:29 ` [Qemu-devel] [PATCH v3 10/20] qmp: add qom-list command Anthony Liguori
2011-12-12 20:29 ` [Qemu-devel] [PATCH v3 11/20] qom: qom_{get, set} monitor commands (v2) Anthony Liguori
2011-12-12 20:29 ` [Qemu-devel] [PATCH v3 12/20] qdev: add explicitly named devices to the root complex Anthony Liguori
2011-12-12 20:29 ` [Qemu-devel] [PATCH v3 13/20] dev: add an anonymous peripheral container Anthony Liguori
2011-12-12 20:29 ` [Qemu-devel] [PATCH v3 14/20] rtc: make piix3 set the rtc as a child (v2) Anthony Liguori
2011-12-12 20:29 ` [Qemu-devel] [PATCH v3 15/20] rtc: add a dynamic property for retrieving the date Anthony Liguori
2011-12-12 20:29 ` [Qemu-devel] [PATCH v3 16/20] qom: optimize qdev_get_canonical_path using a parent link Anthony Liguori
2011-12-12 20:29 ` [Qemu-devel] [PATCH v3 17/20] qom: add vga node to the pc composition tree Anthony Liguori
2011-12-12 20:29 ` [Qemu-devel] [PATCH v3 18/20] qom: add string property type Anthony Liguori
2011-12-12 20:29 ` [Qemu-devel] [PATCH v3 19/20] qdev: add a qdev_get_type() function and expose as a 'type' property Anthony Liguori
2011-12-15 18:10 ` [Qemu-devel] [PATCH v3 00/20] qom: dynamic properties and composition tree Anthony Liguori
2011-12-16 9:42 ` Kevin Wolf
2011-12-16 10:17 ` Paolo Bonzini
2011-12-16 10:36 ` Kevin Wolf
2011-12-16 12:24 ` Paolo Bonzini
2011-12-16 12:55 ` Kevin Wolf
2011-12-16 13:28 ` Paolo Bonzini
2011-12-16 13:52 ` Anthony Liguori
2011-12-16 13:51 ` Anthony Liguori
2011-12-16 13:52 ` Paolo Bonzini
2011-12-16 14:11 ` Anthony Liguori
2011-12-16 14:18 ` Kevin Wolf
2011-12-16 14:54 ` Anthony Liguori [this message]
2011-12-16 14:56 ` Paolo Bonzini
2011-12-16 15:10 ` Kevin Wolf
2011-12-16 13:49 ` Anthony Liguori
2011-12-16 13:48 ` Anthony Liguori
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=4EEB5BB3.4030105@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=armbru@redhat.com \
--cc=jan.kiszka@siemens.com \
--cc=kwolf@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.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 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.