From owner-freebsd-fs@FreeBSD.ORG Wed Dec 9 18:00:49 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 2DF051065679; Wed, 9 Dec 2009 18:00:49 +0000 (UTC) (envelope-from mattjreimer@gmail.com) Received: from mail-yw0-f194.google.com (mail-yw0-f194.google.com [209.85.211.194]) by mx1.freebsd.org (Postfix) with ESMTP id C947F8FC16; Wed, 9 Dec 2009 18:00:48 +0000 (UTC) Received: by ywh32 with SMTP id 32so7147873ywh.14 for ; Wed, 09 Dec 2009 10:00:48 -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=Lb35aUgAQinNpJK2cuJa0Q1Br/ZXefQlqHMtn6Fq25E=; b=dzte4mX7E7+BJCVpE8ZdTSJ0+tb5ToaORFING7vMJS8DlKFfkutL4EJbW6+rjjb0s7 f23RAzS3Gf6lVpweMLtBN6X+q0i20fY3+V4HnB2FaonDDHPXLIgRsl8oMHYc2YHdP0JD O8eX7h7n2AOWNQCyX8MkPxsqJPrjsSRb+XiSc= 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=pa6CKmOiELH6D3OUJuCala4drl/13QsvnEAn29DszgeBusdAMOj2Z9w0UTOEvW3+QB E4I/N1uEL4nM4ubqxVCz+Vp0xVgPJLftQUMtgGJtbzAVhaPINonteqjbel2XhxLo4wCP SYLfMW7mwFEbql78z84UqqaLthIzGqugTfNDs= MIME-Version: 1.0 Received: by 10.150.108.32 with SMTP id g32mr16896651ybc.244.1260381647831; Wed, 09 Dec 2009 10:00:47 -0800 (PST) In-Reply-To: <200912091015.15450.jhb@freebsd.org> References: <200912080813.58600.jhb@freebsd.org> <200912091015.15450.jhb@freebsd.org> Date: Wed, 9 Dec 2009 10:00:47 -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 18:00:49 -0000 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 necessary s= o >> >> 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 code >> >> and static data up to 640KB, possibly overrunning the stack. Now the >> >> 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 ma= y contain >> > ACPI tables, etc. =A0A robust approach would involve walking the SMAP,= etc. =A0I >> > just committed some changes to sys/boot/i386/loader/biosmem.c that mak= e it >> > smarter about choosing a heap region. =A0I suggest adopting that algor= ithm for >> > figuring out a safe heap range. =A0zfsboot and gptzfsboot should have = 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 wi= ll >> > guarantee currently, and if ZFS needs more than that it likely needs t= o 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() i= sn'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 'main': /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 Matt