From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: high load with usb device Date: Tue, 14 Sep 2010 15:25:21 +0200 Message-ID: <4C8F77C1.90509@redhat.com> References: <4C80E839.50604@msgid.tls.msk.ru> <4C8A1AE3.8030705@redhat.com> <4C8A2187.1020202@msgid.tls.msk.ru> <4C8A59FE.9090400@msgid.tls.msk.ru> <4C8C9CAA.9030203@redhat.com> <4C8F1B54.60604@msgid.tls.msk.ru> <4C8F3B00.3000703@redhat.com> <4C8F3BA7.7060302@redhat.com> <4C8F47A1.4030600@msgid.tls.msk.ru> <4C8F497C.7000904@redhat.com> <4C8F4DA8.50606@msgid.tls.msk.ru> <4C8F50E1.3060704@redhat.com> <4C8F563E.6070701@msgid.tls.msk.ru> <4C8F757D.1010509@msgid.tls.msk.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: KVM list To: Michael Tokarev Return-path: Received: from mx1.redhat.com ([209.132.183.28]:12745 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752307Ab0INNZb (ORCPT ); Tue, 14 Sep 2010 09:25:31 -0400 In-Reply-To: <4C8F757D.1010509@msgid.tls.msk.ru> Sender: kvm-owner@vger.kernel.org List-ID: On 09/14/2010 03:15 PM, Michael Tokarev wrote: > > > >> - instrument calls to qemu_mod_timer() in hw/usb-*hci.c. Looks like > >> these are all 1kHz, but something else is clearly happening. > > Ok. There's nothing interesting going on there either, > apparently. > > It is using hw/usb-uhci.c. I added a few prints() in there, > but they're firing at the defined 1KHz frequency. > > Just for test, I lowered the frequency (FRAME_TIMER_FREQ) > from 1000 to 500, and the load dropped to half, from 19% > to 9..10%. > > Looking at what hw/usb-uhci.c:uhci_frame_timer() routine > does, it is quite expected to have that many writes and > reads and that many gettimers(). It is polling for events > every 1/1000th of a second, instead of using some form of > select(). > IIUC that's mandated by USB hardware. The guest may place data in memory, and USB polls it to see if it needs to tell send some message on the bus. Please post an strace again, this time with -e trace=select. Looks like each timer callback results in >50 syscalls, 4 of which are select()s). -- error compiling committee.c: too many arguments to function