All of lore.kernel.org
 help / color / mirror / Atom feed
* MTD/NAND user-space ABI: interesting observation
@ 2014-02-15  2:05 Brian Norris
  0 siblings, 0 replies; only message in thread
From: Brian Norris @ 2014-02-15  2:05 UTC (permalink / raw)
  To: linux-mtd

Hi all,

Perhaps it's a non-issue, but I was realizing during some testing today
that there is no sound way to determine (in user-space) if a particular
raw read (i.e., from a /dev/mtdX) resulted in either a correctable bit
error or an uncorrectable ECC error. The current method used by
mtd-utils' nanddump is more or less a sequence of:

  ioctl(fd, ECCGETSTATS, &stat1);
  read(fd, buf, len);
  ioctl(fd, ECCGETSTATS, &stat2);
  if (stat2.corrected > stat1.corrected)
  	correctable bitflip;
  if (stat2.failed > stat1.failed)
  	uncorrectable error;

This is completely unsound if you are performing concurrent reads on the
same MTD device node (e.g., running two concurrent 'nanddump'
processes). The issue is pretty obvious once you study it, but I was
left scratching my head this afternoon when I had two separate nanddump
processes reporting bitflips at exactly the same times, at different
addresses!

I think this issue is probably not that important, since user-space raw
MTD accesses are really only good for testing/debugging, and any sane
solution would utilize a translation layer or special-purpose filesystem
(UBI, UBIFS, JFFS2, etc.) to handle -EUCLEAN and -EBADMSG (which is
presented properly in the MTD in-kernel API).

Just food for thought. Have a nice weekend!

Brian

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-02-15  2:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-15  2:05 MTD/NAND user-space ABI: interesting observation Brian Norris

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.