Some linux kernels has a performance flaw in virtio block device access.
On some frequent disk access patterns, e.g. 1M read, the kernel produces
more block requests than needed. This happens because of virtio seg_max
parameter set to 126 (virtqueue_size - 2) which limits the maximum block
request to 516096 (126 * 4096_PAGE_SIZE).

Setting seg_max > 126 fixes the issue, however, not all linux kernels
allow that. The old ones have a restriction virtqueue_size >= seg_max.
This restriction is hardcoded and the kernel crashes in case of violation.
The restriction is relaxed in the recent kernels. Windows kernels don't
have such a restriction.

To increse seg_max and not to break the restriction, one can increase the
virtqueue size to 256 and seg_max to 254. To do that, seabios support of
256 virtqueue size is needed.

Signed-off-by: Denis Plotnikov <dplotni...@virtuozzo.com>
---
 src/hw/virtio-ring.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/hw/virtio-ring.h b/src/hw/virtio-ring.h
index 8604a01..dccc50d 100644
--- a/src/hw/virtio-ring.h
+++ b/src/hw/virtio-ring.h
@@ -20,7 +20,7 @@
 #define VIRTIO_F_VERSION_1              32
 #define VIRTIO_F_IOMMU_PLATFORM         33
 
-#define MAX_QUEUE_NUM      (128)
+#define MAX_QUEUE_NUM      (256)
 
 #define VRING_DESC_F_NEXT  1
 #define VRING_DESC_F_WRITE 2
-- 
2.17.0
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-le...@seabios.org

Reply via email to