Re: [PATCH v6 0/6] hmp, qmp: Add some commands to introspect virtio devices
On 7/22/21 5:16 AM, Jason Wang wrote: 在 2021/7/21 下午4:53, Jonah Palmer 写道: Hi Jason. My apologies for the delayed response, several work-related things came up recently, but they're slowing down now so I'm turning my attention these patches to get taken care of. A few questions and comments below (and in other following patches): On 7/13/21 10:42 PM, Jason Wang wrote: 在 2021/7/12 下午6:35, Jonah Palmer 写道: Dump the information of the head element of the third queue of virtio-scsi: (qemu) virtio queue-element /machine/peripheral-anon/device[3]/virtio-backend 3 index: 122 ndescs: 3 descs: addr 0x7302d000 len 4096 (write), addr 0x3c951763 len 108 (write, next), addr 0x3c951728 len 51 (next) I think it would be nice if we can show driver area and device area as well here. Sure thing. And I apologize if it's obvious (I'm relatively new to virtio), but how can I expose the driver area? So the spec defines three parts: the device area, the driver area, and the descriptor area. And they are all located in the guest memory. I understand that virtio devices are part of the Qemu process, but I also thought that virtio drivers are in the guest's kernel, which I don't believe I can see into from Qemu (or, at least, it's not obvious to me). It works like how you access the descriptor ring (descriptor area). Thanks Oh, I see now! I didn't realize the device area is essentially the used ring and the driver area is the avail ring (at least for the split virtqueue model). I see this in the virtio spec now. Thank you! Jonah Thanks
Re: [PATCH v6 0/6] hmp, qmp: Add some commands to introspect virtio devices
在 2021/7/21 下午4:53, Jonah Palmer 写道: Hi Jason. My apologies for the delayed response, several work-related things came up recently, but they're slowing down now so I'm turning my attention these patches to get taken care of. A few questions and comments below (and in other following patches): On 7/13/21 10:42 PM, Jason Wang wrote: 在 2021/7/12 下午6:35, Jonah Palmer 写道: Dump the information of the head element of the third queue of virtio-scsi: (qemu) virtio queue-element /machine/peripheral-anon/device[3]/virtio-backend 3 index: 122 ndescs: 3 descs: addr 0x7302d000 len 4096 (write), addr 0x3c951763 len 108 (write, next), addr 0x3c951728 len 51 (next) I think it would be nice if we can show driver area and device area as well here. Sure thing. And I apologize if it's obvious (I'm relatively new to virtio), but how can I expose the driver area? So the spec defines three parts: the device area, the driver area, and the descriptor area. And they are all located in the guest memory. I understand that virtio devices are part of the Qemu process, but I also thought that virtio drivers are in the guest's kernel, which I don't believe I can see into from Qemu (or, at least, it's not obvious to me). It works like how you access the descriptor ring (descriptor area). Thanks Jonah Thanks
Re: [PATCH v6 0/6] hmp, qmp: Add some commands to introspect virtio devices
Hi Jason. My apologies for the delayed response, several work-related things came up recently, but they're slowing down now so I'm turning my attention these patches to get taken care of. A few questions and comments below (and in other following patches): On 7/13/21 10:42 PM, Jason Wang wrote: 在 2021/7/12 下午6:35, Jonah Palmer 写道: Dump the information of the head element of the third queue of virtio-scsi: (qemu) virtio queue-element /machine/peripheral-anon/device[3]/virtio-backend 3 index: 122 ndescs: 3 descs: addr 0x7302d000 len 4096 (write), addr 0x3c951763 len 108 (write, next), addr 0x3c951728 len 51 (next) I think it would be nice if we can show driver area and device area as well here. Sure thing. And I apologize if it's obvious (I'm relatively new to virtio), but how can I expose the driver area? I understand that virtio devices are part of the Qemu process, but I also thought that virtio drivers are in the guest's kernel, which I don't believe I can see into from Qemu (or, at least, it's not obvious to me). Jonah Thanks
Re: [PATCH v6 0/6] hmp, qmp: Add some commands to introspect virtio devices
在 2021/7/12 下午6:35, Jonah Palmer 写道: Dump the information of the head element of the third queue of virtio-scsi: (qemu) virtio queue-element /machine/peripheral-anon/device[3]/virtio-backend 3 index: 122 ndescs: 3 descs: addr 0x7302d000 len 4096 (write), addr 0x3c951763 len 108 (write, next), addr 0x3c951728 len 51 (next) I think it would be nice if we can show driver area and device area as well here. Thanks
Re: [PATCH v6 0/6] hmp,qmp: Add some commands to introspect virtio devices
On Mon, Jul 12, 2021 at 06:35:31AM -0400, 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 March for Qemu 6.1 > (here: > https://lore.kernel.org/qemu-devel/1616084984-11263-1-git-send-email-jonah.pal...@oracle.com/) > from Laurent's original qmp/hmp virtio commands from last May > (here: > https://lore.kernel.org/qemu-devel/20200507134800.10837-1-lviv...@redhat.com/) > which included updating Makefile to meson.build, adding all virtio/vhost > types, and > other minor patching (e.g. qmp_x_debug_query_virtio uses QAPI_LIST_PREPEND > rather > than open coding to iterate through list of virtio devices, see patch 1/6). > > Also, added new features (since Qemu 6.1) to virtio-gpu, virtio-net, and > virtio-balloon. Lastly, added display for the virtio device name in a > few of the qmp/hmp commands as well as relative indicies for vrings > (see patches 4/6, 6/6).] Acked-by: Michael S. Tsirkin needs to be either merged or acked by HMP maintainer. > 1. Main command > > HMP Only: > > virtio [subcommand] > > Example: > > List all sub-commands: > > (qemu) virtio > virtio query -- List all available virtio devices > virtio status path -- Display status of a given virtio device > virtio queue-status path queue -- Display status of a given virtio > queue > virtio queue-element path queue [index] -- Display element of a given > virtio queue > > 2. List available virtio deices in the machine > > HMP Form: > > virtio query > > Example: > > (qemu) virtio query > /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-debug-query-virtio', 'returns': ['VirtioInfo'] } > > Example: > > -> { "execute": "x-debug-query-virtio" } > <- { "return": [ > { > "path": > "/machine/peripheral-anon/device[2]/virtio-backend", > "type": "virtio-scsi" > }, > { > "path": > "/machine/peripheral-anon/device[1]/virtio-backend", > "type": "virtio-net" > }, > { > "path": > "/machine/peripheral-anon/device[0]/virtio-backend", > "type": "virtio-serial" > } > ] > } > > 3. Display status of a given virtio device > > HMP Form: > > virtio status > > Example: > > (qemu) virtio status /machine/peripheral-anon/device[2]/virtio-backend > /machine/peripheral-anon/device[2]/virtio-backend: > Device Id: 8 > Guest features: event-idx, indirect-desc, version-1, change, > hotplug > Host features: event-idx, indirect-desc, bad-feature, > version-1, > any-layout, notify-on-empty, change, hotplug > Backend features: > Endianness: little > VirtQueues: 4 > > QMP Form: > > { 'command': 'x-debug-virtio-status', > 'data': { 'path': 'str' }, > 'returns': 'VirtioStatus' > } > > Example: > > -> { "execute": "x-debug-virtio-status" > "arguments": { > "path": "/machine/peripheral-anon/device[2]/virtio-backend" > } >} > <- { "return": { > "device-endian": "little", > "device-id": 8, > "backend-features": { > "transport": [ > ], > "type": "virtio-scsi", > "features": [ > ] > }, > "num-vqs": 4, > "guest-features": { > "transport": [ > "event-idx", > "indirect-desc", > "version-1" > ], > "type": "virtio-scsi", > "features": [ > "change", > "hotplug" > ] > }, > "host-features": { > "transport": [ > "event-idx", > "indirect-desc", > "bad-feature", > "version-1", > "any-layout", > "notify-on-empty" > ], > "type": "virtio-scsi", > "features": [ > "change", > "hotplug" > ] > } >
[PATCH v6 0/6] hmp, qmp: Add some commands to introspect virtio devices
This series introduces new QMP/HMP commands to dump the status of a virtio device at different levels. [Jonah: Rebasing previous patchset from March for Qemu 6.1 (here: https://lore.kernel.org/qemu-devel/1616084984-11263-1-git-send-email-jonah.pal...@oracle.com/) from Laurent's original qmp/hmp virtio commands from last May (here: https://lore.kernel.org/qemu-devel/20200507134800.10837-1-lviv...@redhat.com/) which included updating Makefile to meson.build, adding all virtio/vhost types, and other minor patching (e.g. qmp_x_debug_query_virtio uses QAPI_LIST_PREPEND rather than open coding to iterate through list of virtio devices, see patch 1/6). Also, added new features (since Qemu 6.1) to virtio-gpu, virtio-net, and virtio-balloon. Lastly, added display for the virtio device name in a few of the qmp/hmp commands as well as relative indicies for vrings (see patches 4/6, 6/6).] 1. Main command HMP Only: virtio [subcommand] Example: List all sub-commands: (qemu) virtio virtio query -- List all available virtio devices virtio status path -- Display status of a given virtio device virtio queue-status path queue -- Display status of a given virtio queue virtio queue-element path queue [index] -- Display element of a given virtio queue 2. List available virtio deices in the machine HMP Form: virtio query Example: (qemu) virtio query /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-debug-query-virtio', 'returns': ['VirtioInfo'] } Example: -> { "execute": "x-debug-query-virtio" } <- { "return": [ { "path": "/machine/peripheral-anon/device[2]/virtio-backend", "type": "virtio-scsi" }, { "path": "/machine/peripheral-anon/device[1]/virtio-backend", "type": "virtio-net" }, { "path": "/machine/peripheral-anon/device[0]/virtio-backend", "type": "virtio-serial" } ] } 3. Display status of a given virtio device HMP Form: virtio status Example: (qemu) virtio status /machine/peripheral-anon/device[2]/virtio-backend /machine/peripheral-anon/device[2]/virtio-backend: Device Id: 8 Guest features: event-idx, indirect-desc, version-1, change, hotplug Host features: event-idx, indirect-desc, bad-feature, version-1, any-layout, notify-on-empty, change, hotplug Backend features: Endianness: little VirtQueues: 4 QMP Form: { 'command': 'x-debug-virtio-status', 'data': { 'path': 'str' }, 'returns': 'VirtioStatus' } Example: -> { "execute": "x-debug-virtio-status" "arguments": { "path": "/machine/peripheral-anon/device[2]/virtio-backend" } } <- { "return": { "device-endian": "little", "device-id": 8, "backend-features": { "transport": [ ], "type": "virtio-scsi", "features": [ ] }, "num-vqs": 4, "guest-features": { "transport": [ "event-idx", "indirect-desc", "version-1" ], "type": "virtio-scsi", "features": [ "change", "hotplug" ] }, "host-features": { "transport": [ "event-idx", "indirect-desc", "bad-feature", "version-1", "any-layout", "notify-on-empty" ], "type": "virtio-scsi", "features": [ "change", "hotplug" ] } } } 4. Display status of a given virtio queue HMP Form: virtio queue-status Example: (qemu) virtio queue-status /machine/peripheral-anon/device[2]/virtio-backend 3 /machine/peripheral-anon/device[2]/virtio-backend: device_type:virtio-scsi index: 3 inuse: 0 last_avail_idx: 4174 (78 % 256)