hw/virtio: move vhd->started check into helper and add FIXME

The `started` field is manipulated internally within the vhost code
except for one place, vhost-user-blk via f5b22d06fb (vhost: recheck
dev state in the vhost_migration_log routine). Mark that as a FIXME
because it introduces a potential race. I think the referenced fix
should be tracking its state locally.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220802095010.3330793-12-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Raphael Norwitz <raphael.norwittz@nutanix.com>
This commit is contained in:
Alex Bennée 2022-08-02 10:49:59 +01:00 committed by Michael S. Tsirkin
parent 9f6bcfd99f
commit b8f3e6a18d
10 changed files with 33 additions and 13 deletions

View file

@ -94,6 +94,7 @@ struct vhost_dev {
uint64_t protocol_features;
uint64_t max_queues;
uint64_t backend_cap;
/* @started: is the vhost device started? */
bool started;
bool log_enabled;
uint64_t log_size;
@ -165,6 +166,17 @@ int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev);
*/
void vhost_dev_disable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev);
/**
* vhost_dev_is_started() - report status of vhost device
* @hdev: common vhost_dev structure
*
* Return the started status of the vhost device
*/
static inline bool vhost_dev_is_started(struct vhost_dev *hdev)
{
return hdev->started;
}
/**
* vhost_dev_start() - start the vhost device
* @hdev: common vhost_dev structure