Skip to contentSkip to conversation

vhost-user: live migration with multiqueue fails

PATCH In review Thibaut Collet 3 participants 9 messages Nov 24, 2015 – Nov 25, 2015

lore
Share & tools
lore
#0 lore raw

cover vhost-user: live migration with multiqueue fails

Since commit 3a12f32229a live migration of vhost user, if multiqueue is set, fails:
The state of the vring are lost, only the first queue pair is set to enable even if there are several queue pairs enabled.

Thibaut Collet (1):
vhost-user: do not send SET_VRING_ENABLE at start

 hw/virtio/vhost.c | 5 -----
 1 file changed, 5 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 vhost-user: do not send SET_VRING_ENABLE at start

This patch reverts partially commit 3a12f32229a.

In case of live migration several queues can be enabled and not only the first one. So inform backend that only the first queue is enabled is wrong.

Since commit 7263a0ad7899 backend is already notified of the state of the vring through the vring attach operation. This function, called during the startup sequence, provides the correct state of the vring, even in case of live migration.

So nothing has to be added to give the vring state to the backend at the startup.

---
 hw/virtio/vhost.c | 5 -----
 1 file changed, 5 deletions(-)
hw/virtio/vhost.c +0 -5
index 1794f0d..870cd12 100644
@@ -1226,11 +1226,6 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
         }
     }
 
-    if (hdev->vhost_ops->vhost_set_vring_enable) {
-        /* only enable first vq pair by default */
-        hdev->vhost_ops->vhost_set_vring_enable(hdev, hdev->vq_index == 0);
-    }
-
     return 0;
 fail_log:
     vhost_log_put(hdev, false);
Signature · 1 line
2.1.4
#2 lore raw

Re: [Qemu-devel] [PATCH for-2.5 1/1] vhost-user: do not send SET_VRING_ENABLE at start

Quoted 35 lines · Thibaut Collet

This patch reverts partially commit 3a12f32229a.

In case of live migration several queues can be enabled and not only the first one. So inform backend that only the first queue is enabled is wrong.

Since commit 7263a0ad7899 backend is already notified of the state of the vring through the vring attach operation. This function, called during the startup sequence, provides the correct state of the vring, even in case of live migration.

So nothing has to be added to give the vring state to the backend at the startup.

---
 hw/virtio/vhost.c | 5 -----
 1 file changed, 5 deletions(-)
hw/virtio/vhost.c +0 -5
index 1794f0d..870cd12 100644
@@ -1226,11 +1226,6 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
         }
     }
 
-    if (hdev->vhost_ops->vhost_set_vring_enable) {
-        /* only enable first vq pair by default */
-        hdev->vhost_ops->vhost_set_vring_enable(hdev, hdev->vq_index == 0);
-    }
-
     return 0;
 fail_log:
     vhost_log_put(hdev, false);
Signature · 1 line
2.1.4

Yes - and I'm beginning to think that maybe we should revert all of 3a12f32229a then, for symmetry.

Yunnan, Victor - what do you think?

Signature · 1 line
MST
#3 lore raw

Re: [Qemu-devel] [PATCH for-2.5 1/1] vhost-user: do not send SET_VRING_ENABLE at start

Quoted 26 lines · Michael S. Tsirkin
Quoted 25 lines · Thibaut Collet

This patch reverts partially commit 3a12f32229a.

In case of live migration several queues can be enabled and not only the first one. So inform backend that only the first queue is enabled is wrong.

Since commit 7263a0ad7899 backend is already notified of the state of the vring through the vring attach operation. This function, called during the startup sequence, provides the correct state of the vring, even in case of live migration.

So nothing has to be added to give the vring state to the backend at the startup.

---
 hw/virtio/vhost.c | 5 -----
 1 file changed, 5 deletions(-)
hw/virtio/vhost.c +0 -0
index 1794f0d..870cd12 100644
@@ -1226,11 +1226,6 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
         }
     }
 
Quoted 14 lines
Quoted 10 lines
hw/virtio/vhost.c +0 -6
-    if (hdev->vhost_ops->vhost_set_vring_enable) {
-        /* only enable first vq pair by default */
-        hdev->vhost_ops->vhost_set_vring_enable(hdev, hdev->vq_index == 0);
-    }
-
     return 0;
 fail_log:
     vhost_log_put(hdev, false);
--

2.1.4

Yes - and I'm beginning to think that maybe we should revert all of 3a12f32229a then, for symmetry.

Keep the disable vring on the stop can be useful. For example if the VM is rebooted all the vring will be disabled and backend will avoid to send packet to the VM in this case (I am not sure the virtio ring address is always valid during a reboot and writingg data in this memory can cause unexpected behaviour in this case).

Quoted 4 lines

Yunnan, Victor - what do you think?

--
MST

#4 lore raw

Re: [Qemu-devel] [PATCH for-2.5 1/1] vhost-user: do not send SET_VRING_ENABLE at start

Quoted 42 lines · Thibaut Collet
Quoted 26 lines · Michael S. Tsirkin
Quoted 25 lines · Thibaut Collet

This patch reverts partially commit 3a12f32229a.

In case of live migration several queues can be enabled and not only the first one. So inform backend that only the first queue is enabled is wrong.

Since commit 7263a0ad7899 backend is already notified of the state of the vring through the vring attach operation. This function, called during the startup sequence, provides the correct state of the vring, even in case of live migration.

So nothing has to be added to give the vring state to the backend at the startup.

---
 hw/virtio/vhost.c | 5 -----
 1 file changed, 5 deletions(-)
hw/virtio/vhost.c +0 -0
index 1794f0d..870cd12 100644
@@ -1226,11 +1226,6 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
         }
     }
 
Quoted 14 lines
Quoted 10 lines
hw/virtio/vhost.c +0 -6
-    if (hdev->vhost_ops->vhost_set_vring_enable) {
-        /* only enable first vq pair by default */
-        hdev->vhost_ops->vhost_set_vring_enable(hdev, hdev->vq_index == 0);
-    }
-
     return 0;
 fail_log:
     vhost_log_put(hdev, false);
--

2.1.4

Yes - and I'm beginning to think that maybe we should revert all of 3a12f32229a then, for symmetry.

Quoted 5 lines

Keep the disable vring on the stop can be useful. For example if the VM is rebooted all the vring will be disabled and backend will avoid to send packet to the VM in this case (I am not sure the virtio ring address is always valid during a reboot and writingg data in this memory can cause unexpected behaviour in this case).

I think there's still some confusion:
writing memory can still happen even if you disable the ring since the TX ring is still processed so we write into the used ring.

We call GET_VRING_BASE on stop and that ensures rings are stopped.

Quoted 4 lines
Quoted 4 lines

Yunnan, Victor - what do you think?

--
MST

#5 lore raw

Re: [Qemu-devel] [PATCH for-2.5 1/1] vhost-user: do not send SET_VRING_ENABLE at start

Quoted 49 lines · Michael S. Tsirkin
Quoted 42 lines · Thibaut Collet
Quoted 26 lines · Michael S. Tsirkin
Quoted 25 lines · Thibaut Collet

This patch reverts partially commit 3a12f32229a.

In case of live migration several queues can be enabled and not only the first one. So inform backend that only the first queue is enabled is wrong.

Since commit 7263a0ad7899 backend is already notified of the state of the vring through the vring attach operation. This function, called during the startup sequence, provides the correct state of the vring, even in case of live migration.

So nothing has to be added to give the vring state to the backend at the startup.

---
 hw/virtio/vhost.c | 5 -----
 1 file changed, 5 deletions(-)
hw/virtio/vhost.c +0 -0
index 1794f0d..870cd12 100644
@@ -1226,11 +1226,6 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
         }
     }
 
Quoted 14 lines
Quoted 10 lines
hw/virtio/vhost.c +0 -6
-    if (hdev->vhost_ops->vhost_set_vring_enable) {
-        /* only enable first vq pair by default */
-        hdev->vhost_ops->vhost_set_vring_enable(hdev, hdev->vq_index == 0);
-    }
-
     return 0;
 fail_log:
     vhost_log_put(hdev, false);
--

2.1.4

Yes - and I'm beginning to think that maybe we should revert all of 3a12f32229a then, for symmetry.

Quoted 5 lines

Keep the disable vring on the stop can be useful. For example if the VM is rebooted all the vring will be disabled and backend will avoid to send packet to the VM in this case (I am not sure the virtio ring address is always valid during a reboot and writingg data in this memory can cause unexpected behaviour in this case).

Quoted 6 lines

I think there's still some confusion:
writing memory can still happen even if you disable the ring since the TX ring is still processed so we write into the used ring.

We call GET_VRING_BASE on stop and that ensures rings are stopped.

Yes, that's what I suggested first, which also makes the logic quite
simple: we use GET_VRING_BASE as the sign of vring stop. Intead of GET_VRING_BASE when protocol not negotiated, and SET_VRING_ENABLE when protocol is negotiated.

Michael, should I submit a revert patch, or you could do it directly?

	--yliu
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Yunnan, Victor - what do you think?

--
MST

#6 lore raw

Re: [Qemu-devel] [PATCH for-2.5 1/1] vhost-user: do not send SET_VRING_ENABLE at start

Quoted 57 lines · Yuanhan Liu
Quoted 49 lines · Michael S. Tsirkin
Quoted 42 lines · Thibaut Collet
Quoted 26 lines · Michael S. Tsirkin
Quoted 25 lines · Thibaut Collet

This patch reverts partially commit 3a12f32229a.

In case of live migration several queues can be enabled and not only the first one. So inform backend that only the first queue is enabled is wrong.

Since commit 7263a0ad7899 backend is already notified of the state of the vring through the vring attach operation. This function, called during the startup sequence, provides the correct state of the vring, even in case of live migration.

So nothing has to be added to give the vring state to the backend at the startup.

---
 hw/virtio/vhost.c | 5 -----
 1 file changed, 5 deletions(-)
hw/virtio/vhost.c +0 -0
index 1794f0d..870cd12 100644
@@ -1226,11 +1226,6 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
         }
     }
 
Quoted 14 lines
Quoted 10 lines
hw/virtio/vhost.c +0 -6
-    if (hdev->vhost_ops->vhost_set_vring_enable) {
-        /* only enable first vq pair by default */
-        hdev->vhost_ops->vhost_set_vring_enable(hdev, hdev->vq_index == 0);
-    }
-
     return 0;
 fail_log:
     vhost_log_put(hdev, false);
--

2.1.4

Yes - and I'm beginning to think that maybe we should revert all of 3a12f32229a then, for symmetry.

Quoted 5 lines

Keep the disable vring on the stop can be useful. For example if the VM is rebooted all the vring will be disabled and backend will avoid to send packet to the VM in this case (I am not sure the virtio ring address is always valid during a reboot and writingg data in this memory can cause unexpected behaviour in this case).

Quoted 6 lines

I think there's still some confusion:
writing memory can still happen even if you disable the ring since the TX ring is still processed so we write into the used ring.

We call GET_VRING_BASE on stop and that ensures rings are stopped.

Quoted 8 lines

Yes, that's what I suggested first, which also makes the logic quite
simple: we use GET_VRING_BASE as the sign of vring stop. Intead of GET_VRING_BASE when protocol not negotiated, and SET_VRING_ENABLE when protocol is negotiated.

Michael, should I submit a revert patch, or you could do it directly?

	--yliu

I can handle it.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Yunnan, Victor - what do you think?

--
MST

#7 lore raw

Re: [Qemu-devel] [PATCH for-2.5 1/1] vhost-user: do not send SET_VRING_ENABLE at start

Quoted 63 lines · Michael S. Tsirkin
Quoted 62 lines · Yuanhan Liu
Quoted 49 lines · Michael S. Tsirkin
Quoted 42 lines · Thibaut Collet
Quoted 26 lines · Michael S. Tsirkin
Quoted 25 lines · Thibaut Collet

This patch reverts partially commit 3a12f32229a.

In case of live migration several queues can be enabled and not only the first one. So inform backend that only the first queue is enabled is wrong.

Since commit 7263a0ad7899 backend is already notified of the state of the vring through the vring attach operation. This function, called during the startup sequence, provides the correct state of the vring, even in case of live migration.

So nothing has to be added to give the vring state to the backend at the startup.

---
 hw/virtio/vhost.c | 5 -----
 1 file changed, 5 deletions(-)
hw/virtio/vhost.c +0 -0
index 1794f0d..870cd12 100644
@@ -1226,11 +1226,6 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
         }
     }
 
Quoted 14 lines
Quoted 10 lines
hw/virtio/vhost.c +0 -6
-    if (hdev->vhost_ops->vhost_set_vring_enable) {
-        /* only enable first vq pair by default */
-        hdev->vhost_ops->vhost_set_vring_enable(hdev, hdev->vq_index == 0);
-    }
-
     return 0;
 fail_log:
     vhost_log_put(hdev, false);
--

2.1.4

Yes - and I'm beginning to think that maybe we should revert all of 3a12f32229a then, for symmetry.

Quoted 5 lines

Keep the disable vring on the stop can be useful. For example if the VM is rebooted all the vring will be disabled and backend will avoid to send packet to the VM in this case (I am not sure the virtio ring address is always valid during a reboot and writingg data in this memory can cause unexpected behaviour in this case).

Quoted 6 lines

I think there's still some confusion:
writing memory can still happen even if you disable the ring since the TX ring is still processed so we write into the used ring.

We call GET_VRING_BASE on stop and that ensures rings are stopped.

Yes, that's what I suggested first, which also makes the logic quite
simple: we use GET_VRING_BASE as the sign of vring stop. Intead of GET_VRING_BASE when protocol not negotiated, and SET_VRING_ENABLE when protocol is negotiated.

Quoted 6 lines
Quoted 3 lines

Michael, should I submit a revert patch, or you could do it directly?

      --yliu

I can handle it.

The patch must be completly reverted. There are too an issue with suspend/resume operations.
On the suspend the dev_stop is called that will disable all the vrings. On the resume the dev_start is called but not the peer_attach (vring is already attached) and state of the vring is not provided to the backend.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Yunnan, Victor - what do you think?

--
MST

#8 lore raw

Re: [Qemu-devel] [PATCH for-2.5 1/1] vhost-user: do not send SET_VRING_ENABLE at start

Quoted 71 lines · Thibaut Collet
Quoted 63 lines · Michael S. Tsirkin
Quoted 62 lines · Yuanhan Liu
Quoted 49 lines · Michael S. Tsirkin
Quoted 42 lines · Thibaut Collet
Quoted 26 lines · Michael S. Tsirkin
Quoted 25 lines · Thibaut Collet

This patch reverts partially commit 3a12f32229a.

In case of live migration several queues can be enabled and not only the first one. So inform backend that only the first queue is enabled is wrong.

Since commit 7263a0ad7899 backend is already notified of the state of the vring through the vring attach operation. This function, called during the startup sequence, provides the correct state of the vring, even in case of live migration.

So nothing has to be added to give the vring state to the backend at the startup.

---
 hw/virtio/vhost.c | 5 -----
 1 file changed, 5 deletions(-)
hw/virtio/vhost.c +0 -0
index 1794f0d..870cd12 100644
@@ -1226,11 +1226,6 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
         }
     }
 
Quoted 14 lines
Quoted 10 lines
hw/virtio/vhost.c +0 -6
-    if (hdev->vhost_ops->vhost_set_vring_enable) {
-        /* only enable first vq pair by default */
-        hdev->vhost_ops->vhost_set_vring_enable(hdev, hdev->vq_index == 0);
-    }
-
     return 0;
 fail_log:
     vhost_log_put(hdev, false);
--

2.1.4

Yes - and I'm beginning to think that maybe we should revert all of 3a12f32229a then, for symmetry.

Quoted 5 lines

Keep the disable vring on the stop can be useful. For example if the VM is rebooted all the vring will be disabled and backend will avoid to send packet to the VM in this case (I am not sure the virtio ring address is always valid during a reboot and writingg data in this memory can cause unexpected behaviour in this case).

Quoted 6 lines

I think there's still some confusion:
writing memory can still happen even if you disable the ring since the TX ring is still processed so we write into the used ring.

We call GET_VRING_BASE on stop and that ensures rings are stopped.

Yes, that's what I suggested first, which also makes the logic quite
simple: we use GET_VRING_BASE as the sign of vring stop. Intead of GET_VRING_BASE when protocol not negotiated, and SET_VRING_ENABLE when protocol is negotiated.

Quoted 6 lines
Quoted 3 lines

Michael, should I submit a revert patch, or you could do it directly?

      --yliu

I can handle it.

Quoted 6 lines

The patch must be completly reverted. There are too an issue with suspend/resume operations.
On the suspend the dev_stop is called that will disable all the vrings. On the resume the dev_start is called but not the peer_attach (vring is already attached) and state of the vring is not provided to the backend.

OK, I queued up a revert. Thanks!

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Yunnan, Victor - what do you think?

--
MST