Re: [PATCH v7 09/10] hisi_acc_vfio_pci: Add support for VFIO live migration
From: Jason Gunthorpe
Date: Thu Mar 03 2022 - 08:19:48 EST
On Thu, Mar 03, 2022 at 01:17:05PM +0000, Shameerali Kolothum Thodi wrote:
> > Tthere is a scenario that transfers only QM_MATCH_SIZE in stop_copy?
> > This doesn't seem like a good idea, I think you should transfer a
> > positive indication 'this device is not ready' instead of truncating
> > the stream. A truncated stream should not be a valid stream.
> >
> > ie always transfer the whole struct.
>
> We could add a 'qm_state' and return the whole struct. But the rest
> of the struct is basically invalid if qm_state = QM_NOT_REDAY.
This seems like the right thing to do to me
> > > Looks like setting the total_length = 0 in STOP_COPY is a better
> > > solution(If there are no other issues with that) as it will avoid
> > > grabbing the state_mutex as you mentioned above.
> >
> > That seems really weird, I wouldn't recommend doing that..
>
> Does that mean we don't support a zero data transfer in STOP_COPY?
total_length should not go backwards
> The concern is if we always transfer the whole struct, we end up reading
> and writing the whole thing even if most of the data is invalid.
Well, you can't know if the device is not ready or not until the
reaching STOP_COPY, so you have to transfer something to avoid
truncating the data stream. The state here is tiny, is the extra
transfer a real worry?
Jason