public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* UBI crashes / fixing NAND subpage writes
@ 2010-09-01  7:40 Jon Povey
  2010-09-01 23:10 ` Artem Bityutskiy
  0 siblings, 1 reply; 2+ messages in thread
From: Jon Povey @ 2010-09-01  7:40 UTC (permalink / raw)
  To: linux-mtd@lists.infradead.org
  Cc: davinci-linux-open-source@linux.davincidsp.com

I have been playing with UBI/UBIFS on 2KB page NAND, on TI DaVinci DM355 and having crashes due to subpage write problems.

ubiattach with -O 2048 avoids the problem, but I want to fix it, and use the flash more efficiently in space and time.

The DaVinci family generate 10 bytes of ECC in hardware for each 512 bytes of data; on 2KB page NAND the 4x10 bytes of ECC are concatenated together at the end of a page.

The problem is that the ECC generated for an all-FFs page is not all-FFs, and subpage writes are handled by nand_do_write_ops() by writing a full page with FFs in the unset data areas.

When UBI attaches it detects the subpage size as 512 bytes and tries to do two subpage writes, which results in two writes of (different) non-FF ECC data, causing corrupt ECC. An ubiattach, ubidetach, ubiattach sequence puts the kernel into a loop torturing the same block over and over, repeating these lines:

UBI error: ubi_io_read: error -74 while reading 512 bytes from PEB 2:512, read 512 bytes
UBI error: ubi_io_read: error -74 while reading 512 bytes from PEB 263:512, read 512 bytes
UBI: run torture test for PEB 263
UBI: PEB 263 passed torture test, do not mark it a bad

I hacked around this as a proof-of-concept by checking for an all-FF subpage in nand_write_page_hwecc() and setting that subpage's ECC to all-FFs, which works - I can attach, detatch, reattach, mount, write files, etc.

Of course this is not a very good solution. The right thing to do would seem to be make nand_do_write_ops() properly subpage aware and either add start and end offsets to the nand_write_page* family of functions, or add a nand_write_subpage* family of functions.

I don't mind having a go at some of this but am not confident to start such major overhaul of nand_base.c without at least seeking comment from others, so: This email. Maybe there's already something being worked on?

Comments welcome...

--
Jon Povey
jon.povey@racelogic.co.uk

Racelogic is a limited company registered in England. Registered number 2743719 .
Registered Office Unit 10, Swan Business Centre, Osier Way, Buckingham, Bucks, MK18 1TB .

The information contained in this electronic mail transmission is intended by Racelogic Ltd for the use of the named individual or entity to which it is directed and may contain information that is confidential or privileged. If you have received this electronic mail transmission in error, please delete it from your system without copying or forwarding it, and notify the sender of the error by reply email so that the sender's address records can be corrected. The views expressed by the sender of this communication do not necessarily represent those of Racelogic Ltd. Please note that Racelogic reserves the right to monitor e-mail communications passing through its network

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: UBI crashes / fixing NAND subpage writes
  2010-09-01  7:40 UBI crashes / fixing NAND subpage writes Jon Povey
@ 2010-09-01 23:10 ` Artem Bityutskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2010-09-01 23:10 UTC (permalink / raw)
  To: Jon Povey
  Cc: davinci-linux-open-source@linux.davincidsp.com,
	linux-mtd@lists.infradead.org

On Wed, 2010-09-01 at 08:40 +0100, Jon Povey wrote:
> Of course this is not a very good solution. The right thing to do
> would seem to be make nand_do_write_ops() properly subpage aware and
> either add start and end offsets to the nand_write_page* family of
> functions, or add a nand_write_subpage* family of functions.
> 
> I don't mind having a go at some of this but am not confident to start
> such major overhaul of nand_base.c without at least seeking comment
> from others, so: This email. Maybe there's already something being
> worked on?

I think nand_write_subpage() is a good way do deal with this. If the
chip does not define own nand_write_subpage(), we fall-back to the
default one which uses the current way.

-- 
Best Regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-09-01 23:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-01  7:40 UBI crashes / fixing NAND subpage writes Jon Povey
2010-09-01 23:10 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox