vhost-user: live migration with multiqueue fails
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
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
@@ -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
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
7263a0ad7899backend 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.
Signed-off-by Thibaut Collet <[email protected]>--- hw/virtio/vhost.c | 5 ----- 1 file changed, 5 deletions(-)hw/virtio/vhost.c +0
-5@@ -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
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
7263a0ad7899backend 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.
Signed-off-by Thibaut Collet <[email protected]>--- hw/virtio/vhost.c | 5 ----- 1 file changed, 5 deletions(-)hw/virtio/vhost.c +0
-0@@ -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
3a12f32229athen, 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
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
7263a0ad7899backend 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.
Signed-off-by Thibaut Collet <[email protected]>--- hw/virtio/vhost.c | 5 ----- 1 file changed, 5 deletions(-)hw/virtio/vhost.c +0
-0@@ -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
3a12f32229athen, 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
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
7263a0ad7899backend 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.
Signed-off-by Thibaut Collet <[email protected]>--- hw/virtio/vhost.c | 5 ----- 1 file changed, 5 deletions(-)hw/virtio/vhost.c +0
-0@@ -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
3a12f32229athen, 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_BASEon 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
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
7263a0ad7899backend 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.
Signed-off-by Thibaut Collet <[email protected]>--- hw/virtio/vhost.c | 5 ----- 1 file changed, 5 deletions(-)hw/virtio/vhost.c +0
-0@@ -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
3a12f32229athen, 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_BASEon 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 useGET_VRING_BASEas the sign of vring stop. Intead ofGET_VRING_BASEwhen protocol not negotiated, andSET_VRING_ENABLEwhen 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
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
7263a0ad7899backend 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.
Signed-off-by Thibaut Collet <[email protected]>--- hw/virtio/vhost.c | 5 ----- 1 file changed, 5 deletions(-)hw/virtio/vhost.c +0
-0@@ -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
3a12f32229athen, 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_BASEon stop and that ensures rings are stopped.Yes, that's what I suggested first, which also makes the logic quite
simple: we useGET_VRING_BASEas the sign of vring stop. Intead ofGET_VRING_BASEwhen protocol not negotiated, andSET_VRING_ENABLEwhen protocol is negotiated.
Quoted 6 lines
Quoted 3 lines
Michael, should I submit a revert patch, or you could do it directly?
--yliuI 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
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
7263a0ad7899backend 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.
Signed-off-by Thibaut Collet <[email protected]>--- hw/virtio/vhost.c | 5 ----- 1 file changed, 5 deletions(-)hw/virtio/vhost.c +0
-0@@ -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
3a12f32229athen, 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_BASEon stop and that ensures rings are stopped.Yes, that's what I suggested first, which also makes the logic quite
simple: we useGET_VRING_BASEas the sign of vring stop. Intead ofGET_VRING_BASEwhen protocol not negotiated, andSET_VRING_ENABLEwhen protocol is negotiated.Quoted 6 lines
Quoted 3 lines
Michael, should I submit a revert patch, or you could do it directly?
--yliuI can handle it.
Quoted 6 lines
The patch must be completly reverted. There are too an issue with suspend/resume operations.
On the suspend thedev_stopis called that will disable all the vrings. On the resume thedev_startis called but not thepeer_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