[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: [PATCH v3 0/2] virtio: introduce STOP status bit
This patch introduces a new status bit STOP. This can be used by the driver to stop the device in order to safely fetch used descriptors status, making sure the device will not fetch new available ones. Its main use case is live migration, although it has other orthogonal use cases. It can be used to safely discard requests that have not been used: in other words, to rewind available descriptors. Stopping the device in the live migration context is done by per-device operations in vhost backends, but the introduction of STOP as a basic virtio facility comes with advantages: * All the device virtio-specific state is summarized in a single entity, making easier to reason about it. * VMM does not need to implement device specific operations in the driver part. * Work out of the box for devices that use pure virtio backends in some part of the device emulation chain (virtio_pci_vdpa or virtio_vdpa), in any transport the device can use. * It's totally self-contained, solving the nested virtualization case straightforwardly. To fully understand its position in the live migration case, it's needed to note that the VMM acts as a part (or the whole) of the virtio device from the guest point of view, and it can act as a part of the driver from an external virtio device point of view. This is already the case when using vhost-net, for example, where VMM exposes a combination of backend and VMM features, and can mask them if needed. To migrate an external device the VMM needs to retrieve its (guest visible) status and make sure the device does not modify it or communicate with the guest anymore. The STOP status bit achieves the last part, and even the first one in case of a pure stateless device using the split vring. In its simpler way of working, the VMM masks the VIRTIO_F_STOP feature to the guest, and also masks the STOP and STOP_FAILED status bit. This way the VMM can stop and resume operation unilaterally, totally transparent for the latter. If we don't need the STOP status bit in the hypervisor but we want the guest to be able to stop the device, the status can be passthrough. If we want the guest to be able to stop and resume the device by itself and VMM does not need LM, the flag and status must not be masked. If we want both, we need VMM to be able to override, taking into account the device status for the guest. v3: * Delete all virtqueue state saving and restoring, not needed at the moment. * Add STOP_FAILED bit so device can fail the operation * Add config interrupt to notify driver about the stop bit is set, so it can avoid busy waiting polling status. * Expand device's required treatment to in-flight descriptors before setting the STOP bit. * Add rewind capabilities. * Add resume operation, clearing the STOP bit. * Reword status clear bit / PCI reset contradictions, already present in the spec * Specify device behavior if STOP status bit is set before DRIVER_OK Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Eugenio PÃrez <eperezma@redhat.com> Eugenio PÃrez (1): content: Explain better the status clearing bits Jason Wang (1): virtio: introduce STOP status bit content.tex | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 87 insertions(+), 3 deletions(-) -- 2.27.0
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]