From: Boris Brezillon <boris.brezillon@collabora.com>
To: Chris Packham <Chris.Packham@alliedtelesis.co.nz>
Cc: "Joakim.Tjernlund@infinera.com" <Joakim.Tjernlund@infinera.com>,
"ikegami@allied-telesis.co.jp" <ikegami@allied-telesis.co.jp>,
Mark Tomlinson <Mark.Tomlinson@alliedtelesis.co.nz>,
Przemyslaw Sobon <psobon@amazon.com>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
"liujian56@huawei.com" <liujian56@huawei.com>,
"fbettoni@gmail.com" <fbettoni@gmail.com>
Subject: Re: mtd: cfi: Fixed endless loop problem in CFI when value was written but corrupted.
Date: Tue, 19 Feb 2019 09:00:01 +0100 [thread overview]
Message-ID: <20190219085946.64a1bd39@kernel.org> (raw)
In-Reply-To: <e945b943b2204d4d927391ffd068491d@svr-chch-ex1.atlnz.lc>
On Thu, 14 Feb 2019 00:39:09 +0000
Chris Packham <Chris.Packham@alliedtelesis.co.nz> wrote:
> Hi All,
>
> On 8/02/19 12:58 PM, Przemyslaw Sobon wrote:
> > Fixes: dfeae1073583(mtd: cfi_cmdset_0002: Change write buffer to
> > check correct value)
> >
> > There was an endless loop in CFI Flash driver when a value was written
> > incorrectly. In such case chip_ready returns true but chip_good returns
> > false and we never get out of the loop.
> >
> > The solution was to break the loop in 2 cases, either device is ready or
> > device is not ready and timeout elapsed. The correctness of the write is
> > checked after the loop ended. That way we ensure the loop always ends.
> >
> > Signed-off-by: Przemyslaw Sobon <psobon@amazon.com>
>
> Mark (cc'd) has done some testing here, and assuming he's happy with the
> forgery.
>
> Tested-by: Mark Tomlinson <Mark.Tomlinson@alliedtelesis.co.nz>
I'm a bit lost. Ikegami told us that checking for chip_ready() was not
enough and chip_good() could return true after a few tests even though
it initially returned false.
I'd really like to get that fixed, but it looks like you haven't reached
a consensus on what the appropriate fix is :-/.
>
> > ---
> > drivers/mtd/chips/cfi_cmdset_0002.c | 11 +++++++----
> > 1 file changed, 7 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
> > index 72428b6bfc47..6cc31d2057e9 100644
> > --- a/drivers/mtd/chips/cfi_cmdset_0002.c
> > +++ b/drivers/mtd/chips/cfi_cmdset_0002.c
> > @@ -1879,15 +1879,18 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
> > if (time_after(jiffies, timeo) && !chip_ready(map, adr))
> > break;
> >
> > - if (chip_good(map, adr, datum)) {
> > - xip_enable(map, chip, adr);
> > - goto op_done;
> > - }
> > + if (chip_ready(map, adr))
> > + break;
> >
> > /* Latency issues. Drop the lock, wait a while and retry */
> > UDELAY(map, chip, adr, 1);
> > }
> >
> > + if (chip_good(map, adr, datum)) {
> > + xip_enable(map, chip, adr);
> > + goto op_done;
> > + }
> > +
> > /*
> > * Recovery from write-buffer programming failures requires
> > * the write-to-buffer-reset sequence. Since the last part
> >
>
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2019-02-19 8:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-07 23:58 [PATCH] mtd: cfi: Fixed endless loop problem in CFI when value was written but corrupted Przemyslaw Sobon
2019-02-08 15:01 ` Tokunori Ikegami
2019-02-14 0:39 ` Chris Packham
2019-02-19 8:00 ` Boris Brezillon [this message]
2019-02-19 20:02 ` Mark Tomlinson
2019-02-20 8:03 ` Boris Brezillon
2019-02-20 20:50 ` Mark Tomlinson
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=20190219085946.64a1bd39@kernel.org \
--to=boris.brezillon@collabora.com \
--cc=Chris.Packham@alliedtelesis.co.nz \
--cc=Joakim.Tjernlund@infinera.com \
--cc=Mark.Tomlinson@alliedtelesis.co.nz \
--cc=fbettoni@gmail.com \
--cc=ikegami@allied-telesis.co.jp \
--cc=linux-mtd@lists.infradead.org \
--cc=liujian56@huawei.com \
--cc=psobon@amazon.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;
as well as URLs for NNTP newsgroup(s).