* Alex Williamson (alex.williamson@xxxxxxxxxx) wrote: > On Thu, 28 May 2020 04:01:02 -0400 > Yan Zhao <yan.y.zhao@xxxxxxxxx> wrote: > > > > > > This is my understanding of the protocol as well, when the device is > > > > > running, pending_bytes might drop to zero if no internal state has > > > > > changed and may be non-zero on the next iteration due to device > > > > > activity. When the device is not running, pending_bytes reporting zero > > > > > indicates the device is done, there is no further state to transmit. > > > > > Does that meet your need/expectation? > > > > > > > > > (1) on one side, as in vfio_save_pending(), > > > > vfio_save_pending() > > > > { > > > > ... > > > > ret = vfio_update_pending(vbasedev); > > > > ... > > > > *res_precopy_only += migration->pending_bytes; > > > > ... > > > > } > > > > the pending_bytes tells migration thread how much data is still hold in > > > > device side. > > > > the device data includes > > > > device internal data + running device dirty data + device state. > > > > > > > > so the pending_bytes should include device state as well, right? > > > > if so, the pending_bytes should never reach 0 if there's any device > > > > state to be sent after device is stopped. > > > > > > I hadn't expected the pending-bytes to include a fixed offset for device > > > state (If you mean a few registers etc) - I'd expect pending to drop > > > possibly to zero; the heuristic as to when to switch from iteration to > > > stop, is based on the total pending across all iterated devices; so it's > > > got to be allowed to drop otherwise you'll never transition to stop. > > > > > ok. got it. > > Yeah, as I understand it, a device is not required to participate in > reporting data available while (_SAVING | _RUNNING), there will always > be an iteration while the device is !_RUNNING. Therefore if you have > fixed device state that you're always going to send, it should only be > sent once when called during !_RUNNING. The iterative phase should be > used where you have a good chance to avoid re-sending data at the > stop-and-copy phase. Thanks, Right. Dave > Alex -- Dr. David Alan Gilbert / dgilbert@xxxxxxxxxx / Manchester, UK