summaryrefslogtreecommitdiff
path: root/drivers/vfio/pci/mlx5/cmd.h
diff options
context:
space:
mode:
authorYishai Hadas <yishaih@nvidia.com>2022-12-06 10:34:35 +0200
committerAlex Williamson <alex.williamson@redhat.com>2022-12-06 12:36:44 -0700
commit81156c27271c4a6c594e492c8d119fbacfc99f36 (patch)
tree3d2f833108af4dff6c6b7c3cf95bc44f6f8b8ea7 /drivers/vfio/pci/mlx5/cmd.h
parent0dce165b1adf8d7f67030bb257e00107db8022de (diff)
downloadlwn-81156c27271c4a6c594e492c8d119fbacfc99f36.tar.gz
lwn-81156c27271c4a6c594e492c8d119fbacfc99f36.zip
vfio/mlx5: Consider temporary end of stream as part of PRE_COPY
During PRE_COPY the migration data FD may have a temporary "end of stream" that is reached when the initial_bytes were read and no other dirty data exists yet. For instance, this may indicate that the device is idle and not currently dirtying any internal state. When read() is done on this temporary end of stream the kernel driver should return ENOMSG from read(). Userspace can wait for more data or consider moving to STOP_COPY. To not block the user upon read() and let it get ENOMSG we add a new state named MLX5_MIGF_STATE_PRE_COPY on the migration file. In addition, we add the MLX5_MIGF_STATE_SAVE_LAST state to block the read() once we call the last SAVE upon moving to STOP_COPY. Any further error will be marked with MLX5_MIGF_STATE_ERROR and the user won't be blocked. Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Yishai Hadas <yishaih@nvidia.com> Link: https://lore.kernel.org/r/20221206083438.37807-12-yishaih@nvidia.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio/pci/mlx5/cmd.h')
-rw-r--r--drivers/vfio/pci/mlx5/cmd.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/vfio/pci/mlx5/cmd.h b/drivers/vfio/pci/mlx5/cmd.h
index 3e36ccca820a..d048f23977dd 100644
--- a/drivers/vfio/pci/mlx5/cmd.h
+++ b/drivers/vfio/pci/mlx5/cmd.h
@@ -17,6 +17,8 @@
enum mlx5_vf_migf_state {
MLX5_MIGF_STATE_ERROR = 1,
+ MLX5_MIGF_STATE_PRE_COPY,
+ MLX5_MIGF_STATE_SAVE_LAST,
MLX5_MIGF_STATE_COMPLETE,
};