All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Markus Armbruster <armbru@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Cc: weidong.huang@huawei.com, stefanha@redhat.com,
	qemu-devel@nongnu.org, agraf@suse.de, arei.gonglei@huawei.com,
	aliguori@amazon.com, peter.huangpeng@huawei.com,
	lcapitulino@redhat.com
Subject: Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties
Date: Tue, 16 Sep 2014 10:36:40 +0200	[thread overview]
Message-ID: <5417F698.2060001@redhat.com> (raw)
In-Reply-To: <87wq94xc7v.fsf@blackfin.pond.sub.org>

Il 16/09/2014 09:21, Markus Armbruster ha scritto:
> The rebase onto QOM renamed name to legacy_name, to free name for use as
> QOM type name (commit cafe5bd).

Also, the QOM type name has strict rules:

- either it is a QAPI type (primitive, enum or struct)

- or it is link<qom-type-name>

- or it is child<qom-type-name>

The qdev type names had no rules.  We had uint8, hex8, on/off, drive, etc.

> Human users do, however.  I'd object to a degradation of -device
> FOO,help.  Changing it is fine, but it should remain at least as helpful
> as it is now.

The question is if it is really a degradation.

Example 1:

virtio-blk-pci.physical_block_size=blocksize
virtio-blk-pci.logical_block_size=blocksize

vs.

virtio-blk-pci.physical_block_size=uint16
virtio-blk-pci.logical_block_size=uint16

What is a "blocksize"?  It is a power of two between 512 and 32768, but 
how does the user know?  If the value is too small or invalid, the 
error message is particularly helpful for QEMU standards:

    qemu-system-x86_64: -device virtio-blk-pci,physical_block_size=128,drive=hd:
    Property .physical_block_size doesn't take value 128 (minimum: 512, maximum: 
    32768)

    qemu-system-x86_64: -device virtio-blk-pci,physical_block_size=1023,drive=hd:
    Property .physical_block_size doesn't take value '1023', it's not a power of 2

I think uint16 is actually more informative than "blocksize".



Example 2:

    virtio-blk-pci.drive=drive

vs.

    virtio-blk-pci.drive=str

The fact that it points to a -drive is already guessable (for anyone who
knows the relationship between -drive and -device) from the name of the
property.

    $ qemu-system-x86_64 -drive if=none,file=$HOME/test2.img,id=hd -device virtio-blk-pci
    qemu-system-x86_64: -device virtio-blk-pci: drive property not set
    qemu-system-x86_64: -device virtio-blk-pci: Device initialization failed.
    qemu-system-x86_64: -device virtio-blk-pci: Device 'virtio-blk-pci' could not be 
    initialized

    $ qemu-system-x86_64 -drive if=none,file=$HOME/test2.img,id=hd
    -device virtio-blk-pci,drive=ff
    qemu-system-x86_64: -device virtio-blk-pci,drive=ff: Property
    'virtio-blk-device.drive' can't find value 'ff'

If we QOMified BlockBackend, BTW, it would show up as

    virtio-blk-pci.drive=link<block-backend>

I think both "str" and "link<block-backend>" actually are a small degradation
compared to "drive", and this is why I kept the legacy_name.  But overall I
think it's not really worth the layering violation that patches 2 and 3 are;
and it's definitely not stable material.

I'd rather drop the legacy_name at all.  Here are the legacy_names currently
in use:

    hw/core/qdev-properties-system.c:    .legacy_name  = "drive",
    hw/core/qdev-properties-system.c:    .legacy_name  = "chr",
    hw/core/qdev-properties-system.c:    .legacy_name  = "netdev",
    hw/core/qdev-properties-system.c:    .legacy_name  = "vlan",
    hw/core/qdev-properties.c:    .legacy_name  = "on/off",
    hw/core/qdev-properties.c:    .legacy_name  = "macaddr",
    hw/core/qdev-properties.c:    .legacy_name = "bios-chs-trans",
    hw/core/qdev-properties.c:    .legacy_name  = "pci-devfn",
    hw/core/qdev-properties.c:    .legacy_name  = "blocksize",
    hw/core/qdev-properties.c:    .legacy_name = "pci-host-devaddr",

vlan is just a glorified int, not an id like the others.  chr should be
named chardev.  blocksize, I already covered above.  bios-chs-trans is
an enum (QAPI name BiosAtaTranslation) and is useless.  on/off vs.
bool is just bikeshedding.  macaddr is obviously a string, whose format
is clear from the property name.

pci-host-devaddr and pci-devfn are the only ones that do not have an
obvious property name (respectively "host" and "addr").

Paolo

  parent reply	other threads:[~2014-09-16  8:38 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-15 14:44 [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties arei.gonglei
2014-09-15 14:44 ` [Qemu-devel] [PATCH 1/3] qom: add error handler for object alias property arei.gonglei
2014-09-15 15:56   ` Paolo Bonzini
2014-09-15 14:44 ` [Qemu-devel] [PATCH 2/3] qom: add target object poniter for alias property in ObjectProperty arei.gonglei
2014-09-15 14:44 ` [Qemu-devel] [PATCH 3/3] qmp: print real legacy_name for alias property arei.gonglei
2014-09-15 17:46   ` Michael S. Tsirkin
2014-09-15 15:57 ` [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties Paolo Bonzini
2014-09-15 17:38   ` Eric Blake
2014-09-15 17:45   ` Michael S. Tsirkin
2014-09-16  7:21     ` Markus Armbruster
2014-09-16  7:53       ` Gonglei (Arei)
2014-09-16  8:36       ` Paolo Bonzini [this message]
2014-09-16  9:16         ` Markus Armbruster
2014-09-16  9:34           ` Paolo Bonzini
2014-09-16 10:37             ` Michael S. Tsirkin
2014-09-16 10:45               ` Paolo Bonzini
2014-09-16 13:31                 ` Gonglei (Arei)
2014-09-16 16:26                 ` Michael S. Tsirkin
2014-09-16 16:27                   ` Paolo Bonzini
2014-09-16 16:56                     ` Michael S. Tsirkin
2014-09-16 18:31                       ` Paolo Bonzini
2014-09-16 19:01                         ` Michael S. Tsirkin
2014-09-16 19:01                           ` Michael S. Tsirkin
2014-09-17  6:02                             ` Markus Armbruster
2014-09-16 20:00                         ` Eric Blake
2014-09-17  5:54                           ` Markus Armbruster
2014-09-17 12:58                             ` Eric Blake
2014-09-16 14:32             ` Markus Armbruster
2014-09-16 14:36               ` Paolo Bonzini
2014-09-17  2:31                 ` Gonglei (Arei)
2014-09-22  8:26                 ` Gonglei (Arei)
2014-09-15 17:48 ` Michael S. Tsirkin
2014-09-15 17:49 ` Michael S. Tsirkin
2014-09-16  0:42   ` Gonglei (Arei)
2014-09-16  8:38   ` Paolo Bonzini
2014-09-22  8:34 ` Michael S. Tsirkin
2014-09-22  8:49   ` Gonglei (Arei)
2014-09-22  9:14   ` Paolo Bonzini
2014-09-22  9:33     ` Gonglei (Arei)
2014-09-22 10:03       ` Paolo Bonzini
2014-09-22 11:22         ` Gonglei (Arei)
2014-09-22 12:06           ` Paolo Bonzini
2014-09-22 12:34             ` Michael S. Tsirkin
2014-09-22 12:55               ` Paolo Bonzini
2014-09-23  3:09                 ` Gonglei (Arei)
2014-09-23  8:39                   ` Paolo Bonzini
2014-09-23  9:13                     ` Markus Armbruster
2014-09-23  9:18                     ` Gonglei (Arei)
2014-09-23  9:06                   ` Markus Armbruster
2014-09-23  9:16                     ` Michael S. Tsirkin
2014-09-23  9:17                     ` Gonglei (Arei)
2014-09-22 12:48             ` Markus Armbruster
2014-09-22 13:13             ` Gonglei (Arei)
2014-09-22 13:24               ` Paolo Bonzini
2014-09-22 13:36                 ` Gonglei (Arei)
2014-09-22 13:40                   ` Paolo Bonzini
2014-09-22 13:45                     ` Gonglei (Arei)
2014-09-22 13:19             ` Gonglei (Arei)
2014-09-22 11:43     ` Markus Armbruster
2014-09-22 13:08       ` Paolo Bonzini
2014-09-23  4:46         ` Michael S. Tsirkin
2014-09-23 11:39         ` Markus Armbruster
2014-09-22  9:29   ` Markus Armbruster

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=5417F698.2060001@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=agraf@suse.de \
    --cc=aliguori@amazon.com \
    --cc=arei.gonglei@huawei.com \
    --cc=armbru@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=mst@redhat.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=weidong.huang@huawei.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.