On 7/11/23 1:34 PM, Stefan Hajnoczi wrote: > On Sun, Jul 09, 2023 at 03:28:57PM -0500, Mike Christie wrote: >> The following patches were made over Linus's tree and fix an issue >> where windows guests will send iovecs with offset/lengths that result >> in IOs that are not aligned to 512. The LIO layer will then send them >> to Linux's FS/block layer but it requires 512 byte alignment, so >> depending on the FS/block driver being used we will get IO errors or >> hung IO. >> >> The following patches have vhost-scsi detect when windows sends these >> IOs and copy them to a bounce buffer. It then does some cleanup in >> the related code. > > Hang on, virtio-scsi is a SCSI HBA and READs/WRITEs submitted must > follow the usual constraints on SCSI block limits. Would Windows send > mis-aligned I/O to a non-virtio-scsi SCSI HBA? It's like linux where you can config settings like that. > > Are you sure this is not a bug in the Windows guest driver where block > limits are being misconfigured? >From what our windows dev told us the guest drivers like here: https://github.com/virtio-win don't set the windows AlignmentMask to 512. They tried that and it resulted in windows crash dump crashing because it doesn't like the hard alignment requirement. We thought other apps would have trouble as well, so we tried to add bounce buffer support to the windows driver, but I think people thought it was going to be uglier than this patch and in the normal alignment case might also affect performance. There was some windows driver/layering and buffer/cmd details that I don't fully understand and took their word for because I don't know a lot about windows. In the end we still have to add checks to vhost-scsi to protect against bad drivers, so we thought we might as well just add bounce buffer support to vhost-scsi.