Skip to content

Commit 4928f67

Browse files
yishaihawilliam
authored andcommitted
vfio/mlx5: Fix the report of dirty_bytes upon pre-copy
Fix the report of dirty_bytes upon pre-copy to include both the existing data on the migration file and the device extra bytes. This gives a better close estimation to what can be passed any more as part of pre-copy. Fixes: 0dce165 ("vfio/mlx5: Introduce vfio precopy ioctl implementation") Signed-off-by: Yishai Hadas <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alex Williamson <[email protected]>
1 parent eeac8ed commit 4928f67

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

drivers/vfio/pci/mlx5/main.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -442,16 +442,10 @@ static long mlx5vf_precopy_ioctl(struct file *filp, unsigned int cmd,
442442
if (migf->pre_copy_initial_bytes > *pos) {
443443
info.initial_bytes = migf->pre_copy_initial_bytes - *pos;
444444
} else {
445-
buf = mlx5vf_get_data_buff_from_pos(migf, *pos, &end_of_data);
446-
if (buf) {
447-
info.dirty_bytes = buf->start_pos + buf->length - *pos;
448-
} else {
449-
if (!end_of_data) {
450-
ret = -EINVAL;
451-
goto err_migf_unlock;
452-
}
453-
info.dirty_bytes = inc_length;
454-
}
445+
info.dirty_bytes = migf->max_pos - *pos;
446+
if (!info.dirty_bytes)
447+
end_of_data = true;
448+
info.dirty_bytes += inc_length;
455449
}
456450

457451
if (!end_of_data || !inc_length) {

0 commit comments

Comments
 (0)