Skip to content

Basic device state visualization

Jan Kiszka qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest8 patches 44 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8qdev: Allow device addressing via 'driver.instance'hw/qdev.c+18 -56 replies
2/8Add base64 encoder/decoderMakefile.objs base64.c base64.h+221 -10 replies
3/8Add QBufferMakefile Makefile.objs check-qbuffer.c +5 more+342 -329 replies
4/8monitor: Add basic device state visualizationhw/hw.h hw/qdev.c hw/qdev.h +1 more+307 -02 replies
5/8qmp: Teach basic capability negotiation to python exampleQMP/qmp-shell QMP/vm-info+2 -00 replies
6/8qmp: Fix python helper /wrt long return stringsQMP/qmp.py+1 -10 replies
7/8Add QLIST_INSERT_TAILqemu-queue.h+9 -02 replies
8/8qdev: Add new devices/buses at the tailhw/qdev.c+2 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Qemu-devel] [PATCH 0/8] Basic device state visualization

While recently fixing the SCSI reset issues, I once again had the need for displaying the state of involved devices. So far the common approach is to attach gdb to qemu (or even inject some printf). But that time I hacked up a 30-minute patch to dump the vmstate of any (fully converted) qdev device.

This series now lays the ground for more sophisticated visulization. It adds the monitor command 'device_show <qdev-path>', freezes the vmstate of the addressed device, sticks it into a QMP dict, and either transmit this via QMP or pretty-prints it on a monitor console. Some example:

(qemu) device_show /i440FX-pcihost/pci.0/piix3-usb-uhci
dev: piix3-usb-uhci, id ""
dev.

    version_id:         00000002
    config:             a0 7d d1 00 00 00 00 00 - b0 7e d1 00 00 00 00 00
                        ...
    irq_state:          00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
  num_ports_vmstate:    02
  ports[00].
      ctrl:             0083
  ports[01].
      ctrl:             0080
  cmd:                  00c1
  status:               0000
  intr:                 0000
  frnum:                0077
  fl_base_addr:         0fffc000
  sof_timing:           40
  status2:              00
  frame_timer:          0000000000cb2bd0

Basically, this is the level of support I recently saw in a demonstration of some commercial simulator as well. We are just lacking support for the yet unconverted devices. And I think we can even do better on the long term, e.g. by annotating state variables that contain flags, or by pretty-printing buffers like the PCI config space, or...

Let's give this a start, I bet it will be helpful while adding complex device models like AHCI or EHCI. Looking forward to feedback!

Jan Kiszka (8):
qdev: Allow device addressing via 'driver.instance' Add base64 encoder/decoder
Add QBuffer
monitor: Add basic device state visualization
qmp: Teach basic capability negotiation to python example
qmp: Fix python helper /wrt long return strings Add QLIST_INSERT_TAIL
qdev: Add new devices/buses at the tail

 Makefile        |    3 +-
 Makefile.objs   |    4 +-
 QMP/qmp-shell   |    1 +
 QMP/qmp.py      |    2 +-
 QMP/vm-info     |    1 +
 base64.c        |  202 +++++++++++++++++++++++++++++++++++
 base64.h        |   18 +++
 check-qbuffer.c |  172 ++++++++++++++++++++++++++++++
 configure       |    2 +-
 hw/hw.h         |    2 +
 hw/qdev.c       |  314 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 hw/qdev.h       |    2 +
 qbuffer.c       |  116 ++++++++++++++++++++
 qbuffer.h       |   33 ++++++
 qemu-monitor.hx |   16 +++
 qemu-queue.h    |    9 ++
 qjson.c         |   16 +++
 qobject.h       |    1 +
 18 files changed, 902 insertions(+), 12 deletions(-)
 create mode 100644 base64.c
 create mode 100644 base64.h
 create mode 100644 check-qbuffer.c
 create mode 100644 qbuffer.c
 create mode 100644 qbuffer.h