nutanix / libvfio-user

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

Fix DMA message size calculation #788

Closed mnissler-rivos closed 10 months ago

mnissler-rivos commented 10 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 10 months ago

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

jlevon commented 10 months ago

arch appears to be fundamentally unstable, see #770

jlevon commented 10 months ago

please add your signed-off-by

jlevon commented 10 months ago

LGTM otherwise

mnissler-rivos commented 10 months ago

Thanks for the quick reply!

please add your signed-off-by

Gah, my favorite mistake. Fixed now.

mnissler-rivos commented 10 months ago

Thanks for the quick turnaround, much appreciated!