kvm with debian stable guest uses about 10% cpu on idle perf reports that most time spent in native_safe_halt 43,30% swapper [kernel.kallsyms] [k] native_safe_halt there is kvm command line from ps output (started from libvirt) /usr/bin/kvm -S -M pc-1.1 -enable-kvm -m 1024 -smp 1,sockets=1,cores=1,threads=1 -name cups -uuid ecfcb338-bd8d-cb88-3f02-7a1e52b13609 -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/cups.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -kernel /var/lib/libvirt/qemu/dkb/vmlinuz-2.6.32-5-amd64 -initrd /var/lib/libvirt/qemu/dkb/initrd.img-2.6.32-5-amd64 -append root=UUID=398df502-1157-440c-ba88-6ec93d68b490 -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,addr=0x8 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x9 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0xa -drive file=/dev/second_volume_group/cups,if=none,id=drive-virtio-disk0,format=raw -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -netdev tap,fd=29,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:f0:b4:30,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -vnc 127.0.0.1:0 -vga cirrus -device usb-host,hostbus=1,hostaddr=7,id=hostdev0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6
19.02.2013 11:39, Alexander Kudrevatykh wrote: e v This is a well-known effect of using USB devices. USB spec requires for the machine to poll devices for (in)activity. So the guest pokes USB devices frequently -- for example for (virtual) mouse/tablet it does that 250 times per second. If we lower this value, guest mouse will be sluggish. There's a more or less workaround in later linux guests, an udev rule that allows qemu-emulated mouse/tablet/keyboard to enter (vurtual) sleep mode when not doing anything (the same as for real hardware), -- this takes care of CPU usage, but it makes mouse react slowly to the first event after some idle time, ie, when it got a chance to enter that sleep mode. Another workaround is to remove USB devices entirely (start the guest without any USB device but with USB bus), and (again, virtually) hot- plug any needed devices when the guest is actually in use (and hot- remove again when it isn't in use). This is how USB works, there's almost nothing else we can do about it. Tagging this bugreport as "wontfix" (and minor, since the bad effect is really minimal) instead of closing it right away - just to prevent other bugreports to be filed about this very issue. Thanks, /mjt
Hi, as I understand that udev workaround does not help with forwarded host usb devices? Is it possible manually reduce poll interval for usb device to reduce cpu usage? 2013/2/19 Michael Tokarev <mjt@tls.msk.ru>:
19.02.2013 13:11, Alexander Kudrevatykh wrote: Yes, it only works for qemu mouse/tablet. IIRC, the frequency is reported by the device itself. Thanks, /mjt