nutanix / libvfio-user

framework for emulating devices in userspace
BSD 3-Clause "New" or "Revised" License
154 stars 49 forks source link

Fix DMA message size calculation #788

Closed mnissler-rivos closed 6 months ago

mnissler-rivos commented 6 months ago

When performing DMA via VFIO-user commands over the socket, vfu_dma_transfer breaks large requests into chunks according to the client's maximum data transfer size negotiated at connection setup time. This change fixes the calculation of the chunk size for the case where the last chunk is less than the maximum transfer size.

Unfortunately, the existing test didn't catch this due to the request size being a multiple of that maximum data transfer size. Adjust the test to make the last chunk size a true remainder.

mnissler-rivos commented 6 months ago

FWIW, the arch-202307 failure looks unrelated to this change.

jlevon commented 6 months ago

arch appears to be fundamentally unstable, see #770

jlevon commented 6 months ago

please add your signed-off-by

jlevon commented 6 months ago

LGTM otherwise

mnissler-rivos commented 6 months ago

Thanks for the quick reply!

please add your signed-off-by

Gah, my favorite mistake. Fixed now.

mnissler-rivos commented 6 months ago

Thanks for the quick turnaround, much appreciated!