From owner-freebsd-usb@FreeBSD.ORG Fri Nov 7 21:21:13 2008 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 CC7EE1065678; Fri, 7 Nov 2008 21:21:13 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe04.swip.net [212.247.154.97]) by mx1.freebsd.org (Postfix) with ESMTP id 098248FC08; Fri, 7 Nov 2008 21:21:12 +0000 (UTC) (envelope-from hselasky@c2i.net) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.0 c=1 a=J1zRX2_4DjwA:10 a=xw72rLtdcjMA:10 a=d6BVkb5LuPPVEe4iNQMLyA==:17 a=6I5d2MoRAAAA:8 a=oAZldqXC3ePJyYGYedkA:9 a=N4mKqpmnmuDzLNnQeX4A:7 a=hC0tmhrhy0ay3q0pIkt-aU5RRikA:4 a=LY0hPdMaydYA:10 Received: from [62.113.135.6] (account mc467741@c2i.net [62.113.135.6] verified) by mailfe04.swip.net (CommuniGate Pro SMTP 5.2.6) with ESMTPA id 1143715840; Fri, 07 Nov 2008 22:21:10 +0100 From: Hans Petter Selasky To: Alexey Shuvaev Date: Fri, 7 Nov 2008 22:23:19 +0100 User-Agent: KMail/1.9.7 References: <20081107082740.GA1334@icarus.home.lan> <200811071811.27181.hselasky@c2i.net> <20081107191935.GA51170@localhost.my.domain> In-Reply-To: <20081107191935.GA51170@localhost.my.domain> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200811072223.20313.hselasky@c2i.net> Cc: freebsd-current@freebsd.org, freebsd-usb@freebsd.org Subject: Re: Kernel panic when copying data to umass device (USB4BSD) - problem found 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: Fri, 07 Nov 2008 21:21:13 -0000 On Friday 07 November 2008, Alexey Shuvaev wrote: > On Fri, Nov 07, 2008 at 06:11:26PM +0100, Hans Petter Selasky wrote: > > Hi Jeremy, > > > > I've reproduced the issue with some mods to the usb2_busdma.c on 32-bit > > arcitecture and have made a fix for this problem. > > > > Try the following patch and re-test! > > Thanks a lot! I have rebuild the kernel with this patch > > > http://perforce.freebsd.org/chv.cgi?CH=152624 > > and so far no panics. Indeed, the system I am using is amd64 with 4Gb of > RAM. > > > Some mem-stick benchmarks would be nice ... > > What exactly do you mean? > I have done: > dd if=file_on_one_stick of=/dev/null bs=1m (12.5 Mb/s) > dd if=/dev/random of=file_on_the_stick bs=1m count=128 (2.6 Mb/s) > > and the same tests with USB-microSDHC adapter with 8Gb card > (20 MB/s read, 15 Mb/s write). > > Anything else? No, that looks very good. Maybe you could also do a md5 on the transferred data, just to see if there are data errors. BTW: I have forced my 32-bit system to use bounce buffers now, and I have found more problems! Warner: I see that bus-dma is allocating bounce buffers for the EHCI/OHCI/UHCI transfer descriptors and queue heads, even though I use "bus_dmamem_alloc()" with the COHERENT flag and everything. I suspect that the problem is that "bus_dmamem_alloc()" is optimised to use "malloc()" which then automatically will imply a possible bounce buffer. Even if I use PAGE_SIZE byte allocations it goes wrong. Maybe I also need to set the alignment to PAGE_SIZE bytes, to really ensure that "busdma" is not putting the TD's and QH's in the wrong part of the memory from the beginning? This is a big problem, because the busdma API does not allow flushing single fields of these descriptors, which is an absolute mandatory feature during USB operation. On NetBSD this is possible. What should we do? I guess this is the root problem of USB(2) not working reliable on 64-bit architectures. --HPS