linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Brian Norris <computersforpeace@gmail.com>
Cc: Artem Bityutskiy <dedekind1@gmail.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	linux-mtd@lists.infradead.org,
	Richard Weinberger <richard@nod.at>
Subject: Re: [PATCH v2] UBI: only read necessary size when reading the VID header
Date: Mon, 4 Jul 2016 15:52:37 +0200	[thread overview]
Message-ID: <20160704155237.2c05e72f@bbrezillon> (raw)
In-Reply-To: <20160628174638.GB80724@google.com>

On Tue, 28 Jun 2016 10:46:38 -0700
Brian Norris <computersforpeace@gmail.com> wrote:

> Hi,
> 
> On Tue, Jun 28, 2016 at 05:54:08PM +0300, Artem Bityutskiy wrote:
> > On Tue, 2016-06-28 at 16:05 +0200, Sascha Hauer wrote:  
> > > The gpmi NAND driver allows reading subpages (NAND_SUBPAGE_READ is
> > > set), but
> > > it does not allow writing subpages (NAND_NO_SUBPAGE_WRITE is also
> > > set).  
> > 
> > OK. In the generic code (nand_base.c) though you can find that if the
> > read request is for entire page or subpage, then the data is transfared
> > from the chip to the supplied buffer, ECC is verified, and the data are
> > returned. If the read request is for a fraction of a page or subpage,
> > then the data are transferred from the chip to an internal buffer, ECC
> > is verified, and then the required piece of data are copied from the
> > internal buffer to the supplied buffer. I.e., more memory copy
> > operations.
> > 
> > The code is very twisted, but I think the logic is in
> > 'nand_do_read_ops()', you'll notice that in the "not aligned" case the
> > special 'chip->buffers->databuf' is used, otherwise the buffer supplied
> > by UBI is used.  
> 
> Note that "not aligned" means "not aligned to mtd->writesize", and that
> writesize is NOT the subpage size. So if some controller+flash+driver
> actually supports subpage writes (there are few of these), then UBI
> might already be requesting sub-page reads, and those reads are still
> memcpy()'d in nand_do_read_ops(). This doesn't change the argument too
> much, I suppose; it just means we have a bug in nand_do_read_ops() I
> guess.

Is this really a bug, or just a sub-optimal implementation?

  reply	other threads:[~2016-07-04 13:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-28 11:51 [PATCH v2] UBI: only read necessary size when reading the VID header Sascha Hauer
2016-06-28 12:05 ` Richard Weinberger
2016-06-28 13:00 ` Artem Bityutskiy
2016-06-28 13:32   ` Richard Weinberger
2016-06-28 14:05   ` Sascha Hauer
2016-06-28 14:54     ` Artem Bityutskiy
2016-06-28 17:46       ` Brian Norris
2016-07-04 13:52         ` Boris Brezillon [this message]
2016-06-28 17:49     ` Brian Norris
2016-06-29  3:51       ` Artem Bityutskiy
2016-06-28 17:43   ` Brian Norris
2016-06-29  3:49     ` Artem Bityutskiy
2016-07-04  9:38       ` Boris Brezillon
2016-07-04 22:24         ` Richard Weinberger

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=20160704155237.2c05e72f@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=dedekind1@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=s.hauer@pengutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).