From patchwork Tue Jul 28 17:19:56 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Holmberg X-Patchwork-Id: 30310 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id 91350B7B5C for ; Wed, 29 Jul 2009 03:22:38 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1MVqLP-0004xh-9y; Tue, 28 Jul 2009 17:20:07 +0000 Received: from west-smtp1.trimble.com ([155.63.128.51]) by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux)) id 1MVqLJ-0004N5-Rg for linux-mtd@lists.infradead.org; Tue, 28 Jul 2009 17:20:02 +0000 Received: (qmail 3094 invoked by uid 501); 28 Jul 2009 11:19:56 -0600 Received: from 10.1.80.133 by west-smtp1.trimble.com (envelope-from , uid 108) with qmail-scanner-2.07 (clamdscan: 0.95.2/9624. sophie: 3.06/2.88.0/4.43. spamassassin: 3.2.5. Clear:RC:1(10.1.80.133):. Processed in 0.033367 secs); 28 Jul 2009 17:19:56 -0000 Received: from unknown (HELO usw-am-xch-02.am.trimblecorp.net) (10.1.80.133) by west-smtp1.trimble.com with SMTP; 28 Jul 2009 11:19:56 -0600 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: RE: UBIFS Corrupt during power failure Date: Tue, 28 Jul 2009 11:19:56 -0600 Message-ID: In-Reply-To: <4A6EE895.9050008@gmx.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: UBIFS Corrupt during power failure Thread-Index: AcoPezDXDK+7ngl+RjO/X4Tiu/dYNwAKXOUA References: <1239979018.3390.298.camel@localhost.localdomain> <200905150916.54091.sr@denx.de> <1244016510.5847.38.camel@localhost.localdomain> <1244369819.5847.321.camel@localhost.localdomain> <4A6EE895.9050008@gmx.de> From: "Eric Holmberg" To: "news" , X-Spam-Score: 0.0 (/) Cc: linux-mtd@lists.infradead.org, Stefan Roese , Jamie Lokier , Adrian Hunter X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org > We have similar problems with a SPANSION falsh (S29GL01GP). > I think the reason of the problem is a feature of the chip. > > I reduced the problem to the MTD access (without ubi/ubifs). > We noticed toggle flash-bit(s) after power off during a write cycle. > The toggle flash-bit(s) may occure after power of during an > sector-erase > too. > > Simple testsequence: > * flash_erase ... > * cp testfile /dev/mtd0 > - automatic or manuel power off during the cp > Check the flash after reboot (e.g md5sum /dev/mtd0 helps). > > We used the default settings from the CFI (MaxBufWriteSize=6 > == 64 byte > buffer). I think writing to /dev/mtd0 will also perform an erase if needed, so you are probably seeing the interrupted erase. If you're doing this because you are having UBIFS errors, then you should set the MaxBufWriteSize to 3 to limit the write size to 2^3=8 bytes since this is a known problem. Here's the patch (it's also attached to this email) for the debug code that I added to limit the write buffer size to 2**3=8 bytes and have been using for all of the recent robustness testing. I'm using the S29GL256 chip (256Mbit) which is in the same family as your S29GL01G (1Gbit), so with this patch and the latest patches from http://git.infradead.org/users/dedekind/ubifs-v2.6.27.git should get you to the same place that I'm at. So far, with over 10,000 power cycles, I haven't seen any problems. -Eric #ifdef DEBUG_CFI /* Dump the information therein */ print_cfi_ident(cfi->cfiq); Index: drivers/mtd/chips/cfi_probe.c =================================================================== --- drivers/mtd/chips/cfi_probe.c (revision 4477) +++ drivers/mtd/chips/cfi_probe.c (working copy) @@ -18,7 +18,7 @@ #include #include -//#define DEBUG_CFI +#define DEBUG_CFI #ifdef DEBUG_CFI static void print_cfi_ident(struct cfi_ident *); @@ -251,6 +251,18 @@ cfi->cfiq->InterfaceDesc = le16_to_cpu(cfi->cfiq->InterfaceDesc); cfi->cfiq->MaxBufWriteSize = le16_to_cpu(cfi->cfiq->MaxBufWriteSize); + //DEBUG - BEGIN - force max write size to 8 bytes (2^3) + if (cfi->cfiq->MaxBufWriteSize) + { + printk("Warning: Overriding MaxBufWriteSize from 2^%d to 2^%d\n", + cfi->cfiq->MaxBufWriteSize, + 3 + ); + cfi->cfiq->MaxBufWriteSize = 3; + } + //DEBUG - END + +