From owner-freebsd-hackers@FreeBSD.ORG Wed Aug 31 20:38:10 2005 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5120416A41F; Wed, 31 Aug 2005 20:38:10 +0000 (GMT) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe14.tele2.se [212.247.155.161]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5D0F843D48; Wed, 31 Aug 2005 20:38:08 +0000 (GMT) (envelope-from hselasky@c2i.net) X-T2-Posting-ID: Y1QAsIk9O44SO+J/q9KNyQ== Received: from mp-216-86-119.daxnet.no ([193.216.86.119] verified) by mailfe14.swip.net (CommuniGate Pro SMTP 4.3.4) with ESMTP id 13934797; Wed, 31 Aug 2005 22:38:06 +0200 From: Hans Petter Selasky To: freebsd-hackers@freebsd.org Date: Wed, 31 Aug 2005 22:39:02 +0200 User-Agent: KMail/1.7 References: <200508302009.aa99975@nowhere.iedowse.com> <43160334.5000100@samsco.org> <43160943.6030400@samsco.org> In-Reply-To: <43160943.6030400@samsco.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200508312239.04897.hselasky@c2i.net> Cc: Scott Long , Ian Dowse , hackers@freebsd.org, Eugene Grosbein , freebsd-usb@freebsd.org, "Eygene A. Ryabinkin" Subject: Re: Low umass performance with USB 2.0 ports X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: hselasky@c2i.net List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Aug 2005 20:38:10 -0000 On Wednesday 31 August 2005 21:47, Scott Long wrote: > Scott Long wrote: > > Ian Dowse wrote: > >> In message <20050830125031.GA775@rea.mbslab.kiae.ru>, "Eygene A. > >> Ryabinkin" wri > >> > >> tes: > >>>> What is filesystem has your USB drive? > >>> > >>> The one I was extensively testing has FAT, but I've checked the UFS2 -- > >>> just a bit better -- 1.8 Mb/second. But you're right -- no wdrains at > >>> all. > >>> > >>>> FreeBSD 4.x had very low performance with FAT filesystem, > >>>> writing process spent lots of time in the wdrain state too. > >>> > >>> Yes, it has. But here the same flash drive gives different results for > >>> ehci and uhci devices, and the total speed of echi is lower due to > >>> wdrains: > >>> 300 Kb/sec versus 500 Kb/sec. And I sometimes write my data to the > >>> Windows > >>> partition with FAT to my home HDD -- it has no wdrains. At least, > >>> I've not > >>> noticed them. For flash I can. > >> > >> The patch in from the email below may help with the wdrain state - > >> can you see if it makes any difference? > > > > Is the problem that the interrupt gets fired but not all of the status > > information has made it's way back to host memory when the driver gets > > there? Would it make a difference to instead read back the EHCI_USBSTS > > register after writing to it in ehci_intr1? That way all transactions > > down to the controller would be guaranteed to be flushed before you > > continue on. I wonder if this is a remnant of the famous problems with > > VIA chipsets doing bad things under medium-to-high PCI contention. I > > don't see any obvious workarounds for this in the Linux EHCI code, so > > I wonder if it's a case of them not encountering it, or doing something > > different that avoids the problem. > > > > Scott > > Actually, I just peeked inside the Linux EHCI code and it does a dummy > read immediately after writing to the status register: > > /* clear (just) interrupts */ > writel (status, &ehci->regs->status); > readl (&ehci->regs->command); /* unblock posted write */ > > I wonder if that's the whole trick here. Would someone be willing to > try the attached patch instead of the one that Ian posted? > > Scott This is not documented in the EHCI chip specification. There exists the doorbell to ensure that the EHCI controller is finished with data structures. Also I have noticed that the existing EHCI driver does not always dequeue structures from the controller before accessing them. If Scott's patch doesn't work, could you have tried to install the following (compiles on FreeBSD 5/6/7): Download the three files below into a new directory and type "make install" (to uninstall type "make deinstall") http://home.c2i.net/hselasky/isdn4bsd/privat/usb/Makefile http://home.c2i.net/hselasky/isdn4bsd/privat/usb/new_usb_1_5_4.diff.bz2 http://home.c2i.net/hselasky/isdn4bsd/privat/usb/new_usb_1_5_4.tar.bz2 Then recompile all USB modules and/or kernel, depending on your configuration. Here is a quick USB-module compile script: #!/bin/sh cd /sys/modules/aue && make depend all install clean cd /sys/modules/axe && make depend all install clean cd /sys/modules/cdce && make depend all install clean cd /sys/modules/cue && make depend all install clean cd /sys/modules/if_ndis && make depend all install clean cd /sys/modules/kue && make depend all install clean cd /sys/modules/ndis && make depend all install clean cd /sys/modules/netgraph/bluetooth/ubtbcmfw && make depend all install clean cd /sys/modules/netgraph/bluetooth/ubt && make depend all install clean cd /sys/modules/rue && make depend all install clean cd /sys/modules/sound/driver/uaudio && make depend all install clean cd /sys/modules/ubsa && make depend all install clean cd /sys/modules/ubser && make depend all install clean cd /sys/modules/ucom && make depend all install clean cd /sys/modules/ucycom && make depend all install clean cd /sys/modules/udav && make depend all install clean cd /sys/modules/udbp && make depend all install clean cd /sys/modules/ufm && make depend all install clean cd /sys/modules/uftdi && make depend all install clean cd /sys/modules/ugen && make depend all install clean cd /sys/modules/uhid && make depend all install clean cd /sys/modules/ukbd && make depend all install clean cd /sys/modules/ulpt && make depend all install clean cd /sys/modules/umass && make depend all install clean cd /sys/modules/umct && make depend all install clean cd /sys/modules/umodem && make depend all install clean cd /sys/modules/ums && make depend all install clean cd /sys/modules/uplcom && make depend all install clean cd /sys/modules/ural && make depend all install clean cd /sys/modules/urio && make depend all install clean cd /sys/modules/usb && make depend all install clean cd /sys/modules/uscanner && make depend all install clean cd /sys/modules/uvisor && make depend all install clean cd /sys/modules/uvscom && make depend all install clean --HPS