Commit 6976e22a authored by Longfang Liu's avatar Longfang Liu Committed by JangShui Yang
Browse files

migration: fix reference counting exception issue

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAUHWX


CVE: NA

----------------------------------------------------------------------

In a live migration scenario, if the number of VFs at the
destination is greater than that at the source, the recovery
operation will fail and qemu will not complete the process
of closing the device FD after exiting.
Causes the device reference count to be abnormal, causing
the driver to be unable to be uninstalled.

Therefore, it is necessary to supplement the device exit
operation when the device exits.

Fixes: 3344c0cc ("hisi-acc-vfio-pci:add DFX for acc migration driver")
Signed-off-by: default avatarLongfang liu <liulongfang@huawei.com>
Signed-off-by: default avatarJiangShui Yang <yangjiangshui@h-partners.com>
parent ab3f2869
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1679,6 +1679,7 @@ static void hisi_acc_vfio_pci_close_device(struct vfio_device *core_vdev)
	if (core_vdev->mig_ops)
		vf_debugfs_exit(hisi_acc_vdev);

	hisi_acc_vf_disable_fds(hisi_acc_vdev);
	iounmap(vf_qm->io_base);
	vfio_pci_core_close_device(core_vdev);
}
@@ -1699,6 +1700,7 @@ static int hisi_acc_vfio_pci_migrn_init_dev(struct vfio_device *core_vdev)
	hisi_acc_vdev->vf_id = pci_iov_vf_id(pdev) + 1;
	hisi_acc_vdev->pf_qm = pf_qm;
	hisi_acc_vdev->vf_dev = pdev;
	hisi_acc_vdev->vf_qm_state = QM_NOT_READY;
	mutex_init(&hisi_acc_vdev->state_mutex);

	core_vdev->migration_flags = VFIO_MIGRATION_STOP_COPY | VFIO_MIGRATION_PRE_COPY;