I just noticed a patch recently submitted to qemu, attempting to lower the cpu 
load for idle vm using usb tablet emulation.

This is the comment of commit 427e3aa151c749225364d0c30640e2e3c1756d9d:

usb-tablet: Allow connecting to ehci

Our ehci code has is capable of significantly lowering the wakeup rate
for the hcd emulation while the device is idle. It is possible to add
similar code ot the uhci emulation, but that simply is not there atm,
and there is no reason why a (virtual) usb-tablet can not be a USB-2 device.

Making usb-hid devices connect to the emulated ehci controller instead
of the emulated uhci controller on vms which have both lowers the cpuload
for a fully idle vm from 20% to 2-3% (on my laptop).

An alternative implementation to using a property to select the tablet
type, would be simply making it a new device type, ie usb-tablet2, but the
downside of that is that this will require libvirt changes to be available
through libvirt at all, and then management tools changes to become the
default for new vms, where as using a property will automatically get
any pc-1.3 type vms the lower cpuload.

I tried to connect usb tablet to ehci by libvirt, which automatically generted 
qemu command as follows. However, the cpuload of idle vm is still much higher 
than PS2 mouse emulation on my laptop. (usb-tablet: 30-35%, usb-tablet2: 
16-19%, PS2 mouse: 9-10%). Is there something wrong with my configuration?

 57         <controller type='usb' index='0' model='ehci'/>
 58         <input type='tablet' bus='usb'>
 59             <address type='usb' bus='0' port='1'/>
 60         </input>


/usr/bin/qemu-kvm -name winxp -S -cpu host -enable-kvm -m 1024 -smp 
2,sockets=2,cores=1,threads=1 -uuid 883d614a-30e9-474d-b81e-c131e4a06249 
-no-user-config -nodefaults -chardev 
socket,id=charmonitor,path=/var/lib/libvirt/qemu/winxp.monitor,server,nowait 
-mon chardev=charmonitor,id=monitor,mode=control -rtc base=localtime 
-no-shutdown -device usb-ehci,id=usb,bus=pci.0,addr=0x5 -device 
virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 -drive 
file=/home/vm/winxp/winxp.img,if=none,id=drive-virtio-disk0,format=qcow2,cache=none,aio=native
 -device 
virtio-blk-pci,scsi=off,bus=pci.0,addr=0x7,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1
 -netdev tap,fd=23,id=hostnet0,vhost=on,vhostfd=24 -device 
virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:65:f3:de,bus=pci.0,addr=0x3 
-chardev spicevmc,id=charchannel0,name=vdagent -device 
virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0
 -device usb-tablet,id=input0,bus=usb.0,port=1 -spice 
port=5900,addr=0.0.0.0,disable-ticketing,seamless-migration=on -vga qxl -global 
qxl-vga.vram_size=67108864 -device AC97,id=sound0,bus=pci.0,addr=0x4

Reply via email to