From owner-freebsd-usb@FreeBSD.ORG Thu Mar 5 09:16:46 2009 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 998AE106566B for ; Thu, 5 Mar 2009 09:16:46 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe05.swip.net [212.247.154.129]) by mx1.freebsd.org (Postfix) with ESMTP id 01BC78FC08 for ; Thu, 5 Mar 2009 09:16:45 +0000 (UTC) (envelope-from hselasky@c2i.net) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.0 c=1 a=Ma5krZdYoiIA:10 a=-DXRHlJb_54A:10 a=j+k/Ze5hWUCaCztCgEjzDQ==:17 a=8kQB0OdkAAAA:8 a=XaIXT79Gmj2_LT1U-UcA:9 a=qdDE5R4bnGLJpbsx_cUPmLERMYQA:4 a=LY0hPdMaydYA:10 a=9aOQ2cSd83gA:10 a=677PiFX3TLVrf4Kp:21 a=ulGn1Pf6-kYNkCoK:21 Received: from [81.191.55.181] (account mc467741@c2i.net HELO laptop) by mailfe05.swip.net (CommuniGate Pro SMTP 5.2.6) with ESMTPA id 1102769279; Thu, 05 Mar 2009 10:16:44 +0100 From: Hans Petter Selasky To: Steve Calfee Date: Thu, 5 Mar 2009 10:19:14 +0100 User-Agent: KMail/1.9.7 References: <200903010045.44904.man@email.com.ua> <200903040922.48163.hselasky@c2i.net> <4a5ff6bc0903041418g1a26c046sbc7ae2459ba48044@mail.gmail.com> In-Reply-To: <4a5ff6bc0903041418g1a26c046sbc7ae2459ba48044@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903051019.14577.hselasky@c2i.net> Cc: freebsd-usb@freebsd.org Subject: Re: Low perfomance when read from usb flash drive X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Mar 2009 09:16:46 -0000 On Wednesday 04 March 2009, Steve Calfee wrote: > On Wed, Mar 4, 2009 at 12:22 AM, Hans Petter Selasky wrote: > > Hi Steve, > > > > On Tuesday 03 March 2009, Steve Calfee wrote: > >> > I think the reduced performance can be explained by a clamp on the > >> > interrupt rate around 1000 interrupts per second instead of 8000. > >> > Maybe someone has an explanation for this? > >> > > >> > The EHCI is being programmed to interrupt at 125us intervals, but > >> > there seems to be limits other places. > >> > > >> > It is possible to workaround this in the umass driver by doing the cmd > >> > + read in one operation. > >> > >> Hi Hans, > >> > >> I am looking at using FreeBSD in an embedded product. I have not > >> examined your ehci software, but I am aware of how Linux and other > >> OSes run the controller. > >> > >> Why are you taking an interrupt every uFrame SOF? > > > > If the transaction completes before 125us we take the interrupt before > > 125us. The problem is that the interrupt delay becomes critical to > > performance when the interrupt rate is close to the interrupt limitation. > Hi Steve, > Now the interesting question (for me a FreeBSD novice) is how does the > OS limit the number of interrupts? Usually they would be limited by > the available CPU power, and unlikely be limited to some arbitrary > number per second (1000 or 8000). Does FreeBSD run all interrupts out > of what Linux would call a bottom-half or tasklet? In that case > latency for sequential I/O in the 3 step scsi protocol could add up to > hurt you. I think there is no limit. It is the EHCI hardware that is responsible for limiting the IRQ rate. Usually it is limited by some bits in the command register like 1,2,4,8.. x 125us. I'm currently using 1x125us yielding max 8000 IRQs/second. The operating system is probably not the bottleneck in this case. It's something in the hardware hanging or waiting. --HPS