From owner-svn-src-head@FreeBSD.ORG Tue Dec 28 20:11:54 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EAD351065674; Tue, 28 Dec 2010 20:11:54 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9DA478FC17; Tue, 28 Dec 2010 20:11:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oBSKBs8W075829; Tue, 28 Dec 2010 20:11:54 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oBSKBsZe075827; Tue, 28 Dec 2010 20:11:54 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201012282011.oBSKBsZe075827@svn.freebsd.org> From: Juli Mallett Date: Tue, 28 Dec 2010 20:11:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216773 - head/sys/mips/cavium X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Dec 2010 20:11:55 -0000 Author: jmallett Date: Tue Dec 28 20:11:54 2010 New Revision: 216773 URL: http://svn.freebsd.org/changeset/base/216773 Log: When allocating memory from bootmem for the kernel to use, try to leave about 2MB of memory in the bootmem allocator for the SDK to use internally at a later point. It'd be nice if there were some functions we could call before allocating memory to let various facilities reserve some memory, but for now this seems sufficient. Previously some unfortunate systems could give up all (or at least most) of their memory to the kernel from bootmem, and then allocating command queues for packet output and the like would fail later in the boot process (which in turn would lead to crashes even later.) Reported by: kan Modified: head/sys/mips/cavium/octeon_machdep.c Modified: head/sys/mips/cavium/octeon_machdep.c ============================================================================== --- head/sys/mips/cavium/octeon_machdep.c Tue Dec 28 20:02:30 2010 (r216772) +++ head/sys/mips/cavium/octeon_machdep.c Tue Dec 28 20:11:54 2010 (r216773) @@ -287,6 +287,14 @@ octeon_memory_init(void) */ i = 0; while (i < PHYS_AVAIL_ENTRIES) { + /* + * If there is less than 2MB of memory available in 128-byte + * blocks, do not steal any more memory. We need to leave some + * memory for the command queues to be allocated out of. + */ + if (cvmx_bootmem_available_mem(128) < 2 << 20) + break; + addr = cvmx_bootmem_phy_alloc(1 << 20, phys_end, ~(vm_paddr_t)0, PAGE_SIZE, 0); if (addr == -1)