From: Keith Busch <kbusch@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Judy Brock <judy.brock@samsung.com>,
Edmund Nadolski <edmund.nadolski@intel.com>,
Sagi Grimberg <sagi@grimberg.me>,
linux-nvme@lists.infradead.org,
James Smart <james.smart@broadcom.com>
Subject: Re: [PATCHv3 4/5] nvme: Prevent resets during paused controller state
Date: Fri, 11 Oct 2019 01:17:27 +0900 [thread overview]
Message-ID: <20191010161727.GA22430@washi1.fujisawa.hgst.com> (raw)
In-Reply-To: <20191010160911.GA1868@lst.de>
On Thu, Oct 10, 2019 at 06:09:11PM +0200, Christoph Hellwig wrote:
> On Fri, Oct 11, 2019 at 01:05:26AM +0900, Keith Busch wrote:
> > +/*
> > + * Use this function to proceed with scheduling reset_work for a controller
> > + * that had previously been set to the resetting state. This is intended for
> > + * code paths that can't be interrupted by other reset attempts.
> > + */
> > +static int nvme_reset_schedule(struct nvme_ctrl *ctrl)
> > +{
> > + if (ctrl->state != NVME_CTRL_RESETTING)
> > + return -EBUSY;
> > + if (!queue_work(nvme_reset_wq, &ctrl->reset_work))
> > + return -EBUSY;
> > + return 0;
> > +}
> > +
> > int nvme_reset_ctrl(struct nvme_ctrl *ctrl)
> > {
> > if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING))
> > @@ -3829,13 +3843,13 @@ static void nvme_fw_act_work(struct work_struct *work)
> > if (time_after(jiffies, fw_act_timeout)) {
> > dev_warn(ctrl->device,
> > "Fw activation timeout, reset controller\n");
> > - nvme_reset_ctrl(ctrl);
> > - break;
> > + nvme_reset_schedule(ctrl);
> > + return;
>
> I don't really see a point in that nvme_reset_schedule helper,
> especially as the name is a little confusing. Moving the comment here
> and just open coding a
>
> if (ctrl->state == NVME_CTRL_RESETTING)
> queue_work(nvme_reset_wq, &ctrl->reset_work))
>
> would seem much more obvious and matches the nvme_handle_aen_notice
> side.
Until a moment ago, I thought nvme_reset_wq was a local static, which is
why I needed to provide an exportable function so drivers can schedule on
it. I see now that symbolis exported for some reason despite no external
users, but since it is exported, we can duplicate this "if (RESETTING)
queue_work()" stuff from the pci driver.
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2019-10-10 16:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-10 16:05 [PATCHv3 0/5] nvme: double reset prevention Keith Busch
2019-10-10 16:05 ` [PATCHv3 1/5] nvme-pci: Free tagset if no IO queues Keith Busch
2019-10-10 16:05 ` [PATCHv3 2/5] nvme: Remove ADMIN_ONLY state Keith Busch
2019-10-10 16:05 ` [PATCHv3 3/5] nvme: Restart request timers in resetting state Keith Busch
2019-10-10 16:05 ` [PATCHv3 4/5] nvme: Prevent resets during paused controller state Keith Busch
2019-10-10 16:09 ` Christoph Hellwig
2019-10-10 16:17 ` Keith Busch [this message]
2019-10-10 16:05 ` [PATCHv3 5/5] nvme: Wait for reset state when required Keith Busch
2019-10-10 16:18 ` Christoph Hellwig
2019-10-10 16:30 ` Keith Busch
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=20191010161727.GA22430@washi1.fujisawa.hgst.com \
--to=kbusch@kernel.org \
--cc=edmund.nadolski@intel.com \
--cc=hch@lst.de \
--cc=james.smart@broadcom.com \
--cc=judy.brock@samsung.com \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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).