Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vfio/mlx5: consider inflight SAVE during PRE_COPY

Consider an inflight SAVE operation during the PRE_COPY phase, so the
caller will wait when no data is currently available but is expected
to arrive.

This enables a follow-up patch to avoid returning -ENOMSG while a new
*initial_bytes* chunk is still pending from an asynchronous SAVE command
issued by the VFIO_MIG_GET_PRECOPY_INFO ioctl.

Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Link: https://lore.kernel.org/r/20260317161753.18964-6-yishaih@nvidia.com
Signed-off-by: Alex Williamson <alex@shazbot.org>

authored by

Yishai Hadas and committed by
Alex Williamson
bd0da611 4bee09a5

+8 -1
+5
drivers/vfio/pci/mlx5/cmd.c
··· 606 606 mlx5vf_save_callback_complete(struct mlx5_vf_migration_file *migf, 607 607 struct mlx5vf_async_data *async_data) 608 608 { 609 + migf->inflight_save = 0; 610 + wake_up_interruptible(&migf->poll_wait); 609 611 kvfree(async_data->out); 610 612 complete(&migf->save_comp); 611 613 fput(migf->filp); ··· 811 809 812 810 async_data->header_buf = header_buf; 813 811 get_file(migf->filp); 812 + migf->inflight_save = 1; 814 813 err = mlx5_cmd_exec_cb(&migf->async_ctx, in, sizeof(in), 815 814 async_data->out, 816 815 out_size, mlx5vf_save_callback, ··· 822 819 return 0; 823 820 824 821 err_exec: 822 + migf->inflight_save = 0; 823 + wake_up_interruptible(&migf->poll_wait); 825 824 if (header_buf) 826 825 mlx5vf_put_data_buffer(header_buf); 827 826 fput(migf->filp);
+1
drivers/vfio/pci/mlx5/cmd.h
··· 111 111 struct completion save_comp; 112 112 struct mlx5_async_ctx async_ctx; 113 113 struct mlx5vf_async_data async_data; 114 + u8 inflight_save:1; 114 115 }; 115 116 116 117 struct mlx5_vhca_cq_buf {
+2 -1
drivers/vfio/pci/mlx5/main.c
··· 179 179 !list_empty(&migf->buf_list) || 180 180 migf->state == MLX5_MIGF_STATE_ERROR || 181 181 migf->state == MLX5_MIGF_STATE_PRE_COPY_ERROR || 182 - migf->state == MLX5_MIGF_STATE_PRE_COPY || 182 + (migf->state == MLX5_MIGF_STATE_PRE_COPY && 183 + !migf->inflight_save) || 183 184 migf->state == MLX5_MIGF_STATE_COMPLETE)) 184 185 return -ERESTARTSYS; 185 186 }