Skip to content

virtio-blk: add iothread-vq-mapping parameter

Stefan Hajnoczi qemu-devel 4 versions – Applied

Status from this message: Thanks, applied to the block branch. We agreed off-list that the

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest4 patches 7 repliesApplied
  2. v34 patches 0 repliesSuperseded
  3. v22 patches 14 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v1 RFC3 patches2 repliesSuperseded

Changes in v4 from the cover letter

- Use DummyVirtioForceArrays naming in QAPI schema [Markus]

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/4qdev-properties: alias all object class propertieshw/core/qdev-properties.c+10 -82 replies
2/4string-output-visitor: show structs as "<omitted>"include/qapi/string-output-visitor.h qapi/string-output-visitor.c+19 -30 replies
3/4qdev: add IOThreadVirtQueueMappingList property typehw/core/qdev-properties-system.c include/hw/qdev-properties-system.h qapi/virtio.json+80 -00 replies
4/4virtio-blk: add iothread-vq-mapping parameterhw/block/dataplane/virtio-blk.c hw/block/dataplane/virtio-blk.h hw/block/virtio-blk.c +1 more+202 -504 replies

Reviews trailers per patch

2 of 4 patches have a Reviewed-by or Acked-by.

PatchMarkus ArmbrusterKevin Wolf
1/4R-b
2/4R-b
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/4] virtio-blk: add iothread-vq-mapping parameter

v4:
- Use DummyVirtioForceArrays naming in QAPI schema [Markus]
v3:
- Rebased onto Kevin's block branch
- Add StringOutputVisitor "<omitted>" patch to fix "info qtree" crash
- Fix QAPI schema formatting [Markus]
- Eliminate unnecessary local variable in get_iothread_vq_mapping_list() [Markus]

virtio-blk and virtio-scsi devices 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. With this series applied, "pidstat -t 1" shows that guests with -smp 2 or higher are able to exploit multiple IOThreads.

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.

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

Based-on: 81e69329d6a4018f4b37d15b6fc845fbe585a93b (https://repo.or.cz/qemu/kevin.git block)

Stefan Hajnoczi (4):
qdev-properties: alias all object class properties
string-output-visitor: show structs as "<omitted>"
qdev: add IOThreadVirtQueueMappingList property type
virtio-blk: add iothread-vq-mapping parameter

 qapi/virtio.json                     |  29 +++++
 hw/block/dataplane/virtio-blk.h      |   3 +
 include/hw/qdev-properties-system.h  |   5 +
 include/hw/virtio/virtio-blk.h       |   2 +
 include/qapi/string-output-visitor.h |   6 +-
 hw/block/dataplane/virtio-blk.c      | 155 ++++++++++++++++++++-------
 hw/block/virtio-blk.c                |  92 +++++++++++++---
 hw/core/qdev-properties-system.c     |  46 ++++++++
 hw/core/qdev-properties.c            |  18 ++--
 qapi/string-output-visitor.c         |  16 +++
 10 files changed, 311 insertions(+), 61 deletions(-)
Signature · 1 line
2.43.0