public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Brian Norris <computersforpeace@gmail.com>
Cc: "Andrew E. Mileski" <andrewm@isoar.ca>,
	linux-mtd <linux-mtd@lists.infradead.org>,
	Scott Branden <sbranden@broadcom.com>
Subject: Re: Hang on reboot in nand_get_device()
Date: Mon, 9 Nov 2015 22:36:13 +0100	[thread overview]
Message-ID: <20151109223613.1e83b256@bbrezillon> (raw)
In-Reply-To: <20151109215508.7b14f5f3@bbrezillon>

Hi again,

Just want to add that this discussion shouldn't prevent your fix from
being applied. The main reason I'm arguing here is because I want to
understand the rationale behind the current handling of FL_PM_SUSPENDED
and FL_SHUTDOWN.

On Mon, 9 Nov 2015 21:55:08 +0100
Boris Brezillon <boris.brezillon@free-electrons.com> wrote:

> > > 
> > > diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> > > index ceb68ca..812b8b1 100644
> > > --- a/drivers/mtd/nand/nand_base.c
> > > +++ b/drivers/mtd/nand/nand_base.c
> > > @@ -830,6 +830,20 @@ nand_get_device(struct mtd_info *mtd, int new_state)
> > >  retry:
> > >         spin_lock(lock);
> > >  
> > > +       /* putting the NAND chip in shutdown state should always succeed. */
> > > +       if (new_state == FL_SHUTDOWN) {
> > > +               /*
> > > +                * release the controller if the chip put in shutdown state
> > > +                * is the current active device.
> > > +                */
> > > +               if (chip->controller->active == chip)
> > > +                       chip->controller->active = NULL;
> > > +
> > > +               chip->state = new_state;
> > > +               spin_unlock(lock);
> > > +               return 0;
> > > +       }
> > > +
> > >         /* Hardware controller shared among independent devices */
> > >         if (!chip->controller->active)
> > >                 chip->controller->active = chip;
> > > 
> > 
> > This looks a lot more subtle and potentially wrong. What exactly is the
> > rationale here? It appears you're kind of unlocking the controller (any
> > other flash on the same controller can still go ahead) but at the same
> > time forcing no further users of this particular flash.

It's even worst: I'm not waiting for the chip to become ready, so I'm
potentially re-introducing the bug Scott was trying to solve with his
reboot notifier.



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2015-11-09 21:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-02 19:21 Hang on reboot in nand_get_device() Andrew E. Mileski
2015-11-06 18:00 ` Brian Norris
2015-11-06 18:59   ` Boris Brezillon
2015-11-09 19:46     ` Brian Norris
2015-11-09 19:56       ` Andrew E. Mileski
2015-11-09 20:49         ` Scott Branden
2015-11-09 20:55       ` Boris Brezillon
2015-11-09 21:36         ` Boris Brezillon [this message]
2015-11-09 21:44           ` Brian Norris
2015-11-09 21:51             ` Scott Branden
2015-11-10  0:22               ` Brian Norris
2015-11-09 18:43   ` Andrew E. Mileski
2015-11-09 19:16     ` Brian Norris

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=20151109223613.1e83b256@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=andrewm@isoar.ca \
    --cc=computersforpeace@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=sbranden@broadcom.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