linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Mathias Thore <Mathias.Thore@infinera.com>
Cc: Chris Packham <Chris.Packham@alliedtelesis.co.nz>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>
Subject: Re: Regression for NOR flash with multiple erase block regions
Date: Mon, 25 Sep 2017 11:45:36 +0200	[thread overview]
Message-ID: <20170925114536.16ed16aa@bbrezillon> (raw)
In-Reply-To: <e30ea1c1d62348bb80cb7eb5d4c8d71a@sv-ex13-prd1.infinera.com>

On Mon, 25 Sep 2017 08:57:24 +0000
Mathias Thore <Mathias.Thore@infinera.com> wrote:

> > -----Original Message-----
> > From: Boris Brezillon [mailto:boris.brezillon@free-electrons.com]
> > Sent: den 25 september 2017 10:14
> > 
> > On Mon, 25 Sep 2017 08:05:03 +0000
> > Mathias Thore <Mathias.Thore@infinera.com> wrote:
> >   
> > > > -----Original Message-----
> > > > From: Boris Brezillon [mailto:boris.brezillon@free-electrons.com]
> > > > Sent: den 25 september 2017 09:30
> > > >
> > > > On Mon, 25 Sep 2017 06:28:18 +0000
> > > > Mathias Thore <Mathias.Thore@infinera.com> wrote:
> > > >  
> > > > > > From: Boris Brezillon
> > > > > > [mailto:boris.brezillon@free-electrons.com]
> > > > > > Sent: den 22 september 2017 22:05
> > > > > >
> > > > > > On Fri, 22 Sep 2017 18:27:42 +0000 Chris Packham
> > > > > > <Chris.Packham@alliedtelesis.co.nz> wrote:
> > > > > >  
> > > > > > > Hi Mathias,
> > > > > > >
> > > > > > > On 23/09/17 01:12, Mathias Thore wrote:  
> > > > > > > > Hello,
> > > > > > > >
> > > > > > > > Commit 1eeef2d7483a7e3f8d2dd2a5b9939b3b814dc549 included  
> > in  
> > > > > > > > Linux  
> > > > > > 4.13 (  
> > > > > > > >  
> > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.g
> > > > > > it/c
> > > > > > ommit/d
> > > > > >  
> > > >  
> > rivers/mtd/mtdpart.c?h=v4.13&id=1eeef2d7483a7e3f8d2dd2a5b9939b3b814  
> > > > > > dc549  
> > > > > > > > ) introduces a regression for NOR flash with multiple erase
> > > > > > > > block regions of different sizes.
> > > > > > > >
> > > > > > > > Only the largest erase block size seems to be considered
> > > > > > > > when determining if partitions are aligned. Partitions in
> > > > > > > > smaller regions will be mounted as read-only. With Linux
> > > > > > > > 4.12 and earlier, read/write access was available for these  
> > partitions.  
> > > > > >
> > > > > > I don't understand how this could work before this patch? I
> > > > > > mean, we were previously using mtd_mod_by_eb() to check part
> > > > > > alignment and this functions is just returning the remainder of
> > > > > > the off / erasesize division. So, assuming the erasesize of your
> > > > > > NOR did not change between 4.12 and 4.13, I don't see how this
> > > > > > commit could cause the regression you're describing here.  
> > > > >
> > > > > Looking at the earlier code, in the call to mtd_mod_by_eb, the
> > > > > parameter  
> > > > is slave->mtd. The slave mtd struct holds the correct erase size.
> > > > The new code uses wr_alignment for all alignment tests, which comes
> > > > from master/parent, and seems to always hold the largest possible erase  
> > size.  
> > > >
> > > > Oh indeed! I didn't notice that the initial mtd_mod_by_eb() test was
> > > > done against the slave dev and not the master one.
> > > >
> > > > Can you test the following patch and let me know it it solves your  
> > problem?  
> > >
> > > The patch does not compile in my 4.13 tree. However,
> > >
> > > 	if (!(slave->mtd.flags & MTD_NO_ERASE))
> > > 		wr_alignment = slave->mtd.erasesize; or
> > > 	if (!(master->flags & MTD_NO_ERASE))
> > > 		wr_alignment = slave->mtd.erasesize;
> > >
> > > do, and both work equally well to solve my problem.  
> > 
> > Oops. I'll fix that and send a new version.
> > 
> > Thanks,
> > 
> > Boris
> >   
> 
> Thank you for solving this problem!

No problem. Actually you're the one who found the bug and reported it
(and almost fixed it), so you're the one we should thank.

BTW, can you add your Tested-by/Reviewed-by on the last version? I'll
queue it for the next -rc.

Thanks,

Boris

  reply	other threads:[~2017-09-25  9:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4762f230bbd3437990b9f5baa61ab095@sv-ex13-prd1.infinera.com>
2017-09-22 18:27 ` Regression for NOR flash with multiple erase block regions Chris Packham
2017-09-22 20:04   ` Boris Brezillon
2017-09-25  6:28     ` Mathias Thore
2017-09-25  7:30       ` Boris Brezillon
2017-09-25  8:05         ` Mathias Thore
2017-09-25  8:14           ` Boris Brezillon
2017-09-25  8:57             ` Mathias Thore
2017-09-25  9:45               ` Boris Brezillon [this message]
2017-09-22 13:15 Mathias Thore

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=20170925114536.16ed16aa@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=Chris.Packham@alliedtelesis.co.nz \
    --cc=Mathias.Thore@infinera.com \
    --cc=linux-mtd@lists.infradead.org \
    /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).