From owner-freebsd-usb@FreeBSD.ORG Tue Mar 3 21:41:07 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 9F52B106566C for ; Tue, 3 Mar 2009 21:41:07 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe03.swip.net [212.247.154.65]) by mx1.freebsd.org (Postfix) with ESMTP id 30F778FC18 for ; Tue, 3 Mar 2009 21:41:06 +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=MXw7gxVQKqGXY79tIT8aFQ==:17 a=47vyccSKLEfkaHTilywA:9 a=eQeeFW9mZEdqgXjXIrzK-DFgWOsA:4 a=LY0hPdMaydYA:10 Received: from [62.113.132.61] (account mc467741@c2i.net HELO laptop) by mailfe03.swip.net (CommuniGate Pro SMTP 5.2.6) with ESMTPA id 1208880907; Tue, 03 Mar 2009 22:41:04 +0100 From: Hans Petter Selasky To: Artyom Mirgorodsky Date: Tue, 3 Mar 2009 22:43:30 +0100 User-Agent: KMail/1.9.7 References: <200903010045.44904.man@email.com.ua> <200903031516.02744.hselasky@c2i.net> <200903032006.54451.man@email.com.ua> In-Reply-To: <200903032006.54451.man@email.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903032243.31914.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: Tue, 03 Mar 2009 21:41:08 -0000 On Tuesday 03 March 2009, Artyom Mirgorodsky wrote: > On Tuesday 03 March 2009 16:16:02 Hans Petter Selasky wrote: > > if (usb2_get_speed(xfer->xroot->udev) == USB_SPEED_HIGH) { > > qh_endp |= (EHCI_QH_SET_EPS(EHCI_QH_SPEED_HIGH) | > > EHCI_QH_DTC); > > if (methods != &ehci_device_intr_methods) > > qh_endp |= EHCI_QH_SET_NRL(8); > > } else { > > > > And tune to NRL value to 15. Recompile kernel and modules. > Hi, Here is some more testing you can do: dd if=/dev/da0 of=/dev/null bs=1024 & And then: vmstat -i ; sleep 1 ; vmstat -i Now compute the number of interrupts that appear on the EHCI. Repeat the same test using FreeBSD -current. a) On the machine where it is slow. b) On the machine where it is fast. 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. --HPS