stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Boris Brezillon <boris.brezillon@bootlin.com>
Cc: Richard Weinberger <richard@nod.at>,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	linux-mtd@lists.infradead.org,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Nadav Haklai <nadavh@marvell.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] mtd: rawnand: marvell: prevent timeouts on a loaded machine
Date: Sat, 15 Dec 2018 14:54:03 +0100	[thread overview]
Message-ID: <20181215145403.5d4897a2@xps13> (raw)
In-Reply-To: <20181215134137.44a79f14@bbrezillon>

Hi Boris,

Boris Brezillon <boris.brezillon@bootlin.com> wrote on Sat, 15 Dec 2018
13:41:37 +0100:

> On Tue, 11 Dec 2018 18:38:28 +0100
> Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> 
> > marvell_nfc_wait_op() waits for completion during 'timeout_ms'
> > milliseconds before throwing an error. While the logic is fine, the
> > value of 'timeout_ms' is given by the core and actually correspond to
> > the maximum time the NAND chip will take to complete the
> > operation. Assuming there is no overhead in the propagation of the
> > interrupt signal to the the NAND controller (through the Ready/Busy
> > line), this delay does not take into account the latency of the
> > operating system. For instance, for a page write, the delay given by
> > the core is rounded up to 1ms. Hence, when the machine is over loaded,
> > there is chances that this timeout will be reached.
> > 
> > There are two ways to solve this issue that are not incompatible:
> > 1/ Enlarge the timeout value (if so, how much?).
> > 2/ Check after the waiting method if we did not miss any interrupt
> > because of the OS latency (an interrupt is still pending). In this
> > case, we assume the operation exited successfully.
> > 
> > We choose the second approach that is a must in all cases, with the
> > possibility to also modify the timeout value to be, e.g. at least 1
> > second in all cases.
> > 
> > Fixes: 02f26ecf8c77 ("mtd: nand: add reworked Marvell NAND controller driver")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > ---
> >  drivers/mtd/nand/raw/marvell_nand.c | 17 ++++++++++++++---
> >  1 file changed, 14 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c
> > index e6c3739cea73..bc0eef4ade4f 100644
> > --- a/drivers/mtd/nand/raw/marvell_nand.c
> > +++ b/drivers/mtd/nand/raw/marvell_nand.c
> > @@ -514,9 +514,14 @@ static void marvell_nfc_enable_int(struct marvell_nfc *nfc, u32 int_mask)
> >  	writel_relaxed(reg & ~int_mask, nfc->regs + NDCR);
> >  }
> >  
> > -static void marvell_nfc_clear_int(struct marvell_nfc *nfc, u32 int_mask)
> > +static int marvell_nfc_clear_int(struct marvell_nfc *nfc, u32 int_mask)  
> 
> 	  ^ u32 ?
> 
> With this fixed:
> 
> Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>

Applied with your change to nand/next.

Thanks,
Miquèl

      reply	other threads:[~2018-12-15 13:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-11 17:38 [PATCH] mtd: rawnand: marvell: prevent timeouts on a loaded machine Miquel Raynal
2018-12-15 12:41 ` Boris Brezillon
2018-12-15 13:54   ` Miquel Raynal [this message]

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=20181215145403.5d4897a2@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=boris.brezillon@bootlin.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=nadavh@marvell.com \
    --cc=richard@nod.at \
    --cc=stable@vger.kernel.org \
    --cc=thomas.petazzoni@bootlin.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).