Bug 1791331

Summary: virtio-blk and virtio-scsi: set num-queues=num-vcpus by default
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Stefan Hajnoczi <stefanha>
Component: qemu-kvmAssignee: Stefan Hajnoczi <stefanha>
qemu-kvm sub component: virtio-blk,scsi QA Contact: qing.wang <qinwang>
Status: CLOSED DUPLICATE Docs Contact:
Severity: unspecified    
Priority: unspecified CC: jinzhao, juzhang, lijin, virt-maint
Version: 8.2   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-07-15 07:30:41 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Stefan Hajnoczi 2020-01-15 14:53:18 UTC
Description of problem:
SMP guests experience increased I/O latencies when the application submits a request on one vcpu and the completion interrupt is handled by another vcpu.  When this happens an Inter-Processor Interrupt (IPI) is required so the second vcpu can wake up the first vcpu.

Users can pin the application to specific vcpus to avoid IPIs, but a cleaner solution that does not involve manual configuration is virtio-blk/scsi multi-queue.

By providing additional virtqueues (one per vcpu) we avoid the need handle completion interrupts on a different vcpu.  Therefore IPIs are not needed and request latency is improved.

QEMU should set the -device virtio-blk,num-queues=N and -device virtio-scsi,num_queues=N properties to the number of vcpus by default.  This will result in additional MSI-X vectors being allocated but otherwise has no drawbacks.

How reproducible:
100%

Steps to Reproduce:
1. Launch a guest with 4 vcpus, latest machine type, one virtio-blk device, and one virtio-scsi device.
2. guest# ls /sys/block/vda/mq | wc -l
3. guest# ls /sys/block/sda/mq | wc -l

Actual results:
2. guest# ls /sys/block/vda/mq | wc -l
1
3. guest# ls /sys/block/sda/mq | wc -l
1

Expected results:
2. guest# ls /sys/block/vda/mq | wc -l
4
3. guest# ls /sys/block/sda/mq | wc -l
4

Comment 1 Stefan Hajnoczi 2020-01-16 11:02:18 UTC
Patches posted upstream:
https://lists.gnu.org/archive/html/qemu-devel/2020-01/msg03283.html

Comment 2 Ademar Reis 2020-02-05 23:12:46 UTC
QEMU has been recently split into sub-components and as a one-time operation to avoid breakage of tools, we are setting the QEMU sub-component of this BZ to "General". Please review and change the sub-component if necessary the next time you review this BZ. Thanks

Comment 5 RHEL Program Management 2021-07-15 07:30:41 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.

Comment 6 qing.wang 2021-07-26 09:51:49 UTC
QE agree to close same issue has been tracked by Bug 1827722 - virtio-blk and virtio-scsi multi-queue should be enabled by default

*** This bug has been marked as a duplicate of bug 1827722 ***