From owner-freebsd-arm@FreeBSD.ORG Fri Mar 7 00:25:12 2014 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 42BA8D28 for ; Fri, 7 Mar 2014 00:25:12 +0000 (UTC) Received: from mail-pb0-f48.google.com (mail-pb0-f48.google.com [209.85.160.48]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0FBE8FB0 for ; Fri, 7 Mar 2014 00:25:11 +0000 (UTC) Received: by mail-pb0-f48.google.com with SMTP id md12so3360400pbc.35 for ; Thu, 06 Mar 2014 16:25:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:content-type:mime-version:subject:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=uf1BGtfHEQOFbMXyRVO0/Z1PcVnPOggMWdPLNRiXIgU=; b=S9C1K3AUQpiMMIdwXf0UWs4HjiIslt3JZJQm3GBiTaIhwNI/Q1TKFlHaQDCXdJMaqw nX0yYwzJRhNfAZfdnBhYcdB6Sj+BPWUfuqVfEJmh12+pLNxb6MnyVAiFtG/bpCEmt9Bw 2CNr9NoJPBCU0Hd4ruA9/HVUV3aLUhV9UYTEnL+7parA/k7oHHBIdTTYiMzRdsfeg/Cg mlGUXUm4vvY+RDbJ83AVCbZUzEEHxUOD7cDBKyJQeTDUiVtSyL5EwqcqHyMZqd93fodd m/9XXzIFapUOZc6WSYMP4vazA1ho8wegD99jLdFPHm7lKW1qVGDUBLe4y6ty0abXGbtY RxLQ== X-Gm-Message-State: ALoCoQmO9oUe1BdJ0JT5QkEAtReZJ4DxNIND4Z9vMahmLf6E1NlqsyYSdpt+iCZZZ3XUzrOP24Gv X-Received: by 10.69.31.43 with SMTP id kj11mr17809282pbd.67.1394151911095; Thu, 06 Mar 2014 16:25:11 -0800 (PST) Received: from lglt-nvaradarajan.corp.netflix.com (dc1-prod.netflix.com. [69.53.236.251]) by mx.google.com with ESMTPSA id tu3sm48151209pab.1.2014.03.06.16.25.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Mar 2014 16:25:10 -0800 (PST) Sender: Warner Losh Content-Type: text/plain; charset=windows-1251 Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) Subject: Re: TMPFS in kernels From: Warner Losh In-Reply-To: <1394151627.1149.357.camel@revolution.hippie.lan> Date: Thu, 6 Mar 2014 17:25:09 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <5313D0FE.8010008@ceetonetechnology.com> <1393818974.1149.270.camel@revolution.hippie.lan> <5314016B.1000107@ceetonetechnology.com> <20140303061136.GB85204@zibbi.meraka.csir.co.za> <1394148799.1149.354.camel@revolution.hippie.lan> <53190F52.7030605@ceetonetechnology.com> <1394151627.1149.357.camel@revolution.hippie.lan> To: Ian Lepore X-Mailer: Apple Mail (2.1874) Cc: George Rosamond , "freebsd-arm@freebsd.org" X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Mar 2014 00:25:12 -0000 On Mar 6, 2014, at 5:20 PM, Ian Lepore wrote: > On Thu, 2014-03-06 at 19:14 -0500, George Rosamond wrote: >> Ian Lepore: >>> On Thu, 2014-03-06 at 13:03 +0800, Jia-Shiun Li wrote: >>>> On Tue, Mar 4, 2014 at 10:48 PM, Warner Losh = wrote: >>>>>=20 >>>>> On Mar 4, 2014, at 3:30 AM, Jia-Shiun Li = wrote: >>>>>=20 >>>>>> I remember hacking it a while ago to adopt tmpfs instead on my = pxeboot >>>>>> test environment. It only requires changing the line mdmfs = mounting md to >>>>>> 'mount -t tmpfs' (plus mount options), and everything else will = work as usual. >>>>>=20 >>>>> I=92ll have to give it a spin on NanoBSD then, at least as an = option=85 >>>>>=20 >>>>=20 >>>> The actual patch & result pasted below to save you some time. >>>> Only tested on x86 pxeboot though. >>>>=20 >>>> -----8<----------8<----------8<----- >>>>=20 >>>> % diff -bu /usr/src/etc/rc.initdiskless >>>> /b/tftpboot/FreeBSD/install/etc/rc.initdiskless >>>> --- /usr/src/etc/rc.initdiskless 2013-04-11 = 21:03:31.000000000 +0800 >>>> +++ /b/tftpboot/FreeBSD/install/etc/rc.initdiskless 2014-03-06 >>>> 12:43:47.000000000 +0800 >>>> @@ -198,7 +198,10 @@ >>>> # Create a generic memory disk >>>> # >>>> mount_md() { >>>> - /sbin/mdmfs -S -i 4096 -s $1 -M md $2 >>>> +# /sbin/mdmfs -S -i 4096 -s $1 -M md $2 >>>> + local tmpfs_size >>>> + tmpfs_size=3D$(($1 * 1024)) >>>> + /sbin/mount -t tmpfs -osize=3D$tmpfs_size tmpfs $2 >>>> } >>>>=20 >>>> # Create the memory filesystem if it has not already been created >>>>=20 >>>> % cat df >>>> Filesystem Size Used Avail >>>> Capacity Mounted on >>>> 192.168.233.1:/b/tftpboot/FreeBSD/install/ 29G 17G 9.8G = 63% / >>>> devfs 1.0K 1.0K 0B >>>> 100% /dev >>>> tmpfs 10M 2.6M 7.4M >>>> 26% /etc >>>> tmpfs 10M 180K 9.8M >>>> 2% /var >>>> /dev/md0 19M 24K 17M >>>> 0% /tmp >>>> % cat mount >>>> 192.168.233.1:/b/tftpboot/FreeBSD/install/ on / (nfs, read-only) >>>> devfs on /dev (devfs, local, multilabel) >>>> tmpfs on /etc (tmpfs, local) >>>> tmpfs on /var (tmpfs, local) >>>> /dev/md0 on /tmp (ufs, local) >>>>=20 >>>>=20 >>>> -Jia-Shiun. >>>=20 >>> FYI, I just posted a patchset to freebsd-arch@ and freebsd-rc@ to >>> address this in a slightly different way.=20 >>>=20 >>> = http://lists.freebsd.org/pipermail/freebsd-arch/2014-March/015141.html >>>=20 >>> Basically I updated the mdmfs program to automatically use tmpfs if = it's >>> available in the kernel and the device name is "auto", along with >>> changes to rc.initdiskless and defaults/rc.conf to set the device = name >>> to "auto" by default. >>>=20 >>=20 >> Cool. So assume it would then be added to the (new) RPI-B and ALIX >> kernels. Am I correct? >>=20 >> g >>=20 >=20 > Yeah, for the kernel side of it, I'm just adding TMPFS to > arm/conf/DEFAULTS since the concensus seems to be that we want it in = all > kernels. I'm waiting for a universe-kernels build to finish and if = it's > clean I'll commit that tonight. DEFAULTS was never intended for something like this.. Only for things = that must be mandatory or very nearly mandatory for the system to operate. = While useful, this isn=92t mandatory by any stretch of the imagination. I = strongly object to putting it there, so please don=92t commit it to DEFAULTS. > For the other part of it, we'll see what feedback comes from the = review > on the other lists, it may not get committed for a few days. Those looked good to me. Warner=