Skip to contentSkip to conversation

vdpa/ifc: fix reconnetion issue in SW assisted live migration

PATCH Applied Andy Pei 2 participants 3 messages Dec 12, 2022 – Feb 3, 2023 virtio core

lore
Share & tools
lore

Andy Pei

author
#0 lore raw

PATCH 1/1 vdpa/ifc: fix reconnetion issue in SW assisted live migration

In the case using argument "sw-live-migration=1" to enable SW assisted live migration, we take QEMU as front end for example, after source VM migrates to destination VM, we keep vdpa process for source VM there, we kill the QEMU process for source VM, and restart the QEMU process for source VM. In this case, vdpa driver will not perform DMA map and data path will not work properly.

The above case works fine in the case "sw-live-migration=0".

The root cause is that current code driver does not set running flag to 0. Driver treats device as ruuning and does not perform DMA map.

Fixes 4bb531e152d3 ("net/ifc: support SW assisted VDPA live migration")
---
 drivers/vdpa/ifc/ifcvf_vdpa.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/vdpa/ifc/ifcvf_vdpa.c +2 -0
index 49d68ad..dc8600d 100644
@@ -1044,6 +1044,8 @@ struct rte_vdpa_dev_info {
 
 	vdpa_disable_vfio_intr(internal);
 
+	rte_atomic32_set(&internal->running, 0);
+
 	ret = rte_vhost_host_notifier_ctrl(vid, RTE_VHOST_QUEUE_ALL, false);
 	if (ret && ret != -ENOTSUP)
 		goto error;
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 25 lines · Andy Pei

In the case using argument "sw-live-migration=1" to enable SW assisted live migration, we take QEMU as front end for example, after source VM migrates to destination VM, we keep vdpa process for source VM there, we kill the QEMU process for source VM, and restart the QEMU process for source VM. In this case, vdpa driver will not perform DMA map and data path will not work properly.

The above case works fine in the case "sw-live-migration=0".

The root cause is that current code driver does not set running flag to 0. Driver treats device as ruuning and does not perform DMA map.

Fixes 4bb531e152d3 ("net/ifc: support SW assisted VDPA live migration")
---
  drivers/vdpa/ifc/ifcvf_vdpa.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/vdpa/ifc/ifcvf_vdpa.c +0 -0
index 49d68ad..dc8600d 100644

drivers/vdpa/ifc/ifcvf_vdpa.c struct rte_vdpa_dev_info { · line 1051

Quoted 8 lines
drivers/vdpa/ifc/ifcvf_vdpa.c +2 -0
@@ -1044,6 +1044,8 @@ struct rte_vdpa_dev_info {
 
  	vdpa_disable_vfio_intr(internal);
 
+	rte_atomic32_set(&internal->running, 0);
+
  	ret = rte_vhost_host_notifier_ctrl(vid, RTE_VHOST_QUEUE_ALL, false);
  	if (ret && ret != -ENOTSUP)
  		goto error;

Thanks,
Maxime

#2 lore raw
In reply to Andy Pei
Quoted 25 lines · Andy Pei

In the case using argument "sw-live-migration=1" to enable SW assisted live migration, we take QEMU as front end for example, after source VM migrates to destination VM, we keep vdpa process for source VM there, we kill the QEMU process for source VM, and restart the QEMU process for source VM. In this case, vdpa driver will not perform DMA map and data path will not work properly.

The above case works fine in the case "sw-live-migration=0".

The root cause is that current code driver does not set running flag to 0. Driver treats device as ruuning and does not perform DMA map.

Fixes 4bb531e152d3 ("net/ifc: support SW assisted VDPA live migration")
---
  drivers/vdpa/ifc/ifcvf_vdpa.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/vdpa/ifc/ifcvf_vdpa.c +0 -0
index 49d68ad..dc8600d 100644

drivers/vdpa/ifc/ifcvf_vdpa.c struct rte_vdpa_dev_info { · line 1051

Quoted 8 lines
drivers/vdpa/ifc/ifcvf_vdpa.c +2 -0
@@ -1044,6 +1044,8 @@ struct rte_vdpa_dev_info {
 
  	vdpa_disable_vfio_intr(internal);
 
+	rte_atomic32_set(&internal->running, 0);
+
  	ret = rte_vhost_host_notifier_ctrl(vid, RTE_VHOST_QUEUE_ALL, false);
  	if (ret && ret != -ENOTSUP)
  		goto error;

Applied to dpdk-next-virtio/main.

Thanks,
Maxime