From owner-freebsd-usb@FreeBSD.ORG Tue Jan 31 23:59:52 2006 Return-Path: X-Original-To: freebsd-usb@freebsd.org Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 68C8F16A420 for ; Tue, 31 Jan 2006 23:59:52 +0000 (GMT) (envelope-from nox@saturn.kn-bremen.de) Received: from gwyn.kn-bremen.de (gwyn.kn-bremen.de [212.63.36.242]) by mx1.FreeBSD.org (Postfix) with ESMTP id B1A5A43D4C for ; Tue, 31 Jan 2006 23:59:51 +0000 (GMT) (envelope-from nox@saturn.kn-bremen.de) Received: from gwyn.kn-bremen.de (gwyn [127.0.0.1]) by gwyn.kn-bremen.de (8.13.4/8.13.4/Debian-3) with ESMTP id k0VNxonP005851; Wed, 1 Feb 2006 00:59:50 +0100 Received: from saturn.kn-bremen.de (uucp@localhost) by gwyn.kn-bremen.de (8.13.4/8.13.4/Submit) with UUCP id k0VNxohw005849; Wed, 1 Feb 2006 00:59:50 +0100 Received: from saturn.kn-bremen.de (nox@localhost [127.0.0.1]) by saturn.kn-bremen.de (8.13.3/8.13.1) with ESMTP id k0VNvG0s081635; Wed, 1 Feb 2006 00:57:16 +0100 (CET) (envelope-from nox@saturn.kn-bremen.de) Received: (from nox@localhost) by saturn.kn-bremen.de (8.13.3/8.13.1/Submit) id k0VNvFoe081634; Wed, 1 Feb 2006 00:57:15 +0100 (CET) (envelope-from nox) From: Juergen Lock Date: Wed, 1 Feb 2006 00:57:15 +0100 To: Ian Dowse Message-ID: <20060131235715.GA81439@saturn.kn-bremen.de> References: <20060131194244.GA75983@saturn.kn-bremen.de> <200601312200.aa58422@nowhere.iedowse.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200601312200.aa58422@nowhere.iedowse.com> User-Agent: Mutt/1.4.2.1i Cc: freebsd-usb@freebsd.org Subject: Re: cvs commit: src/sys/dev/usb ehci.c ehci_pci.c ehcivar.h 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, 31 Jan 2006 23:59:52 -0000 On Tue, Jan 31, 2006 at 10:00:21PM +0000, Ian Dowse wrote: > In message <20060131194244.GA75983@saturn.kn-bremen.de>, Juergen Lock writes: > >> Alright, looks like it was paging: (usb_block_allocmem ending up > >> calling contigmalloc... which makes me wonder what would happen > >> there if someone had swap on a umass device? swap here is on > >> ad4s2b which is on the sata card.) > > > >Ah, seems the actual problem is that it is sleeping although > >bus_dmamem_alloc is called with BUS_DMA_NOWAIT, and there even is > >a pr for that: > > http://www.freebsd.org/cgi/query-pr.cgi?pr=78179 > >The pr is still open so i guess there is no fix yet? > > Ok, yes, this is a known problem that occurs if you access USB > devices for the first time when the physical memory is too fragmented > for a contiguous allocation to succeed immediately. A workaround > is to add more RAM or access the USB devices soon after booting. > Once the USB system has successfully allocated the memory it needs, > it will then work reliably. > > In the case of USB, there is actually no need for it to perform > large contiguous allocations because the host controllers all support > some limited scatter-gather functionality so they can mostly access > the caller's memory buffer directly via bus_dmamap_load(). This is > something I implemented a year or to ago but I haven't got around > to finishing the last few details of the patch yet. Hmm, couldnt the usb code just pre-allocate the needed memory at, say, the open() syscall of an umass device instead?