All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Jan Dakinevich <jan.dakinevich@virtuozzo.com>
Cc: Eric Blake <eblake@redhat.com>,
	qemu-devel@nongnu.org, Cornelia Huck <cohuck@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Max Reitz <mreitz@redhat.com>, Amit Shah <amit@kernel.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Jason Wang <jasowang@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	"Denis V. Lunev" <den@virtuozzo.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v4 1/2] virtio: introduce `query-virtio' QMP command
Date: Tue, 3 Oct 2017 17:29:22 +0100	[thread overview]
Message-ID: <20171003162921.GB2335@work-vm> (raw)
In-Reply-To: <7735fee8-dcc0-edc1-2fd3-f2aee7fe2df1@virtuozzo.com>

* Jan Dakinevich (jan.dakinevich@virtuozzo.com) wrote:
> 
> 
> On 10/03/2017 05:02 PM, Eric Blake wrote:
> > On 10/03/2017 07:47 AM, Jan Dakinevich wrote:
> >> The command is intended for gathering virtio information such as status,
> >> feature bits, negotiation status. It is convenient and useful for debug
> >> purpose.
> >>
> >> The commands returns generic virtio information for virtio such as
> >> common feature names and status bits names and information for all
> >> attached to current machine devices.
> >>
> >> To retrieve names of device-specific features `get_feature_name'
> >> callback in VirtioDeviceClass also was introduced.
> >>
> >> Cc: Denis V. Lunev <den@virtuozzo.com>
> >> Signed-off-by: Jan Dakinevich <jan.dakinevich@virtuozzo.com>
> >> ---
> >>  hw/block/virtio-blk.c       |  21 +++++++++
> >>  hw/char/virtio-serial-bus.c |  15 +++++++
> >>  hw/display/virtio-gpu.c     |  13 ++++++
> >>  hw/net/virtio-net.c         |  35 +++++++++++++++
> >>  hw/scsi/virtio-scsi.c       |  16 +++++++
> >>  hw/virtio/Makefile.objs     |   2 +
> >>  hw/virtio/virtio-balloon.c  |  15 +++++++
> >>  hw/virtio/virtio-stub.c     |   9 ++++
> >>  hw/virtio/virtio.c          | 101 ++++++++++++++++++++++++++++++++++++++++++++
> >>  include/hw/virtio/virtio.h  |   2 +
> >>  qapi-schema.json            |   1 +
> >>  qapi/virtio.json            |  94 +++++++++++++++++++++++++++++++++++++++++
> >>  12 files changed, 324 insertions(+)
> >>  create mode 100644 hw/virtio/virtio-stub.c
> >>  create mode 100644 qapi/virtio.json
> > 
> > This creates a new .json file, but does not touch MAINTAINERS.  Our idea
> > in splitting the .json files was to make it easier for each sub-file
> > that needs a specific maintainer in addition to the overall *.json line
> > for QAPI maintainers, so this may deserve a MAINTAINERS entry.
> > 
> 
> Ok.
> 
> >> +++ b/qapi/virtio.json
> >> @@ -0,0 +1,94 @@
> >> +# -*- Mode: Python -*-
> >> +#
> >> +
> >> +##
> >> +# = Virtio devices
> >> +##
> >> +
> >> +{ 'include': 'common.json' }
> >> +
> >> +##
> >> +# @VirtioInfoBit:
> >> +#
> >> +# Named virtio bit
> >> +#
> >> +# @bit: bit number
> >> +#
> >> +# @name: bit name
> >> +#
> >> +# Since: 2.11.0
> >> +#
> >> +##
> >> +{
> >> +    'struct': 'VirtioInfoBit',
> >> +    'data': {
> >> +        'bit': 'uint64',
> > 
> > Why is this a 64-bit value? Are the values 0-63, or are they 1, 2, 4, 8,
> > ...?  The documentation on 'bit number' is rather sparse.
> 
> I would prefer `uint' here, but I don't see generic unsigned type (may
> be, I am mistaken). I could use uint8 here, though.
> 
> > 
> >> +        'name': 'str'
> > 
> > Wouldn't an enum type be better than an open-ended string?
> > 
> 
> Bit names are not known here, they are obtained from virtio device
> implementations.
> 
> >> +    }
> >> +}
> >> +
> >> +##
> >> +# @VirtioInfoDevice:
> >> +#
> >> +# Information about specific virtio device
> >> +#
> >> +# @qom_path: QOM path of the device
> > 
> > Please make this 'qom-path' - new interfaces should prefer '-' over '_'.
> 
> Ok.
> 
> >> +#
> >> +# @feature-names: names of device-specific features
> >> +#
> >> +# @host-features: bitmask of features, provided by devices
> >> +#
> >> +# @guest-features: bitmask of features, acknowledged by guest
> >> +#
> >> +# @status: virtio device status bitmask
> >> +#
> >> +# Since: 2.11.0
> >> +#
> >> +##
> >> +{
> >> +    'struct': 'VirtioInfoDevice',
> >> +    'data': {
> >> +        'qom_path': 'str',
> >> +        'feature-names': ['VirtioInfoBit'],
> >> +        'host-features': 'uint64',
> >> +        'guest-features': 'uint64',
> >> +        'status': 'uint64'
> > 
> > I'm wondering if this is the best representation (where the caller has
> > to parse the integer and then lookup in feature-names what each bit of
> > the integer represents).  But I'm not sure I have anything better off
> > the top of my head.
> > 
> 
> Consider it as way to tell caller about names of supported features.
> 
> >> +    }
> >> +}
> >> +
> >> +##
> >> +# @VirtioInfo:
> >> +#
> >> +# Information about virtio devices
> >> +#
> >> +# @feature-names: names of common virtio features
> >> +#
> >> +# @status-names: names of bits which represents virtio device status
> >> +#
> >> +# @devices: list of per-device virtio information
> >> +#
> >> +# Since: 2.11.0
> >> +#
> >> +##
> >> +{
> >> +    'struct': 'VirtioInfo',
> >> +    'data': {
> >> +        'feature-names': ['VirtioInfoBit'],
> > 
> > Why is feature-names listed at two different nestings of the return value?
> > 
> 
> These are different feature names. First names are common and predefined
> for all devices. Second names are device-specific.

If you can turn these into enums (union'd enums?) then you might
be able to get rid of a lot of your array filling/naming conversion
boilerplate. (Not sure if it's worth it, but it's worth looking).

Dave

> >> +        'status-names': ['VirtioInfoBit'],
> >> +        'devices': ['VirtioInfoDevice']
> >> +    }
> >> +}
> >> +
> >> +
> >> +##
> >> +# @query-virtio:
> >> +#
> >> +# Returns generic and per-device virtio information
> >> +#
> >> +# Since: 2.11.0
> >> +#
> >> +##
> >> +{
> >> +    'command': 'query-virtio',
> >> +    'returns': 'VirtioInfo'
> >> +}
> >>
> > 
> 
> -- 
> Best regards
> Jan Dakinevich
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2017-10-03 16:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-03 12:47 [Qemu-devel] [PATCH v4 0/2] virtio: introduce `info virtio' hmp command Jan Dakinevich
2017-10-03 12:47 ` [Qemu-devel] [PATCH v4 1/2] virtio: introduce `query-virtio' QMP command Jan Dakinevich
2017-10-03 14:02   ` Eric Blake
2017-10-03 14:32     ` Jan Dakinevich
2017-10-03 16:29       ` Dr. David Alan Gilbert [this message]
2017-10-04 14:26         ` Jan Dakinevich
2017-10-04 16:00           ` Eric Blake
2017-10-05 16:55             ` Jan Dakinevich
2017-10-06  5:36       ` Markus Armbruster
2017-10-06  8:27         ` Dr. David Alan Gilbert
2017-10-03 12:47 ` [Qemu-devel] [PATCH v4 2/2] virtio: add `info virtio' HMP command Jan Dakinevich

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=20171003162921.GB2335@work-vm \
    --to=dgilbert@redhat.com \
    --cc=amit@kernel.org \
    --cc=armbru@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=den@virtuozzo.com \
    --cc=eblake@redhat.com \
    --cc=jan.dakinevich@virtuozzo.com \
    --cc=jasowang@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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.