aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2023-12-05 13:19:58 -0500
committerKevin Wolf <kwolf@redhat.com>2023-12-21 22:49:27 +0100
commited18b1ed4f34888872b5fbc2f217c65d62c95cfd (patch)
treea62eff3b16c753d530e61e2098a88a0029872306 /include
parente661a2470342d6fa873369c81988a19b1bb7b3f4 (diff)
downloadqemu-ed18b1ed4f34888872b5fbc2f217c65d62c95cfd.zip
qemu-ed18b1ed4f34888872b5fbc2f217c65d62c95cfd.tar.gz
qemu-ed18b1ed4f34888872b5fbc2f217c65d62c95cfd.tar.bz2
virtio-scsi: replace AioContext lock with tmf_bh_lock
Protect the Task Management Function BH state with a lock. The TMF BH runs in the main loop thread. An IOThread might process a TMF at the same time as the TMF BH is running. Therefore tmf_bh_list and tmf_bh must be protected by a lock. Run TMF request completion in the IOThread using aio_wait_bh_oneshot(). This avoids more locking to protect the virtqueue and SCSI layer state. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-ID: <20231205182011.1976568-2-stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/hw/virtio/virtio-scsi.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h
index 779568a..da8cb92 100644
--- a/include/hw/virtio/virtio-scsi.h
+++ b/include/hw/virtio/virtio-scsi.h
@@ -85,8 +85,9 @@ struct VirtIOSCSI {
/*
* TMFs deferred to main loop BH. These fields are protected by
- * virtio_scsi_acquire().
+ * tmf_bh_lock.
*/
+ QemuMutex tmf_bh_lock;
QEMUBH *tmf_bh;
QTAILQ_HEAD(, VirtIOSCSIReq) tmf_bh_list;