Skip to content

virtio-blk: removal of AioContext lock

Emanuele Giuseppe Esposito qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest8 patches 19 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8virtio_queue_aio_attach_host_notifier: remove AioContext lockhw/block/dataplane/virtio-blk.c hw/block/virtio-blk.c hw/scsi/virtio-scsi-dataplane.c+24 -43 replies
2/8block-backend: enable_write_cache should be atomicblock/block-backend.c hw/block/virtio-blk.c+3 -71 reply
3/8virtio_blk_process_queued_requests: always run in a bhhw/block/dataplane/virtio-blk.c hw/block/virtio-blk.c include/hw/virtio/virtio-blk.h+12 -33 replies
4/8virtio: categorize callbacks in GShw/block/virtio-blk.c hw/virtio/virtio-bus.c hw/virtio/virtio-pci.c +1 more+17 -02 replies
5/8virtio-blk: mark GLOBAL_STATE_CODE functionshw/block/dataplane/virtio-blk.c hw/block/virtio-blk.c+33 -01 reply
6/8virtio-blk: mark IO_CODE functionshw/block/dataplane/virtio-blk.c hw/block/virtio-blk.c+39 -03 replies
7/8VirtIOBlock: protect rq with its own lockhw/block/virtio-blk.c include/hw/virtio/virtio-blk.h+33 -105 replies
8/8virtio-blk: remove unnecessary AioContext lock from function already safehw/block/virtio-blk.c+2 -161 reply

Reviews trailers per patch

6 of 8 patches have a Reviewed-by or Acked-by.

PatchMichael S. TsirkinStefan Hajnoczi
1/8
2/8R-b
3/8
4/8A-b R-b
5/8R-b
6/8R-b
7/8R-b
8/8R-b

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

Read the v1 thread

Cover letter [PATCH 0/8] virtio-blk: removal of AioContext lock

This serie aims to free virtio-blk (and in the future all virtio devices) from the AioContext lock.

First step is to understand which functions are running in the main loop and which are in iothreads.
Because many functions in virtio-blk are callbacks called in some other virtio (pci, mmio, bus and so on) callbacks, this is not trivial.
Patches 4-5-6 aim to split at least virtio-blk API.

There are two main things to consider when comparing this serie with the block layer API split:

- sometimes we have data that is accessed by both IO and GS functions, but never together. For example, when the main loop access some data, iothread is guaranteed to be stopped.

- taking into account the multiqueue setup:
this work aims to allow an iothread to access multiple virtio queues, while assigning the same queue to only one iothread. Currently, we have a single iothread running, so if we know that the main loop is not interfering, we are safe. However, if we want to consider multiple iothreads concurrently running, we need to take additional precautions.

A good example of the above is in patch 7.

Emanuele Giuseppe Esposito (8):
virtio_queue_aio_attach_host_notifier: remove AioContext lock
block-backend: enable_write_cache should be atomic virtio_blk_process_queued_requests: always run in a bh
virtio: categorize callbacks in GS
virtio-blk: mark GLOBAL_STATE_CODE functions
virtio-blk: mark IO_CODE functions
VirtIOBlock: protect rq with its own lock
virtio-blk: remove unnecessary AioContext lock from function already
safe

 block/block-backend.c           |   6 +-
 hw/block/dataplane/virtio-blk.c |  32 +++++++-
 hw/block/virtio-blk.c           | 132 ++++++++++++++++++++++++--------
 hw/scsi/virtio-scsi-dataplane.c |  12 ++-
 hw/virtio/virtio-bus.c          |   5 ++
 hw/virtio/virtio-pci.c          |   2 +
 hw/virtio/virtio.c              |   8 ++
 include/hw/virtio/virtio-blk.h  |   6 +-
 8 files changed, 163 insertions(+), 40 deletions(-)
Signature · 1 line
2.31.1