From: Keith Busch <kbusch@kernel.org>
To: Nilay Shroff <nilay@linux.ibm.com>
Cc: linux-nvme@lists.infradead.org
Subject: Re: [PATCH RESEND] nvme-pci: Fix EEH failure on ppc after subsystem reset
Date: Sat, 9 Mar 2024 08:44:43 -0700 [thread overview]
Message-ID: <ZeyD6xh0LGZyRBfO@kbusch-mbp> (raw)
In-Reply-To: <039541c8-2e13-442e-bd5b-90a799a9851a@linux.ibm.com>
On Sat, Mar 09, 2024 at 07:59:11PM +0530, Nilay Shroff wrote:
> On 3/8/24 21:11, Keith Busch wrote:
> > On Fri, Feb 09, 2024 at 10:32:16AM +0530, Nilay Shroff wrote:
> >> @@ -2776,6 +2776,14 @@ static void nvme_reset_work(struct work_struct *work)
> >> out_unlock:
> >> mutex_unlock(&dev->shutdown_lock);
> >> out:
> >> + /*
> >> + * If PCI recovery is ongoing then let it finish first
> >> + */
> >> + if (pci_channel_offline(to_pci_dev(dev->dev))) {
> >> + dev_warn(dev->ctrl.device, "PCI recovery is ongoing so let it finish\n");
> >> + return;
> >> + }
> >> +
> >> /*
> >> * Set state to deleting now to avoid blocking nvme_wait_reset(), which
> >> * may be holding this pci_dev's device lock.
> >> @@ -3295,9 +3303,11 @@ static pci_ers_result_t nvme_error_detected(struct pci_dev *pdev,
> >> case pci_channel_io_frozen:
> >> dev_warn(dev->ctrl.device,
> >> "frozen state error detected, reset controller\n");
> >> - if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RESETTING)) {
> >> - nvme_dev_disable(dev, true);
> >> - return PCI_ERS_RESULT_DISCONNECT;
> >> + if (nvme_ctrl_state(&dev->ctrl) != NVME_CTRL_RESETTING) {
> >> + if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RESETTING)) {
> >> + nvme_dev_disable(dev, true);
> >> + return PCI_ERS_RESULT_DISCONNECT;
> >> + }
> >> }
> >> nvme_dev_disable(dev, false);
> >> return PCI_ERS_RESULT_NEED_RESET;
> >
> > I get what you're trying to do, but it looks racy. The reset_work may
> > finish before pci sets channel offline, or the error handling work
> > happens to see RESETTING state, but then transitions to CONNECTING state
> > after and deadlocks on the '.resume()' side. You are counting on a very
> > specific sequence tied to the PCIe error handling module, and maybe you
> > are able to count on that sequence for your platform in this unique
> > scenario, but these link errors could happen anytime.
> >
> I am not sure about the deadlock in '.resume()' side you mentioned above.
> Did you mean that deadlock occur due to someone holding this pci_dev's device lock?
> Or deadlock occur due to the flush_work() from nvme_error_resume() would never
> return?
Your patch may observe a ctrl in "RESETTING" state from
error_detected(), then disable the controller, which quiesces the admin
queue. Meanwhile, reset_work may proceed to CONNECTING state and try
nvme_submit_sync_cmd(), which blocks forever because no one is going to
unquiesce that admin queue.
next prev parent reply other threads:[~2024-03-09 15:44 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-09 5:02 [PATCH RESEND] nvme-pci: Fix EEH failure on ppc after subsystem reset Nilay Shroff
2024-02-22 21:00 ` Greg Joyce
[not found] ` <2c76725c-7bb6-4827-b45a-dbe1acbefba7@imap.linux.ibm.com>
2024-02-27 18:14 ` Nilay Shroff
2024-02-27 18:29 ` Keith Busch
2024-02-28 11:19 ` Nilay Shroff
2024-02-29 12:27 ` Nilay Shroff
2024-03-06 11:20 ` Nilay Shroff
2024-03-06 15:19 ` Keith Busch
2024-03-08 15:41 ` Keith Busch
2024-03-09 14:29 ` Nilay Shroff
2024-03-09 15:44 ` Keith Busch [this message]
2024-03-09 19:05 ` Nilay Shroff
2024-03-11 4:41 ` Keith Busch
2024-03-11 12:58 ` Nilay Shroff
2024-03-12 14:30 ` Keith Busch
2024-03-13 11:59 ` Nilay Shroff
2024-03-22 5:02 ` Nilay Shroff
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=ZeyD6xh0LGZyRBfO@kbusch-mbp \
--to=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=nilay@linux.ibm.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).