RE: [RFC v4 7/8] hisi_acc_vfio_pci: Add support for VFIO live migration

From: Shameerali Kolothum Thodi
Date: Thu Feb 10 2022 - 10:07:48 EST




> -----Original Message-----
> From: Alex Williamson [mailto:alex.williamson@xxxxxxxxxx]
> Sent: 09 February 2022 23:45
> To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@xxxxxxxxxx>
> Cc: kvm@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx;
> linux-crypto@xxxxxxxxxxxxxxx; jgg@xxxxxxxxxx; cohuck@xxxxxxxxxx;
> mgurtovoy@xxxxxxxxxx; yishaih@xxxxxxxxxx; Linuxarm
> <linuxarm@xxxxxxxxxx>; liulongfang <liulongfang@xxxxxxxxxx>; Zengtao (B)
> <prime.zeng@xxxxxxxxxxxxx>; Jonathan Cameron
> <jonathan.cameron@xxxxxxxxxx>; Wangzhou (B) <wangzhou1@xxxxxxxxxxxxx>
> Subject: Re: [RFC v4 7/8] hisi_acc_vfio_pci: Add support for VFIO live
> migration
>
> On Tue, 8 Feb 2022 13:34:24 +0000
> Shameer Kolothum <shameerali.kolothum.thodi@xxxxxxxxxx> wrote:
> > +
> > +static struct hisi_acc_vf_migration_file *
> > +hisi_acc_vf_stop_copy(struct hisi_acc_vf_core_device *hisi_acc_vdev)
> > +{
> > + struct hisi_qm *vf_qm = &hisi_acc_vdev->vf_qm;
> > + struct device *dev = &hisi_acc_vdev->vf_dev->dev;
> > + struct hisi_acc_vf_migration_file *migf;
> > + int ret;
> > +
> > + if (unlikely(qm_wait_dev_not_ready(vf_qm))) {
> > + dev_info(dev, "QM device not ready, no data to transfer\n");
> > + return 0;
> > + }
>
> This return value looks suspicious and I think would cause a segfault
> in the calling code:

Ah..Right!. I think I can move the above to the vf_qm_state_save()
and use migf->total_length to handle this.

Thanks,
Shameer