Bug 674562

Summary: disable vhost-net for rhel5 and older guests
Product: Red Hat Enterprise Linux 6 Reporter: Michael S. Tsirkin <mst>
Component: qemu-kvmAssignee: Michael S. Tsirkin <mst>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.0CC: akong, ehabkost, jasowang, mjenner, mkenneth, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.136.el6 Doc Type: Bug Fix
Doc Text:
Cause: older guests (RHEL 5 and older) don't support MSI. Consequence: vhost-net has higher CPU utilization than userspace virtio on guests that don't support MSI. Fix: disable vhost-net for non-MSI guests Consequence: non-MSI guests will use userspace virtio-net and get better performance than vhost-net.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 11:21:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 683295    
Bug Blocks:    

Description Michael S. Tsirkin 2011-02-02 14:13:06 UTC
before rhel6.0 virtio does not use msix.
When MSI is off, each interrupt needs to be bounced through the io
thread when it's set/cleared, so vhost-net causes more context switches and
higher CPU utilization than userspace virtio which handles networking in
the same thread.
    
We'll need to fix this by adding level irq support in kvm irqfd,
for now disable vhost-net in these configurations.

Comment 2 Martin Jenner 2011-02-02 16:20:00 UTC
Please provide some testing notes on how QE can effectively confirm/verify this fix is in applied correctly.

thanks,
Martin

Comment 3 Michael S. Tsirkin 2011-02-02 16:25:53 UTC
run some stress test.
when vhost-net is used, you will see
a vhost thread doing a lot of work.
without, work is done by qemu thread.

Comment 4 Michael S. Tsirkin 2011-02-02 16:27:01 UTC
so to clarify:
try this with rhel6 you will see vhost
try with rhel5 you will see no vhost
installs to be done with libvirt

Comment 8 Amos Kong 2011-02-19 09:10:51 UTC
# qemu-kvm -drive file='/mnt/linux/RHEL-Server-5.6-64-virtio.qcow2',index=0,if=none,id=drive-virtio-disk1,media=disk,cache=none,format=qcow2,aio=native,snapshot=on  -device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk1,id=virtio-disk1 -device virtio-net-pci,netdev=idqJrk0t,mac=9a:0c:2b:2e:ab:13,netdev=idqJrk0t,id=ndev00idqJrk0t,bus=pci.0,addr=0x3 -netdev tap,id=idqJrk0t,vhost=on,ifname='t0-165012-Ywsy',script='/usr/local/staf/test/RHEV/kvm-new/autotest/client/tests/kvm/scripts/qemu-ifup-switch',downscript='no',vhostforce=off ...

qemu: -netdev tap,id=idqJrk0t,vhost=on,ifname=t0-165012-Ywsy,script=/usr/local/staf/test/RHEV/kvm-new/autotest/client/tests/kvm/scripts/qemu-ifup-switch,downscript=no,vhostforce=off: Invalid parameter 'vhostforce'

vhostforce can't be used with '-netdev tap,...,forcevhost=off' ?

Currently forcevhost is 'on' by default, that means vhost will be enable for no-msi guest by default, is it expected?

Comment 9 Amos Kong 2011-03-09 02:17:27 UTC
After talked with Jason, I reported another bug, 
Bug 683295 - qemu-kvm: Invalid parameter 'vhostforce'

Comment 10 Amos Kong 2011-03-17 09:22:14 UTC
Boot up rhel4, rhel5, rhek6 with 'vhost=on', and check if vhost_net works by 
# perf top -p `pgrep vhost`

guest   works
-----   -----
rhel4   no
rhel5   no
rhel6   yes

qemu-kvm-0.12.1.2-2.150.el6.x86_64

So moving to VERIFIED.

Comment 11 Miya Chen 2011-04-13 04:23:17 UTC
*** Bug 670415 has been marked as a duplicate of this bug. ***

Comment 12 Eduardo Habkost 2011-05-03 19:29:23 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: older guests (RHEL 5 and older) don't support MSI.

Consequence: vhost-net has higher CPU utilization than userspace virtio on guests that don't support MSI.

Fix: disable vhost-net for non-MSI guests

Consequence: non-MSI guests will use userspace virtio-net and get better performance than vhost-net.

Comment 13 errata-xmlrpc 2011-05-19 11:21:33 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0534.html

Comment 14 errata-xmlrpc 2011-05-19 13:01:28 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0534.html