From owner-freebsd-bugs@FreeBSD.ORG Thu Jun 28 17:20:09 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 41D88106564A for ; Thu, 28 Jun 2012 17:20:09 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 1A4678FC16 for ; Thu, 28 Jun 2012 17:20:09 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q5SHK8es093254 for ; Thu, 28 Jun 2012 17:20:08 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q5SHK8HX093253; Thu, 28 Jun 2012 17:20:08 GMT (envelope-from gnats) Resent-Date: Thu, 28 Jun 2012 17:20:08 GMT Resent-Message-Id: <201206281720.q5SHK8HX093253@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Mike Watters Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D524106564A for ; Thu, 28 Jun 2012 17:17:26 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id E9CD78FC1F for ; Thu, 28 Jun 2012 17:17:25 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q5SHHPS1003454 for ; Thu, 28 Jun 2012 17:17:25 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id q5SHHPPA003453; Thu, 28 Jun 2012 17:17:25 GMT (envelope-from nobody) Message-Id: <201206281717.q5SHHPPA003453@red.freebsd.org> Date: Thu, 28 Jun 2012 17:17:25 GMT From: Mike Watters To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/169526: [patch] sys/dev/sym broken by r236061 on amd64 with more than 4GB RAM X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 17:20:09 -0000 >Number: 169526 >Category: kern >Synopsis: [patch] sys/dev/sym broken by r236061 on amd64 with more than 4GB RAM >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Jun 28 17:20:08 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Mike Watters >Release: 8-STABLE >Organization: >Environment: FreeBSD 8.3-STABLE #4: Wed Jun 27 00:13:04 MDT 2012 srcbuild@:/usr/obj/usr/src-8/sys/GENERIC amd64 >Description: Related PR: 168928 (different bug in same revision) real memory = 8589934592 (8192 MB) avail memory = 7983443968 (7613 MB) sym0: <1010-66> port 0xe000-0xe0ff mem 0xfbfffc00-0xfbffffff,0xfbffc000-0xfbffdfff irq 21 at device 7.0 on pci3 sym0: failed to create DMA tag. device_attach: sym0 attach returned 6 (followed by memory-related errors and boot failure) In r236061 to sys/dev/sym/sym_hipd.c, the flags parameter to bus_dma_tag_create() was changed from 0 to BUS_DMA_ALLOCNOW, which breaks the driver on my amd64 system with 8GB RAM. If I follow the logic correctly, the BUS_DMA_ALLOCNOW flag combined with the maxsize parameter being BUS_SPACE_MAXSIZE results in the system trying to allocate 4GB worth of bounce pages, which I assume exhausts kernel resources. >How-To-Repeat: >Fix: Change flags parameter from BUS_DMA_ALLOCNOW back to 0, or change maxsize parameter to a more appropriate smaller value. Changing flags to 0 (BUS_DMA_WAITOK) fixes the problem on my system. Patch attached with submission follows: --- sym_hipd.c.orig 2012-06-17 03:43:04.000000000 -0600 +++ sym_hipd.c 2012-06-28 11:01:36.335984640 -0600 @@ -8538,7 +8538,7 @@ if (bus_dma_tag_create(np->bus_dmat, 1, SYM_CONF_DMA_BOUNDARY, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE, SYM_CONF_MAX_SG, SYM_CONF_DMA_BOUNDARY, - BUS_DMA_ALLOCNOW, busdma_lock_mutex, &np->mtx, &np->data_dmat)) { + BUS_DMA_WAITOK, busdma_lock_mutex, &np->mtx, &np->data_dmat)) { device_printf(dev, "failed to create DMA tag.\n"); goto attach_failed; } >Release-Note: >Audit-Trail: >Unformatted: