From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43392) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TiYSh-0001nJ-JH for qemu-devel@nongnu.org; Tue, 11 Dec 2012 17:38:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TiYSg-0003OX-Dt for qemu-devel@nongnu.org; Tue, 11 Dec 2012 17:38:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35730) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TiYSg-0003OT-6E for qemu-devel@nongnu.org; Tue, 11 Dec 2012 17:38:02 -0500 Message-ID: <50C7B64B.1010301@redhat.com> Date: Tue, 11 Dec 2012 23:40:11 +0100 From: Hans de Goede MIME-Version: 1.0 References: <3e1838e9.148d6.13b8b801db6.Coremail.luo_brian@126.com> In-Reply-To: <3e1838e9.148d6.13b8b801db6.Coremail.luo_brian@126.com> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Performance of usb tablet over ehci List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: luo_brian Cc: qemu-devel@nongnu.org Hi, On 12/11/2012 08:45 PM, luo_brian wrote: > 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-table! t2, 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? Given that the cpu-load with the usb-tablet almost halved I think the patches are working as intended and your config is ok :) My tests were run with a Linux guest (with the udev rule for enabling usb remote wakeup disabled), it is possible that Windows uses the HID idle report feature which would still cause some wakeups. Also note that if you actually move the mouse over the vm window this will temporarily increase the wakeup rate too. In the end the problem stays that usb uses a polling model versus the async interrupt model ps2 uses. Regards, Hans