From: Alex Williamson <alex.williamson@redhat.com>
To: Longfang Liu <liulongfang@huawei.com>
Cc: <jgg@nvidia.com>, <shameerali.kolothum.thodi@huawei.com>,
<jonathan.cameron@huawei.com>, <kvm@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <linuxarm@openeuler.org>
Subject: Re: [PATCH v6 5/5] hisi_acc_vfio_pci: bugfix live migration function without VF device driver
Date: Fri, 21 Mar 2025 09:52:40 -0600 [thread overview]
Message-ID: <20250321095240.40bf55ec.alex.williamson@redhat.com> (raw)
In-Reply-To: <20250318064548.59043-6-liulongfang@huawei.com>
On Tue, 18 Mar 2025 14:45:48 +0800
Longfang Liu <liulongfang@huawei.com> wrote:
> If the VF device driver is not loaded in the Guest OS and we attempt to
> perform device data migration, the address of the migrated data will
> be NULL.
> The live migration recovery operation on the destination side will
> access a null address value, which will cause access errors.
>
> Therefore, live migration of VMs without added VF device drivers
> does not require device data migration.
> In addition, when the queue address data obtained by the destination
> is empty, device queue recovery processing will not be performed.
>
> Fixes: b0eed085903e ("hisi_acc_vfio_pci: Add support for VFIO live migration")
> Signed-off-by: Longfang Liu <liulongfang@huawei.com>
> Reviewed-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
> ---
> .../vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 21 ++++++++++++-------
> 1 file changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> index cadc82419dca..68b1c7204cad 100644
> --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> @@ -426,13 +426,6 @@ static int vf_qm_check_match(struct hisi_acc_vf_core_device *hisi_acc_vdev,
> return -EINVAL;
> }
>
> - ret = qm_write_regs(vf_qm, QM_VF_STATE, &vf_data->vf_qm_state, 1);
> - if (ret) {
> - dev_err(dev, "failed to write QM_VF_STATE\n");
> - return ret;
> - }
> -
> - hisi_acc_vdev->vf_qm_state = vf_data->vf_qm_state;
> hisi_acc_vdev->match_done = true;
> return 0;
> }
> @@ -498,6 +491,13 @@ static int vf_qm_load_data(struct hisi_acc_vf_core_device *hisi_acc_vdev,
> if (migf->total_length < sizeof(struct acc_vf_data))
> return -EINVAL;
>
> + ret = qm_write_regs(qm, QM_VF_STATE, &vf_data->vf_qm_state, 1);
> + if (ret) {
> + dev_err(dev, "failed to write QM_VF_STATE\n");
> + return -EINVAL;
> + }
> + hisi_acc_vdev->vf_qm_state = vf_data->vf_qm_state;
> +
> qm->eqe_dma = vf_data->eqe_dma;
> qm->aeqe_dma = vf_data->aeqe_dma;
> qm->sqc_dma = vf_data->sqc_dma;
> @@ -506,6 +506,12 @@ static int vf_qm_load_data(struct hisi_acc_vf_core_device *hisi_acc_vdev,
> qm->qp_base = vf_data->qp_base;
> qm->qp_num = vf_data->qp_num;
>
> + if (!vf_data->eqe_dma || !vf_data->aeqe_dma ||
> + !vf_data->sqc_dma || !vf_data->cqc_dma) {
> + dev_err(dev, "resume dma addr is NULL!\n");
> + return -EINVAL;
> + }
> +
I'm not sure how this fits in based on the commit log. IIUC, we're
actually rejecting the migration data here, which will cause a
migration failure. We're also testing the validity of the data *after*
we've actually applied it to the hisi_qm object, which seems backwards.
Are we just not processing the migration data because there's no driver
or are we failing the migration? There shouldn't be a requirement on
the state of the guest driver for a successful migration. Thanks,
Alex
> ret = qm_set_regs(qm, vf_data);
> if (ret) {
> dev_err(dev, "set VF regs failed\n");
> @@ -1531,6 +1537,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);
> mutex_init(&hisi_acc_vdev->open_mutex);
>
next prev parent reply other threads:[~2025-03-21 15:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-18 6:45 [PATCH v6 0/5] bugfix some driver issues Longfang Liu
2025-03-18 6:45 ` [PATCH v6 1/5] hisi_acc_vfio_pci: fix XQE dma address error Longfang Liu
2025-03-21 9:09 ` liulongfang
2025-03-21 15:51 ` Alex Williamson
2025-03-28 8:04 ` liulongfang
2025-03-28 14:03 ` Alex Williamson
2025-03-18 6:45 ` [PATCH v6 2/5] hisi_acc_vfio_pci: add eq and aeq interruption restore Longfang Liu
2025-03-18 6:45 ` [PATCH v6 3/5] hisi_acc_vfio_pci: bugfix cache write-back issue Longfang Liu
2025-03-18 6:45 ` [PATCH v6 4/5] hisi_acc_vfio_pci: bugfix the problem of uninstalling driver Longfang Liu
2025-03-21 15:51 ` Alex Williamson
2025-03-28 8:06 ` liulongfang
2025-03-18 6:45 ` [PATCH v6 5/5] hisi_acc_vfio_pci: bugfix live migration function without VF device driver Longfang Liu
2025-03-21 15:52 ` Alex Williamson [this message]
2025-03-28 8:28 ` liulongfang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250321095240.40bf55ec.alex.williamson@redhat.com \
--to=alex.williamson@redhat.com \
--cc=jgg@nvidia.com \
--cc=jonathan.cameron@huawei.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@openeuler.org \
--cc=liulongfang@huawei.com \
--cc=shameerali.kolothum.thodi@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.