]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: storvsc: Correct reporting of Hyper-V I/O size limits
authorSaurabh Sengar <ssengar@linux.microsoft.com>
Tue, 14 Jun 2022 07:05:55 +0000 (00:05 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 17 Jun 2022 01:36:03 +0000 (21:36 -0400)
commitf6b6c3f50c007cff87345226055b85ec1e1c692f
treee6da784892bae93d9d06aacde72d1b79a37c6d67
parent79c5dcaf43aacc743df7ba69c747e827db9c700d
scsi: storvsc: Correct reporting of Hyper-V I/O size limits

Current code is based on the idea that the max number of SGL entries
also determines the max size of an I/O request.  While this idea was
true in older versions of the storvsc driver when SGL entry length
was limited to 4 Kbytes, commit 4afe14ec1b50 ("scsi: storvsc: Enable
scatterlist entry lengths > 4Kbytes") removed that limitation. It's
now theoretically possible for the block layer to send requests that
exceed the maximum size supported by Hyper-V. This problem doesn't
currently happen in practice because the block layer defaults to a
512 Kbyte maximum, while Hyper-V in Azure supports 2 Mbyte I/O sizes.
But some future configuration of Hyper-V could have a smaller max I/O
size, and the block layer could exceed that max.

Fix this by correctly setting max_sectors as well as sg_tablesize to
reflect the maximum I/O size that Hyper-V reports. While allowing
I/O sizes larger than the block layer default of 512 Kbytes doesn’t
provide any noticeable performance benefit in the tests we ran, it's
still appropriate to report the correct underlying Hyper-V capabilities
to the Linux block layer.

Also tweak the virt_boundary_mask to reflect that the required
alignment derives from Hyper-V communication using a 4 Kbyte page size,
and not on the guest page size, which might be bigger (eg. ARM64).

Link: https://lore.kernel.org/r/1655190355-28722-1-git-send-email-ssengar@linux.microsoft.com
Fixes: 4afe14ec1b50 ("scsi: storvsc: Enable scatter list entry lengths > 4Kbytes")
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/storvsc_drv.c