qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Markus Armbruster <armbru@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 00/14] qdev: assign unique names to all devices (part 1)
Date: Fri, 16 Sep 2011 13:06:31 -0500	[thread overview]
Message-ID: <4E739027.4030605@codemonkey.ws> (raw)
In-Reply-To: <4E73816F.3030207@siemens.com>

On 09/16/2011 12:03 PM, Jan Kiszka wrote:
> On 2011-09-16 18:54, Anthony Liguori wrote:
>> On 09/16/2011 11:48 AM, Jan Kiszka wrote:
>>> On 2011-09-16 18:00, Anthony Liguori wrote:
>>>> This series introduces an infrastructure to remove anonymous devices from qdev.
>>>> Anonymous devices are one of the big gaps between qdev and QOM so removing is
>>>> a prerequisite to incrementally merging QOM.
>>>>
>>>> Besides the infrastructure, I also converted almost all of the possible PC
>>>> devices to have unique names.  Please not that naming is not a property of
>>>> devices but rather of the thing that creates the devices (usually machines).
>>>>
>>>> The names are ugly but this is because of the alternating device/bus hierarchy
>>>> in qdev.  For now, the names use '::' as deliminators but I think Jan has
>>>> convinced me that down the road, we should use '/' as a deliminator such that
>>>> the resulting names are actually valid paths (using a canonical path format).
>>>
>>> I still don't see why we need to store strings as device references.
>>> Everyone that lacks a reference (QEMU-external users) can pass in a path
>>> - which can be a device name in the simple case. That path is resolved
>>> to an object reference before proceeding with the requested service. If
>>> an object should be serialized in whatever way and we need a stable
>>> name, a central service could return this by walking up the composition
>>> tree until a user-assigned name is found.
>>>
>>> So there is really no need to bother device model developers with the
>>> topics "How do I define a unique name?"
>>
>> This series just asks the device model developer to come up with a unique *when*
>> they're doing device composition.  Even with a totally path based interface,
>> this is always going to be a firm requirement.
>
> It will happen automatically - by defining a link to the child in the
> parent device. Requesting unique names is redundant.

How do you link in qdev today?  The only place we have to hook is qdev_create().

In QOM, you do this:

struct PIIX3 {
   RTC rtc;
};

static void piix3_initfn(...)
{
    plug_add_child(PLUG(s), "rtc", &s->rtc);
}

This will initialize s->rtc (setting its name to be the composition path) and 
create the property in the PIIX3.

You might disagree as to whether the name should be stored, but hopefully you at 
least agree that this is the right programming model.

Regards,

Anthony Liguori

>
>>
>> I think it may be possible to eliminate required device names by having a formal
>> notion of composition and have the devices store the names of the composed
>> devices as part of the reference to that device.  You could then have user
>> created devices use a separate hash table to track the names of those devices.
>>
>> But, we can't easily do this today.  Having either a fully qualified name or a
>> composition name as part of qdev_create() is the Right Thing IMHO so I think
>> this is the stepping stone to something more sophisticated.
>
> A name for an internal reference is the wrong tool IMHO.
>
> Jan
>

  reply	other threads:[~2011-09-16 18:06 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-16 16:00 [Qemu-devel] [PATCH 00/14] qdev: assign unique names to all devices (part 1) Anthony Liguori
2011-09-16 16:00 ` [Qemu-devel] [PATCH 01/14] apic: rename apic.id -> apic.index Anthony Liguori
2011-09-16 16:00 ` [Qemu-devel] [PATCH 02/14] qdev: enforce that no devices overload the id property Anthony Liguori
2011-09-16 16:00 ` [Qemu-devel] [PATCH 03/14] qdev: push id into qdev_create calls Anthony Liguori
2011-09-16 16:00 ` [Qemu-devel] [PATCH 04/14] qdev: take ownership of id pointer Anthony Liguori
2011-09-19  7:34   ` Gerd Hoffmann
2011-09-19 16:27     ` Anthony Liguori
2011-09-20  6:36       ` Gerd Hoffmann
2011-09-20 13:04         ` Anthony Liguori
2011-09-20 13:21           ` Gerd Hoffmann
2011-09-20 13:55             ` Anthony Liguori
2011-09-20 14:11               ` Gerd Hoffmann
2011-09-16 16:00 ` [Qemu-devel] [PATCH 05/14] qdev: remove opts pointer tracking Anthony Liguori
2011-09-19  7:35   ` Gerd Hoffmann
2011-09-16 16:00 ` [Qemu-devel] [PATCH 06/14] qdev: add ability to do QOM-style derived naming Anthony Liguori
2011-09-17 18:39   ` Blue Swirl
2011-09-16 16:00 ` [Qemu-devel] [PATCH 07/14] sysbus: add an id argument to sysbus_create_simple() Anthony Liguori
2011-09-16 16:00 ` [Qemu-devel] [PATCH 08/14] sysbus: make create_varargs take an id Anthony Liguori
2011-09-16 16:00 ` [Qemu-devel] [PATCH 09/14] fw_cfg: add name to global fw_cfg device Anthony Liguori
2011-09-16 16:00 ` [Qemu-devel] [PATCH 10/14] isa: add name parameter to device creation Anthony Liguori
2011-09-16 16:00 ` [Qemu-devel] [PATCH 11/14] pci: obtain devfn before initializing the device Anthony Liguori
2011-09-16 16:00 ` [Qemu-devel] [PATCH 12/14] pci: give pci devices a default name Anthony Liguori
2011-09-16 16:00 ` [Qemu-devel] [PATCH 13/14] ide: give IDE drives a default name in qdev Anthony Liguori
2011-09-16 16:00 ` [Qemu-devel] [PATCH 14/14] pc: assign names to machine created devices Anthony Liguori
2011-09-16 16:22 ` [Qemu-devel] [PATCH 00/14] qdev: assign unique names to all devices (part 1) Anthony Liguori
2011-09-16 16:48 ` Jan Kiszka
2011-09-16 16:54   ` Anthony Liguori
2011-09-16 17:03     ` Jan Kiszka
2011-09-16 18:06       ` Anthony Liguori [this message]
2011-09-16 17:11     ` Kevin Wolf
2011-09-16 18:03       ` Anthony Liguori
2011-09-19  7:26         ` Jan Kiszka
2011-09-19 14:05           ` Anthony Liguori
2011-09-19 14:24             ` Kevin Wolf
2011-09-20  8:32               ` Jan Kiszka
2011-09-19  7:41         ` Kevin Wolf
2011-09-16 18:21   ` Anthony Liguori
2011-09-19  7:34     ` Jan Kiszka
2011-09-17 18:41 ` Blue Swirl

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=4E739027.4030605@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=armbru@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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).