[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 26/27] vhost: Add vhost_hdev_can_sw_lm
From: |
Eugenio Pérez |
Subject: |
[RFC PATCH 26/27] vhost: Add vhost_hdev_can_sw_lm |
Date: |
Fri, 20 Nov 2020 19:51:04 +0100 |
This allows a device to migrate if it meet a few requirements.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
hw/virtio/vhost.c | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index cf000b979f..44a51ccf5e 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1529,6 +1529,37 @@ static void vhost_virtqueue_cleanup(struct
vhost_virtqueue *vq)
event_notifier_cleanup(&vq->masked_notifier);
}
+static bool vhost_hdev_can_sw_lm(struct vhost_dev *hdev)
+{
+ const char *cause = NULL;
+
+ if (hdev->features & (VIRTIO_F_IOMMU_PLATFORM)) {
+ cause = "have iommu";
+ } else if (hdev->features & VIRTIO_F_RING_PACKED) {
+ cause = "is packed";
+ } else if (hdev->features & VIRTIO_RING_F_EVENT_IDX) {
+ cause = "Have event idx";
+ } else if (hdev->features & VIRTIO_RING_F_INDIRECT_DESC) {
+ cause = "Supports indirect descriptors";
+ } else if (hdev->nvqs != 2) {
+ cause = "!= 2 #vq supported";
+ } else if (!hdev->vhost_ops->vhost_net_set_backend) {
+ cause = "cannot pause device";
+ }
+
+ if (cause) {
+ if (!hdev->migration_blocker) {
+ error_setg(&hdev->migration_blocker,
+ "Migration disabled: vhost lacks VHOST_F_LOG_ALL feature and
%s.",
+ cause);
+ }
+
+ return false;
+ }
+
+ return true;
+}
+
int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
VhostBackendType backend_type, uint32_t busyloop_timeout)
{
@@ -1604,7 +1635,8 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
};
if (hdev->migration_blocker == NULL) {
- if (!vhost_dev_can_log(hdev)) {
+ if (!vhost_dev_can_log(hdev) && !vhost_hdev_can_sw_lm(hdev)
+ && hdev->migration_blocker == NULL) {
error_setg(&hdev->migration_blocker,
"Migration disabled: vhost lacks VHOST_F_LOG_ALL
feature.");
} else if (vhost_dev_log_is_shared(hdev) && !qemu_memfd_alloc_check())
{
--
2.18.4
- [RFC PATCH 18/27] vhost: add vhost_vring_poll_rcu, (continued)
- [RFC PATCH 18/27] vhost: add vhost_vring_poll_rcu, Eugenio Pérez, 2020/11/20
- [RFC PATCH 19/27] vhost: add vhost_vring_get_buf_rcu, Eugenio Pérez, 2020/11/20
- [RFC PATCH 20/27] vhost: Return used buffers, Eugenio Pérez, 2020/11/20
- [RFC PATCH 21/27] vhost: Add vhost_virtqueue_memory_unmap, Eugenio Pérez, 2020/11/20
- [RFC PATCH 22/27] vhost: Add vhost_virtqueue_memory_map, Eugenio Pérez, 2020/11/20
- [RFC PATCH 23/27] vhost: unmap qemu's shadow virtqueues on sw live migration, Eugenio Pérez, 2020/11/20
- [RFC PATCH 24/27] vhost: iommu changes, Eugenio Pérez, 2020/11/20
- [RFC PATCH 25/27] vhost: Do not commit vhost used idx on vhost_virtqueue_stop, Eugenio Pérez, 2020/11/20
- [RFC PATCH 26/27] vhost: Add vhost_hdev_can_sw_lm,
Eugenio Pérez <=
- [RFC PATCH 27/27] vhost: forbid vhost devices logging, Eugenio Pérez, 2020/11/20
- Re: [RFC PATCH 00/27] vDPA software assisted live migration, Eugenio Perez Martin, 2020/11/20
- Re: [RFC PATCH 00/27] vDPA software assisted live migration, no-reply, 2020/11/20
- Re: [RFC PATCH 00/27] vDPA software assisted live migration, Jason Wang, 2020/11/25
- Re: [RFC PATCH 00/27] vDPA software assisted live migration, Stefano Garzarella, 2020/11/27