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

@ -95,7 +95,7 @@ static void vu_i2c_set_status(VirtIODevice *vdev, uint8_t status)
VHostUserI2C *i2c = VHOST_USER_I2C(vdev);
bool should_start = virtio_device_started(vdev, status);
if (i2c->vhost_dev.started == should_start) {
if (vhost_dev_is_started(&i2c->vhost_dev) == should_start) {
return;
}
@ -174,7 +174,7 @@ static void vu_i2c_disconnect(DeviceState *dev)
}
i2c->connected = false;
if (i2c->vhost_dev.started) {
if (vhost_dev_is_started(&i2c->vhost_dev)) {
vu_i2c_stop(vdev);
}
}