qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [RFC 0/3] virtio-blk: add iothread-vq-mapping parameter
@ 2023-01-18 19:47 Stefan Hajnoczi
  2023-01-18 19:47 ` [RFC 1/3] qdev-properties: alias all object class properties Stefan Hajnoczi
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2023-01-18 19:47 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Eduardo Habkost, Daniel P. Berrangé, Hanna Reitz,
	Markus Armbruster, Paolo Bonzini, Emanuele Giuseppe Esposito,
	qemu-block, Eric Blake, Stefan Hajnoczi, Michael S. Tsirkin,
	Michal Privoznik

This is a preview of the iothread-vq-mapping parameter that assigns virtqueues
to IOThreads. The syntax is implemented but multiple IOThreads are not actually
supported yet. The purpose of this RFC is to reach agreement on the syntax and
to prepare for libvirt support.

virtio-blk and virtio-scsi devices will need a way to specify the
mapping between IOThreads and virtqueues. At the moment all virtqueues
are assigned to a single IOThread or the main loop. This single thread
can be a CPU bottleneck, so it is necessary to allow finer-grained
assignment to spread the load.

This series introduces command-line syntax for the new iothread-vq-mapping
property is as follows:

  --device '{"driver":"virtio-blk-pci","iothread-vq-mapping":[{"iothread":"iothread0","vqs":[0,1,2]},...]},...'

IOThreads are specified by name and virtqueues are specified by 0-based
index.

It will be common to simply assign virtqueues round-robin across a set
of IOThreads. A convenient syntax that does not require specifying
individual virtqueue indices is available:

  --device '{"driver":"virtio-blk-pci","iothread-vq-mapping":[{"iothread":"iothread0"},{"iothread":"iothread1"},...]},...'

There is no way to reassign virtqueues at runtime and I expect that to be a
very rare requirement.

Perhaps libvirt only needs to support round-robin because specifying individual
virtqueues is very specific and probably only useful for low-level performance
investigation. The libvirt domain XML syntax for this could be:

  <driver name='qemu' type='qcow2'>
    <iothreads>
      <iothread id="1"/>
      <iothread id="2"/>
      <iothread id="3"/>
    </iothreads>
    ...
  </driver>

and that would generate this QEMU command-line snippet:

  "iothread-vq-mapping":[{"iothread":"iothread1"},{"iothread":"iothread2"},{"iothread":"iothread3"}]

Note that JSON --device syntax is required for the iothread-vq-mapping
parameter because it's non-scalar.

What do you think?

Stefan Hajnoczi (3):
  qdev-properties: alias all object class properties
  qdev: add IOThreadVirtQueueMappingList property type
  virtio-blk: add iothread-vq-mapping parameter

 qapi/virtio.json                    | 30 +++++++++++
 include/hw/qdev-properties-system.h |  4 ++
 include/hw/virtio/virtio-blk.h      |  2 +
 hw/block/virtio-blk.c               | 78 +++++++++++++++++++++++++++++
 hw/core/qdev-properties-system.c    | 47 +++++++++++++++++
 hw/core/qdev-properties.c           | 18 ++++---
 6 files changed, 171 insertions(+), 8 deletions(-)

-- 
2.39.0



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-02-06 20:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-18 19:47 [RFC 0/3] virtio-blk: add iothread-vq-mapping parameter Stefan Hajnoczi
2023-01-18 19:47 ` [RFC 1/3] qdev-properties: alias all object class properties Stefan Hajnoczi
2023-01-18 19:47 ` [RFC 2/3] qdev: add IOThreadVirtQueueMappingList property type Stefan Hajnoczi
2023-01-18 19:47 ` [RFC 3/3] virtio-blk: add iothread-vq-mapping parameter Stefan Hajnoczi
2023-02-06 14:11 ` [RFC 0/3] " Michal Prívozník
2023-02-06 20:31   ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).