• Yishai Hadas's avatar
    vfio/mlx5: Pre-allocate chunks for the STOP_COPY phase · 5798e4dd
    Yishai Hadas authored
    This patch is another preparation step towards working in chunk mode.
    
    It pre-allocates chunks for the STOP_COPY phase to let the driver use
    them immediately and prevent an extra allocation upon that phase.
    
    Before that patch we had a single large buffer that was dedicated for
    the STOP_COPY phase as there was a single SAVE in the source for the
    last image.
    
    Once we'll move to chunk mode the idea is to have some small buffers
    that will be used upon the STOP_COPY phase.
    
    The driver will read-ahead from the firmware the full state in
    small/optimized chunks while letting QEMU/user space read in parallel
    the available data.
    
    Each buffer holds its chunk number to let it be recognized down the road
    in the coming patches.
    
    The chunk buffer size is picked-up based on the minimum size that
    firmware requires, the total full size and some max value in the driver
    code which was set to 8MB to achieve some optimized downtime in the
    general case.
    
    As the chunk mode is applicable even if we move directly to STOP_COPY
    the buffers preparation and some other related stuff is done
    unconditionally with regards to STOP/PRE-COPY.
    
    Note:
    In that phase in the series we still didn't activate the chunk mode and
    the first buffer will be used in all the places.
    Signed-off-by: default avatarYishai Hadas <yishaih@nvidia.com>
    Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
    Link: https://lore.kernel.org/r/20230911093856.81910-7-yishaih@nvidia.comSigned-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
    5798e4dd
cmd.c 43.9 KB