From owner-freebsd-current@FreeBSD.ORG Sun Jan 30 03:04:19 2005 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0280116A4CE for ; Sun, 30 Jan 2005 03:04:19 +0000 (GMT) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id 42AE243D31 for ; Sun, 30 Jan 2005 03:04:18 +0000 (GMT) (envelope-from scottl@freebsd.org) Received: from [192.168.254.12] (g4.samsco.home [192.168.254.12]) (authenticated bits=0) by pooker.samsco.org (8.12.11/8.12.10) with ESMTP id j0U37Q9Q019566; Sat, 29 Jan 2005 20:07:26 -0700 (MST) (envelope-from scottl@freebsd.org) Message-ID: <41FC4EA2.40603@freebsd.org> Date: Sat, 29 Jan 2005 20:04:02 -0700 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7) Gecko/20040514 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Doug White References: <20050128100151.GA43728@fit.vutbr.cz> <20050129121051.X85926@carver.gumbysoft.com> In-Reply-To: <20050129121051.X85926@carver.gumbysoft.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=0.0 required=3.8 tests=none autolearn=no version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on pooker.samsco.org cc: Petr Lampa cc: freebsd-current@freebsd.org cc: vkashyap@amcc.com Subject: Re: bus_dmamap_create() breakage (alias 3Ware driver problems) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jan 2005 03:04:19 -0000 Doug White wrote: > Hello Petr, > > Thanks for the analysis on this. > > On Fri, 28 Jan 2005, Petr Lampa wrote: > > >>I have got similar problems with the new 3Ware driver like others, >>but on the second controller. After some debugging and playing with >>bus_dma_tag_create() etc. arguments (new driver is using 3 busdma_tags >>instead 1 in old driver), I have located source of failure >>in bus_dmamap_create(). Here is the trouble spot: >> >>$FreeBSD: src/sys/i386/i386/busdma_machdep.c,v 1.59.2.3 2004/12/04 05: >>55:10 scottl Exp $ >> >>bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) >>{ >>... >> maxpages = MIN(MAX_BPAGES, Maxmem - atop(dmat->lowaddr)); >> if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0 >> || (dmat->map_count > 0 && total_bpages < maxpages)) { >> int pages; >> ... >> pages = MAX(atop(dmat->maxsize), 1); >> >>At this location maxpages=512, total_bpages=513, dmat->maxsize=131072, pages=32 >> >> pages = MIN(maxpages - total_bpages, pages); >> >>Here pages=-1! > > > Ooh, thats not so good. > > Could you bundle up your changes into a patch? Its a lot easier to follow > and compare your changes, as well as test :) Also, can you please submit > a PR with the patch so it doesn't get lost? scottl is out for the weekend > but I'll bring this to his attention when he returns. > > Thanks! > There is a fundamental problem with how busdma counts and pre-allocates bounce pages, and it's leading to some interesting problems like this (which is why I never merged the 4GB+ fixes to RELENG_5_3). Basically, I think that too many bounce pages are being allocated for fixing up alignment constraints. I need a few hours to sit in front of a white-board and think it all through again. However, someone want to help, either by fixing the underlying problems or by tying up these edge cases, I'd be happy to discuss it some more. Scott