From owner-freebsd-stable@FreeBSD.ORG Fri Sep 22 04:38:41 2006 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9BC7A16A412 for ; Fri, 22 Sep 2006 04:38:41 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id DBD9243D5E for ; Fri, 22 Sep 2006 04:38:40 +0000 (GMT) (envelope-from scottl@samsco.org) Received: from [192.168.254.14] (imini.samsco.home [192.168.254.14]) (authenticated bits=0) by pooker.samsco.org (8.13.4/8.13.4) with ESMTP id k8M4cYlm086339; Thu, 21 Sep 2006 22:38:39 -0600 (MDT) (envelope-from scottl@samsco.org) Message-ID: <451368CA.1030404@samsco.org> Date: Thu, 21 Sep 2006 22:38:34 -0600 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.7) Gecko/20050416 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jan Mikkelsen References: <003001c6ddff$278d52d0$d435083d@transactionware.com> In-Reply-To: <003001c6ddff$278d52d0$d435083d@transactionware.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.4 required=3.8 tests=ALL_TRUSTED autolearn=failed version=3.1.1 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on pooker.samsco.org Cc: freebsd-stable@freebsd.org Subject: Re: Patch: sym(4) "VTOBUS FAILED" panics on amd64, amd64/89550 X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Sep 2006 04:38:41 -0000 Jan Mikkelsen wrote: > Hi, > > Doug White wrote: > >>On Fri, 22 Sep 2006, Jan Mikkelsen wrote: >> >> >>>Quick summary: sym(4) assumes on amd64 that virtual >> >>addresses provided by >> >>>bus_dmamem_alloc() have the same alignment as the physical >> >>addresses (in >> >>>this case, 2*PAGE_SIZE). They don't, and stuff breaks. >> >>This patch works >> >>>around that. >> >>Why is this? busdma supports alignment constraints; why not >>just set the >>alignment to what you need it set at? I realize sym has its own hand >>rolled DMA management craziness but alignment is something >>busdma can take >>care of easily. > > > sym has the alignment requirement on the virtual address because of the > buddy memory allocation algorithm; changing how sym allocates memory > internally would remove the requirement. The buddy algorithm with 2^13 > bytes aligned on a 2^12 byte (but not a 2^13 byte) boundary can provide two > chunks of 2^12 bytes but nothing greater than 2^12 bytes. > > The VTOBUS failure is caused by the buddy implementation making alignment > assumptions which aren't true, and then getting the virtual addresses wrong. > > Perhaps I'm just doing something wrong with bus_dma. I believe I set the > alignment requirements to be 2*PAGE_SIZE, and this is what I see for the > physical address. However the virtual address seems to only be page > aligned. > > I can't see any mention of virtual address alignment in the bus_dma man > page. Can it take care of virtual address alignment? If so, how? > busdma makes no guarantees on virtual addresses. Sigh, sorry I never got this fixed. The custom memory allocator made me unhappy, and I never had time to dig into it. Do real docs on sym exist somewhere? I'm not against sitting down and re-writing the physical memory handling to both work and conform to the FreeBSD APIs. Scott