Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: hch@lst.de (Christoph Hellwig)
Subject: [PATCH 2/5] nvme: introduce a controller state machine
Date: Wed, 27 Apr 2016 09:50:31 +0200	[thread overview]
Message-ID: <20160427075031.GA28726@lst.de> (raw)
In-Reply-To: <20160426161833.GA13324@localhost.localdomain>

On Tue, Apr 26, 2016@10:18:34AM -0600, Jon Derrick wrote:
> Hi Christoph,
> 
> > @@ -1835,7 +1829,7 @@ static void nvme_reset_work(struct work_struct *work)
> >  	struct nvme_dev *dev = container_of(work, struct nvme_dev, reset_work);
> >  	int result = -ENODEV;
> >  
> > -	if (WARN_ON(test_bit(NVME_CTRL_RESETTING, &dev->flags)))
> > +	if (WARN_ON(dev->ctrl.state == NVME_CTRL_RESETTING))
> >  		goto out;
> >  
> >  	/*
> > @@ -1845,7 +1839,8 @@ static void nvme_reset_work(struct work_struct *work)
> >  	if (dev->ctrl.ctrl_config & NVME_CC_ENABLE)
> >  		nvme_dev_disable(dev, false);
> >  
> > -	set_bit(NVME_CTRL_RESETTING, &dev->flags);
> > +	if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RESETTING))
> > +		goto out;
> >  
> Seems redundant to above WARN_ON test

It's not - in theory someone could change the change in the meantime.
In the long run I really want to tighten things up and introduce
a new shuttdown down state that would be set where the WARN_ON currently
is, but I'd prefer to keep things simple for now as we have a lot of
bits that depend on the basic state machine.

  reply	other threads:[~2016-04-27  7:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-26 11:51 proper controller state machine and more common code V2 Christoph Hellwig
2016-04-26 11:51 ` [PATCH 1/5] nvme: remove the io_incapable method Christoph Hellwig
2016-04-26 15:24   ` Jon Derrick
2016-04-26 21:19   ` Sagi Grimberg
2016-04-26 11:51 ` [PATCH 2/5] nvme: introduce a controller state machine Christoph Hellwig
2016-04-26 16:18   ` Jon Derrick
2016-04-27  7:50     ` Christoph Hellwig [this message]
2016-04-26 11:51 ` [PATCH 3/5] nvme: tighten up state check for namespace scanning Christoph Hellwig
2016-04-26 16:40   ` Jon Derrick
2016-04-27  7:51     ` Christoph Hellwig
2016-04-26 11:51 ` [PATCH 4/5] nvme: move namespace scanning to core Christoph Hellwig
2016-04-26 17:16   ` Jon Derrick
2016-04-26 11:52 ` [PATCH 5/5] nvme: move AER handling to common code Christoph Hellwig
2016-05-02 15:10 ` proper controller state machine and more common code V2 Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2016-04-18 12:34 proper controller state machine and more common code Christoph Hellwig
2016-04-18 12:34 ` [PATCH 2/5] nvme: introduce a controller state machine Christoph Hellwig
2016-04-18 18:36   ` Sagi Grimberg
2016-04-18 20:17     ` Christoph Hellwig
2016-04-18 20:30       ` Sagi Grimberg
2016-04-19 18:25         ` Christoph Hellwig
2016-04-19 18:35           ` Sagi Grimberg
2016-04-19 18:37             ` Christoph Hellwig
2016-04-20 17:25               ` Sagi Grimberg

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=20160427075031.GA28726@lst.de \
    --to=hch@lst.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