From owner-freebsd-fs@FreeBSD.ORG Wed Dec 9 20:48:11 2009 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE0381065672; Wed, 9 Dec 2009 20:48:10 +0000 (UTC) (envelope-from mattjreimer@gmail.com) Received: from mail-px0-f190.google.com (mail-px0-f190.google.com [209.85.216.190]) by mx1.freebsd.org (Postfix) with ESMTP id 9C0F08FC15; Wed, 9 Dec 2009 20:48:10 +0000 (UTC) Received: by pxi28 with SMTP id 28so2275687pxi.7 for ; Wed, 09 Dec 2009 12:48:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=BsoNuhp3xPV/IxJPtfqvvDtXjAOg+dDGO9Xg1+LqVh8=; b=oYQOBasKDkmOHj2/zrRedvxqNVMa20JToFsNsUyCrib1I8nV1uWEjcYCwsuXEs2PFs ioeDXf5yMW1xRbMyVIM8bhTruFOawQFj6g7xcFurd42obIAZkSS4SeAz+QE3tcuN9PRY OSKI2hUPv4+9NhdGIkZ6E6Int8e0YqttgXzVA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Afcp6QjK4hp6IgCTyyZug1lkhp2coaqnJBk7T9cp9ao3H33zixqZMelvGkcT6SJCEr 2mfR6yv+XG4oqx18Q22gWPpSy1OiPLXIFH6AHvM5Wn80z6Zard3cEpjaZTCL3UoIRbT6 S+Qf6MtissYW13jeFKdh04ZEdAzSCOkEEyTFs= MIME-Version: 1.0 Received: by 10.143.154.14 with SMTP id g14mr1503587wfo.266.1260391689541; Wed, 09 Dec 2009 12:48:09 -0800 (PST) In-Reply-To: <200912091531.42421.jhb@freebsd.org> References: <200912091015.15450.jhb@freebsd.org> <200912091531.42421.jhb@freebsd.org> Date: Wed, 9 Dec 2009 12:48:08 -0800 Message-ID: From: Matt Reimer To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-fs@freebsd.org Subject: Re: PATCH: increase heap size for (gpt)zfsboot X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 20:48:11 -0000 On Wed, Dec 9, 2009 at 12:31 PM, John Baldwin wrote: > On Wednesday 09 December 2009 1:00:47 pm Matt Reimer wrote: >> On Wed, Dec 9, 2009 at 7:15 AM, John Baldwin wrote: >> > On Tuesday 08 December 2009 6:06:14 pm Matt Reimer wrote: >> >> On Tue, Dec 8, 2009 at 5:13 AM, John Baldwin wrote: >> >> > On Monday 07 December 2009 7:01:03 pm Matt Reimer wrote: >> >> >> Enlarge the heap size for gptzfsboot and zfsboot. This is necessar= y so >> >> >> the ZFS code has enough memory to handle decompression and error >> >> >> recovery. >> >> >> >> >> >> Before this patch the heap grew from the end of the (gpt)zfsboot c= ode >> >> >> and static data up to 640KB, possibly overrunning the stack. Now t= he >> >> >> heap is located at 16MB-64MB. >> >> >> >> >> >> Note that this requires machines with at least 64MB RAM, but this = is >> >> >> not likely to be a problem on any machine running ZFS. >> >> >> >> >> >> Sponsored by: VPOP Technologies, Inc. >> >> >> >> >> >> Matt Reimer >> >> > >> >> > Unfortunately the 16M - 64M range may not all be useable RAM. =A0It= may contain >> >> > ACPI tables, etc. =A0A robust approach would involve walking the SM= AP, etc. =A0I >> >> > just committed some changes to sys/boot/i386/loader/biosmem.c that = make it >> >> > smarter about choosing a heap region. =A0I suggest adopting that al= gorithm for >> >> > figuring out a safe heap range. =A0zfsboot and gptzfsboot should ha= ve enough >> >> > free space to take the bios_getmem() function. =A0You can increase = the minimum >> >> > heap size beyond 3M if desired (though 3M is the minimum the loader= will >> >> > guarantee currently, and if ZFS needs more than that it likely need= s to be >> >> > changed in both places). >> >> >> >> Thanks John. I dropped the bios_getmem() into zfsboot.c and it works >> >> for me. How's the attached patch look to you? >> > >> > I tweaked it slightly (memtop* aren't needed for gptboot, and memsize(= ) isn't >> > used anymore). =A0Can you test the updated version below? >> >> It works. But making bios_getmem() inline causes a compiler warning: >> >> /usr/src/sys/boot/i386/gptzfsboot/../zfsboot/zfsboot.c: In function 'mai= n': >> /usr/src/sys/boot/i386/gptzfsboot/../zfsboot/zfsboot.c:353: warning: >> inlining failed in call to 'bios_getmem': --param >> max-inline-insns-single limit reached >> /usr/src/sys/boot/i386/gptzfsboot/../zfsboot/zfsboot.c:620: warning: >> called from here > > Ok, the inline is probably not needed for zfsboot since it isn't quite as > space constrained. =A0I will commit it w/o the inline. Thanks for committing this John. Matt