From owner-freebsd-arm@FreeBSD.ORG Thu Dec 20 20:07:39 2012 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6B50BA95 for ; Thu, 20 Dec 2012 20:07:39 +0000 (UTC) (envelope-from jmg@h2.funkthat.com) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) by mx1.freebsd.org (Postfix) with ESMTP id 1F0598FC0C for ; Thu, 20 Dec 2012 20:07:38 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id qBKK7TG7081746 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 20 Dec 2012 12:07:29 -0800 (PST) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id qBKK7S0p081745; Thu, 20 Dec 2012 12:07:28 -0800 (PST) (envelope-from jmg) Date: Thu, 20 Dec 2012 12:07:28 -0800 From: John-Mark Gurney To: Ian Lepore Subject: Re: nand performance Message-ID: <20121220200728.GK1563@funkthat.com> Mail-Followup-To: Ian Lepore , freebsd-arm@freebsd.org References: <1355964085.1198.255.camel@revolution.hippie.lan> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1355964085.1198.255.camel@revolution.hippie.lan> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Thu, 20 Dec 2012 12:07:29 -0800 (PST) Cc: freebsd-arm@freebsd.org X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 20:07:39 -0000 Ian Lepore wrote this message on Wed, Dec 19, 2012 at 17:41 -0700: > I've been working to get nandfs going on a low-end Atmel arm system. > Performance is horrible. Last weekend I got my nand-based DreamPlug > unbricked and got nandfs working on it too. Performance is horrible. > > By that I'm referring not to the slow nature of the nand chips > themselves, but to the fact that accessing them locks out userland > processes, sometimes for many seconds at a time. The problem is real > easy to see, just format and populate a nandfs filesystem, then do > something like this > > mount -r -t nandfs /dev/gnand0s.root /mnt > nice +20 find /mnt -type f | xargs -J% cat % > /dev/null > > and then try to type in another terminal -- sometimes what you're typing > doesn't get echoed for 10+ seconds a time. > > The problem is that the "I/O" on a nand chip is really just the cpu > copying from one memory interface to another, a byte at a time, and it > must also use busy-wait loops to wait for chip-ready and status info. > This is being done by high-priority kernel threads, so everything else > is locked out. > > It seems to me that this is about the same situation as classic ATA PIO > mode, but PIO doesn't make a system that unresponsive. > > I'm curious what techniques are used to migitate performance problems > for ATA PIO modes, and whether we can do something similar for nand. I > poked around a bit in dev/ata but the PIO code I saw (which surely > wasn't the whole picture) just used a bus_space_read_multi(). Can > someone clue me in as to how ATA manages to do PIO without usurping the > whole system? Looks like the problem is all the DELAY calls in dev/nand/nand_generic.c.. DELAY is a busy wait not letting the cpu do anything else... The bad one is probably generic_erase_block as it looks like the default is 3ms, plenty of time to let other code run... If it could be interrupt driven, that'd be best... I can't find the interface that would allow sub-hz sleeping, but there is tsleep that could be used for some of the larger sleeps... But switching to interrupts + wakeup would be best... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."