From owner-svn-src-head@freebsd.org Tue Dec 26 22:05:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9097E85E35; Tue, 26 Dec 2017 22:05:56 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C0B9969657; Tue, 26 Dec 2017 22:05:56 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBQM5tEa021742; Tue, 26 Dec 2017 22:05:55 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBQM5tsp021741; Tue, 26 Dec 2017 22:05:55 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201712262205.vBQM5tsp021741@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 26 Dec 2017 22:05:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327226 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 327226 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 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, 26 Dec 2017 22:05:57 -0000 Author: ian Date: Tue Dec 26 22:05:55 2017 New Revision: 327226 URL: https://svnweb.freebsd.org/changeset/base/327226 Log: Add a section describing how to tune ARM kernel options to use an MD_ROOT filesystem larger than about 50-55 MiB. The description of VM_KMEM_SIZE_SCALE is roughly as hand-wavy as my understanding of the option, but at least mentioning that it's a factor and giving an empirical datapoint that works will give folks some idea of what to tweak if they have problems. Modified: head/share/man/man4/md.4 Modified: head/share/man/man4/md.4 ============================================================================== --- head/share/man/man4/md.4 Tue Dec 26 20:56:55 2017 (r327225) +++ head/share/man/man4/md.4 Tue Dec 26 22:05:55 2017 (r327226) @@ -7,7 +7,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 7, 2017 +.Dd December 26, 2017 .Dt MD 4 .Os .Sh NAME @@ -93,6 +93,47 @@ disk found in the .Xr mdconfig 8 man page. Other tools will also create these images, such as NanoBSD. +.Sh ARM KERNEL OPTIONS +On armv6 and armv7 architectures, an MD_ROOT image larger than +approximately 55 MiB may require building a custom kernel using +several tuning options related to kernel memory usage. +.Bl -tag -width indent +.It Cd options LOCORE_MAP_MB= +This configures how much memory is mapped for the kernel during +the early initialization stages. +The value must be at least as large as the kernel plus all preloaded +modules, including the root image. +There is no downside to setting this value too large, as long +as it does not exceed the amount of physical memory. +The default is 64 MiB. +.It Cd options NKPT2PG= +This configures the number of kernel L2 page table pages to +preallocate during kernel initialization. +Each L2 page can map 4 MiB of kernel space. +The value must be large enough to map the kernel plus all preloaded +modules, including the root image. +The default value is 32, which is sufficient to map 128 MiB. +.It Cd options VM_KMEM_SIZE_SCALE= +This configures the amount of kernel virtual address (KVA) space to +dedicate to the kmem_arena map. +The value is the ratio of physical to virtual pages. +The default value of 3 allocates a page of KVA for each 3 pages +of physical ram in the system. + +The kernel and modules, including the root image, also consume KVA. +The combination of a large root image and the default scaling +may preallocate so much KVA to kmem_arena that there is not enough +remaining address space to allocate kernel stacks, IO buffers, +and other resources that are not part of kmem_arena. +Overallocating kmem_arena space is likely to manifest as failure to +launch userland processes with "cannot allocate kernel stack" messages. + +Setting the value too high may result in kernel failure to allocate +memory because kmem_arena is too small, and the failure may require +significant runtime to manifest. +Empirically, a value of 5 works well for a 200 MiB root image on +a system with 2 GiB of physical ram. +.El .Sh SEE ALSO .Xr gpart 8 , .Xr loader 8 ,