Re: [PATCH v10 0/8] hmp,qmp: Add commands to introspect virtio devices

2021-12-06 Thread Michael S. Tsirkin
On Mon, Dec 06, 2021 at 07:13:49PM +0100, Christian Schoenebeck wrote:
> On Montag, 6. Dezember 2021 17:09:45 CET Jonah Palmer wrote:
> > On 12/6/21 08:50, Christian Schoenebeck wrote:
> > > On Montag, 6. Dezember 2021 13:43:18 CET Jonah Palmer wrote:
> > >> This series introduces new QMP/HMP commands to dump the status of a
> > >> virtio device at different levels.
> > >> 
> > >> [Jonah: Rebasing previous patchset from Nov. 10 (v9). Original patches
> > >> 
> > >>   are by Laurent Vivier from May 2020.
> > >>   
> > >>   Rebase from v9 to v10 includes reformatting virtio.json examples and
> > >>   command structures for better consistency. Also removed all enums from
> > >>   virtio.json and replaced their purpose with string literals.
> > >>   
> > >>   Removed @ndescs from VirtioQueueElement, as the number of descriptors
> > >>   can be inferred from the length of the @descs chain.
> > >>   
> > >>   Lastly, removed the examples in hmp-commands-info.hx to fix
> > >>   'inconsistent
> > >>   literal block quoting' warning from Sphinx.]
> > > 
> > > I have not followed the entire discussion. AFAICS this is intended to
> > > monitor status information on virtio level only, like virtqueue fill
> > > status, etc.
> > > 
> > > One thing that I am looking for is monitoring device specific information
> > > above virtio level, e.g. certain performance numbers or statistics that
> > > only make sense for the specific device. That would not fit into any of
> > > these commands, right?
> > > 
> > > Best regards,
> > > Christian Schoenebeck
> > 
> > Correct. These are just one-shot commands that dump information on virtio
> > devices (including vhosts), their virtqueues, and virtqueue elements as they
> > are at the time of the command.
> > 
> > Jonah
> 
> What I would find useful though on this virtio level: also being able to 
> query 
> the maximum and average fill state of the two ring buffers of each virtqueue. 
> That would allow to identify performance bottlenecks.
> 
> Best regards,
> Christian Schoenebeck

Adding this to vhost would need some interface work though.
Also, collecting these stats isn't free or trivial,
so I imagine we would need commands to enable/disable data collection.

-- 
MST




Re: [PATCH v10 0/8] hmp, qmp: Add commands to introspect virtio devices

2021-12-06 Thread Christian Schoenebeck via
On Montag, 6. Dezember 2021 17:09:45 CET Jonah Palmer wrote:
> On 12/6/21 08:50, Christian Schoenebeck wrote:
> > On Montag, 6. Dezember 2021 13:43:18 CET Jonah Palmer wrote:
> >> This series introduces new QMP/HMP commands to dump the status of a
> >> virtio device at different levels.
> >> 
> >> [Jonah: Rebasing previous patchset from Nov. 10 (v9). Original patches
> >> 
> >>   are by Laurent Vivier from May 2020.
> >>   
> >>   Rebase from v9 to v10 includes reformatting virtio.json examples and
> >>   command structures for better consistency. Also removed all enums from
> >>   virtio.json and replaced their purpose with string literals.
> >>   
> >>   Removed @ndescs from VirtioQueueElement, as the number of descriptors
> >>   can be inferred from the length of the @descs chain.
> >>   
> >>   Lastly, removed the examples in hmp-commands-info.hx to fix
> >>   'inconsistent
> >>   literal block quoting' warning from Sphinx.]
> > 
> > I have not followed the entire discussion. AFAICS this is intended to
> > monitor status information on virtio level only, like virtqueue fill
> > status, etc.
> > 
> > One thing that I am looking for is monitoring device specific information
> > above virtio level, e.g. certain performance numbers or statistics that
> > only make sense for the specific device. That would not fit into any of
> > these commands, right?
> > 
> > Best regards,
> > Christian Schoenebeck
> 
> Correct. These are just one-shot commands that dump information on virtio
> devices (including vhosts), their virtqueues, and virtqueue elements as they
> are at the time of the command.
> 
> Jonah

What I would find useful though on this virtio level: also being able to query 
the maximum and average fill state of the two ring buffers of each virtqueue. 
That would allow to identify performance bottlenecks.

Best regards,
Christian Schoenebeck





Re: [PATCH v10 0/8] hmp,qmp: Add commands to introspect virtio devices

2021-12-06 Thread Jonah Palmer


On 12/6/21 08:50, Christian Schoenebeck wrote:

On Montag, 6. Dezember 2021 13:43:18 CET Jonah Palmer wrote:

This series introduces new QMP/HMP commands to dump the status of a
virtio device at different levels.

[Jonah: Rebasing previous patchset from Nov. 10 (v9). Original patches
  are by Laurent Vivier from May 2020.

  Rebase from v9 to v10 includes reformatting virtio.json examples and
  command structures for better consistency. Also removed all enums from
  virtio.json and replaced their purpose with string literals.

  Removed @ndescs from VirtioQueueElement, as the number of descriptors
  can be inferred from the length of the @descs chain.

  Lastly, removed the examples in hmp-commands-info.hx to fix 'inconsistent
  literal block quoting' warning from Sphinx.]

I have not followed the entire discussion. AFAICS this is intended to monitor
status information on virtio level only, like virtqueue fill status, etc.

One thing that I am looking for is monitoring device specific information
above virtio level, e.g. certain performance numbers or statistics that only
make sense for the specific device. That would not fit into any of these
commands, right?

Best regards,
Christian Schoenebeck


Correct. These are just one-shot commands that dump information on virtio
devices (including vhosts), their virtqueues, and virtqueue elements as they
are at the time of the command.

Jonah





Re: [PATCH v10 0/8] hmp, qmp: Add commands to introspect virtio devices

2021-12-06 Thread Christian Schoenebeck via
On Montag, 6. Dezember 2021 13:43:18 CET Jonah Palmer wrote:
> This series introduces new QMP/HMP commands to dump the status of a
> virtio device at different levels.
> 
> [Jonah: Rebasing previous patchset from Nov. 10 (v9). Original patches
>  are by Laurent Vivier from May 2020.
> 
>  Rebase from v9 to v10 includes reformatting virtio.json examples and
>  command structures for better consistency. Also removed all enums from
>  virtio.json and replaced their purpose with string literals.
> 
>  Removed @ndescs from VirtioQueueElement, as the number of descriptors
>  can be inferred from the length of the @descs chain.
> 
>  Lastly, removed the examples in hmp-commands-info.hx to fix 'inconsistent
>  literal block quoting' warning from Sphinx.]

I have not followed the entire discussion. AFAICS this is intended to monitor 
status information on virtio level only, like virtqueue fill status, etc.

One thing that I am looking for is monitoring device specific information 
above virtio level, e.g. certain performance numbers or statistics that only 
make sense for the specific device. That would not fit into any of these 
commands, right?

Best regards,
Christian Schoenebeck





[PATCH v10 0/8] hmp,qmp: Add commands to introspect virtio devices

2021-12-06 Thread Jonah Palmer
This series introduces new QMP/HMP commands to dump the status of a
virtio device at different levels.

[Jonah: Rebasing previous patchset from Nov. 10 (v9). Original patches
 are by Laurent Vivier from May 2020.

 Rebase from v9 to v10 includes reformatting virtio.json examples and
 command structures for better consistency. Also removed all enums from
 virtio.json and replaced their purpose with string literals.

 Removed @ndescs from VirtioQueueElement, as the number of descriptors
 can be inferred from the length of the @descs chain.

 Lastly, removed the examples in hmp-commands-info.hx to fix 'inconsistent
 literal block quoting' warning from Sphinx.]

1. List available virtio devices in the machine

HMP Form:

info virtio

Example:

(qemu) info virtio
/machine/peripheral/vsock0/virtio-backend [vhost-vsock]
/machine/peripheral/crypto0/virtio-backend [virtio-crypto]
/machine/peripheral-anon/device[2]/virtio-backend [virtio-scsi]
/machine/peripheral-anon/device[1]/virtio-backend [virtio-net]
/machine/peripheral-anon/device[0]/virtio-backend [virtio-serial]

QMP Form:

{ 'command': 'x-query-virtio',
  'returns': ['VirtioInfo'],
  'features': [ 'unstable' ] }

Example:

-> { "execute": "x-query-virtio" }
<- { "return": [
   {
   "path": "/machine/peripheral/vsock0/virtio-backend",
   "name": "vhost-vsock"
   },
   {
   "path": "/machine/peripheral/crypto0/virtio-backend",
   "name": "virtio-crypto"
   },
   {
   "path": "/machine/peripheral-anon/device[2]/virtio-backend",
   "name": "virtio-scsi"
   },
   {
   "path": "/machine/peripheral-anon/device[1]/virtio-backend",
   "name": "virtio-net"
   },
   {
   "path": "/machine/peripheral-anon/device[0]/virtio-backend",
   "name": "virtio-serial"
   }
 ]
   }

2. Display status of a given virtio device

HMP Form:

info virtio-status 

Example:

(qemu) info virtio-status /machine/peripheral/vsock0/virtio-backend
/machine/peripheral/vsock0/virtio-backend:
device_name: vhost-vsock (vhost)
device_id:   19
vhost_started:   true
bus_name:(null)
broken:  false
disabled:false
disable_legacy_check:false
started: true
use_started: true
start_on_kick:   false
use_guest_notifier_mask: true
vm_running:  true
num_vqs: 3
queue_sel:   2
isr: 0
endianness:  little
status: ACKNOWLEDGE, DRIVER, FEATURES_OK, DRIVER_OK
Guest features:   EVENT_IDX, INDIRECT_DESC, VERSION_1
Host features:PROTOCOL_FEATURES, EVENT_IDX, INDIRECT_DESC, 
VERSION_1, ANY_LAYOUT,
  NOTIFY_ON_EMPTY
Backend features:
VHost:
nvqs:   2
vq_index:   0
max_queues: 0
n_mem_sections: 4
n_tmp_sections: 4
backend_cap:0
log_enabled:false
log_size:   0
Features:  EVENT_IDX, INDIRECT_DESC, VERSION_1, 
ANY_LAYOUT, NOTIFY_ON_EMPTY
   LOG_ALL
Acked features:EVENT_IDX, INDIRECT_DESC, VERSION_1
Backend features:
Protocol features:

QMP Form:

{ 'command': 'x-query-virtio-status',
  'data': { 'path': 'str' },
  'returns': 'VirtioStatus',
  'features': [ 'unstable' ] }

Example:

-> { "execute": "x-query-virtio-status",
 "arguments": { "path": "/machine/peripheral/vsock0/virtio-backend" 
}
   }
<- { "return": {
   "device-endian": "little",
   "bus-name": "",
   "disable-legacy-check": false,
   "name": "vhost-vsock",
   "started": true,
   "device-id": 19,
   "vhost-dev": {
  "n-tmp-sections": 4,
  "n-mem-sections": 4,
  "max-queues": 0,
  "backend-cap": 0,
  "log-size": 0,
  "backend-features": {
 "transports": [],
 "dev-features": []
  },
  "nvqs": 2,
  "protocol-features": {