public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: "Brian Norris" <computersforpeace@gmail.com>
To: "Artem Bityutskiy" <dedekind1@gmail.com>
Cc: Mike Frysinger <vapier.adi@gmail.com>,
	Kevin Cernekee <cernekee@gmail.com>,
	b35362@freescale.com, linux-mtd@lists.infradead.org,
	Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Matthew Creech <mlcreech@gmail.com>
Subject: [RFC 0/5] fix data+OOB writes, add ioctl
Date: Wed, 17 Aug 2011 16:50:24 -0700	[thread overview]
Message-ID: <1313625029-19546-1-git-send-email-computersforpeace@gmail.com> (raw)

Hello all,

Warning: This patch series is not a finished product yet; it is merely a
"Request For Comments" on my goals, methods, etc. Please comment on
this, and in the near future, there may be a full update to this series.

First off, these fixes are motivated by a number of things:

1) Broken "noecc" writes; `nandwrite -n -o' does not work on my
   hardware, at least, without these patches

2) We cannot write twice to the same page on MLC NAND flash. Thus, the
   current implementation for nandwrite, where we write OOB and page
   data in two separate ioctl operations, will not work. We need a new
   ioctl. See this thread:

   http://lists.infradead.org/pipermail/linux-mtd/2011-August/037316.html

3) It is beneficial to expose the mtd_oob_mode_t options to the
   user-space, since we often want to use MTD_OOB_RAW, MTD_OOB_AUTO,
   etc. on a per-operation basis. This naturally fits in with a new
   ioctl that can handle different combinations of page data and OOB as
   well as different OOB modes. See some discussion:

   http://lists.infradead.org/pipermail/linux-mtd/2011-August/037511.html

Now, there are certainly some things that this patch series does NOT yet
do. I will list some now:

4) Base the old ioctls (MEMWRITEOOB, MEMWRITEOOB64) on the new one
   (MEMWRITEDATAOOB). In fact, the first two patches update support for
   the old ioctls, whereas they could simply be "merged" with the new
   one instead.

5) Gracefully handle cases where mtd->write_oob doesn't exist. It simply
   quits with -EOPNOTSUPP. I test all of this code on NAND flash only,
   and the NAND subsystem always supplies this function. If there is a
   need for this ioctl without OOB writes, then perhaps this can be
   fixed.

Other thoughts:

Patch 3/5 is a weird one. I know code that the patch targets is wrong
(since it's obviously assuming oobsize is a power of 2), but I'm not
sure the *exact* intention of the wrong code - so it's hard to be sure
that my fix is valid. Please look it over.

The name "MEMWRITEDATAOOB" is totally up for debate. This was the best I
could come up with at the moment.

Perhaps something should be done about the MTDFILEMODE ioctl, since it
seems to cause some confusing overlap, at least to me. I see two
different RAW modes:

* MTD_MODE_RAW, which belongs to the mode field in `struct
  mtd_file_info'. It can be set by the ioctl MTDFILEMODE
* MTD_OOB_RAW, which belongs to the mode field in `struct
  mtd_oob_ops'. It is set indirectly by other operations.

Does MTD_MODE_RAW imply MTD_OOB_RAW when OOB operations are involved?
Does MTD_MODE_RAW imply that no ECC is applied to data?
Is the MTD file mode persistent? If so, then it may conflict with a
"per-operation" mode in our new MEMWRITEDATAOOB

Maybe the "something" to be done would just be some better
documentation. Or something more drastic if there's an actual conflict.

Speaking of documentation, what is this supposed to mean (from struct
nand_chip, in include/linux/mtd/nand.h)?

	@oob_poi:            poison value buffer

It seems like the oob_poi buffer is meant to be an intermediary buffer
for storing the laid-out OOB data; it's used by the NAND subsystem,
especially in mode MTD_OOB_AUTO, to layout data to be written. But this
"documentation" means absolutely nothing to me. I'll edit that comment
in nand.h and include it in my revised patch series if I'm on the right
track.

OK, that's a lot to read :) Let me know if you have questions, and I'll
follow up with more info if there's something I left out.

Brian

Brian Norris (5):
  mtd: support MTD_MODE_RAW for writing OOB
  mtd: support MTD_MODE_RAW for reading OOB
  mtd: do not assume oobsize is power of 2
  mtd: move mtd_oob_mode_t to shared kernel/user space
  mtd: add MEMWRITEDATAOOB ioctl

 drivers/mtd/mtdchar.c        |   54 +++++++++++++++++++++++++++++++++--------
 drivers/mtd/nand/nand_base.c |   16 +++++++++++-
 include/linux/mtd/mtd.h      |   14 -----------
 include/mtd/mtd-abi.h        |   23 ++++++++++++++++++
 4 files changed, 80 insertions(+), 27 deletions(-)

             reply	other threads:[~2011-08-17 23:51 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-17 23:50 Brian Norris [this message]
2011-08-17 23:50 ` [RFC 1/5] mtd: support MTD_MODE_RAW for writing OOB Brian Norris
2011-08-22  8:35   ` Artem Bityutskiy
2011-08-22 20:08     ` Brian Norris
2011-08-23  4:47       ` Artem Bityutskiy
2011-08-23  5:25   ` Jason Liu
2011-08-23 19:57     ` Brian Norris
2011-08-17 23:50 ` [RFC 2/5] mtd: support MTD_MODE_RAW for reading OOB Brian Norris
2011-08-22  8:38   ` Artem Bityutskiy
2011-08-17 23:50 ` [RFC 3/5] mtd: do not assume oobsize is power of 2 Brian Norris
2011-08-22  8:46   ` Artem Bityutskiy
2011-08-22 20:21     ` Brian Norris
2011-08-17 23:50 ` [RFC 4/5] mtd: move mtd_oob_mode_t to shared kernel/user space Brian Norris
2011-08-22  8:50   ` Artem Bityutskiy
2011-08-22 21:43     ` Brian Norris
2011-08-23  5:30       ` Artem Bityutskiy
2011-08-23 17:24         ` Brian Norris
2011-08-17 23:50 ` [RFC 5/5] mtd: add MEMWRITEDATAOOB ioctl Brian Norris
2011-08-22  8:56   ` Artem Bityutskiy
2011-08-23  0:04     ` Brian Norris
2011-08-23  6:05       ` Artem Bityutskiy
2011-08-23  6:06       ` Artem Bityutskiy
2011-08-23  6:11       ` Artem Bityutskiy
2011-08-22 10:02 ` [RFC 0/5] fix data+OOB writes, add ioctl Artem Bityutskiy
2011-08-22 12:04   ` Ivan Djelic
2011-08-22 12:16     ` Artem Bityutskiy
2011-08-23  6:48       ` Ricard Wanderlof
2011-08-23 16:47         ` Brian Norris
2011-08-24 15:36           ` Ricard Wanderlof
2011-08-24 18:01             ` Brian Norris
2011-08-25  7:21               ` Artem Bityutskiy
2011-08-25  9:33               ` Ricard Wanderlof
2011-08-25 17:54                 ` Brian Norris
2011-08-26 12:41                   ` Ricard Wanderlof
2011-08-22 23:42   ` Brian Norris
2011-08-23  6:01     ` Artem Bityutskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1313625029-19546-1-git-send-email-computersforpeace@gmail.com \
    --to=computersforpeace@gmail.com \
    --cc=b35362@freescale.com \
    --cc=cernekee@gmail.com \
    --cc=dedekind1@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=mlcreech@gmail.com \
    --cc=vapier.adi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox