From: Daniel Wagner <dwagner@suse.de>
To: Nilay Shroff <nilay@linux.ibm.com>
Cc: John Meneghini <jmeneghi@redhat.com>,
Daniel Wagner <wagi@kernel.org>, Keith Busch <kbusch@kernel.org>,
Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
Sagi Grimberg <sagi@grimberg.me>,
James Smart <james.smart@broadcom.com>,
Hannes Reinecke <hare@suse.de>,
Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
Wen Xiong <wenxiong@linux.ibm.com>,
Narayana Murty N <nnmlinux@linux.ibm.com>,
linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
Ewan Milne <emilne@redhat.com>,
Maurizio Lombardi <mlombard@redhat.com>
Subject: Re: [PATCH 1/2] nvme: only allow entering LIVE from CONNECTING state
Date: Mon, 12 Jan 2026 09:14:33 +0100 [thread overview]
Message-ID: <d8512cdc-bdcd-44ff-a56a-974b4464a7a5@flourine.local> (raw)
In-Reply-To: <833fd772-da6c-4f91-87e3-e13883f1815d@linux.ibm.com>
Hi Nilay,
On Sun, Jan 11, 2026 at 03:03:43PM +0530, Nilay Shroff wrote:
> This was broken because with this commit d2fe192348f9 (“nvme: only allow entering LIVE
> from CONNECTING state”) now we don't allow changing controller state from
> RESETTING -> LIVE. I saw we also had similar state change issue with firmware activation
> code which was fixed by explicitly transitioning the controller state through RESETTING ->
> CONNECTING -> LIVE. We may employ the similar solution here for subsystem reset case as well.
>
> Currently, the NVMe PCIe subsystem reset code performs the following steps:
>
> 1. Sets the controller state to RESETTING
> 2. Writes the subsystem reset command to the NSSR register
> 3. Attempts to transition the controller state directly to LIVE
>
> This effectively bypasses the CONNECTING state. The transition to LIVE is artificial but
> intentional, since writing to the NSSR register causes the loss of communication with the
> NVMe adapter and the controller must be marked LIVE so that any in-flight I/O at the time the
> subsystem reset is issued, or an explicit MMIO read, can trigger EEH recovery and ultimately
> restore communication link between the NVMe adapter and the system.
>
> With the stricter state transition rules introduced by commit d2fe192348f9 (“nvme: only allow
> entering LIVE from CONNECTING state”), the direct transition from RESETTING -> LIVE is no longer
> permitted, rendering the current logic ineffective.
>
> Taking a cue from the firmware activation fix, it seems reasonable to explicitly transition
> the controller state through CONNECTING in the subsystem reset path as well. So how about making
> the following change to fix this?
>
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 0e4caeab739c..3027bba232de 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -1532,7 +1532,10 @@ static int nvme_pci_subsystem_reset(struct nvme_ctrl *ctrl)
> }
>
> writel(NVME_SUBSYS_RESET, dev->bar + NVME_REG_NSSR);
> - nvme_change_ctrl_state(ctrl, NVME_CTRL_LIVE);
> +
> + if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_CONNECTING) ||
> + !nvme_change_ctrl_state(ctrl, NVME_CTRL_LIVE))
> + goto unlock;
>
> /*
> * Read controller status to flush the previous write and trigger a
This seems to be similar to case where the firmware update got stuck [1].
650415fca0a9 ("nvme: unblock ctrl state transition for firmware update")
From my understanding this should work, but it's probably better to
double check that this doesn't violate any assumptions.
[1] https://lore.kernel.org/all/aBJJQoOBhaXj7P36@kbusch-mbp/
Thanks,
Daniel
next prev parent reply other threads:[~2026-01-12 8:14 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-14 8:02 [PATCH 0/2] nvme-fc: fix schedule in atomic context Daniel Wagner
2025-02-14 8:02 ` [PATCH 1/2] nvme: only allow entering LIVE from CONNECTING state Daniel Wagner
2025-02-20 10:34 ` Sagi Grimberg
2025-04-27 15:59 ` Guenter Roeck
2025-04-28 12:44 ` Daniel Wagner
2025-04-28 13:21 ` Hannes Reinecke
2025-04-29 13:55 ` Daniel Wagner
2025-04-29 17:54 ` Hannes Reinecke
2025-04-29 18:13 ` Keith Busch
2025-04-29 18:23 ` Guenter Roeck
2025-04-29 18:42 ` Keith Busch
2025-04-30 6:43 ` Daniel Wagner
2025-04-30 16:01 ` Keith Busch
2025-04-30 16:12 ` Guenter Roeck
2025-05-02 9:02 ` Daniel Wagner
2025-04-30 16:11 ` Guenter Roeck
2025-04-30 6:08 ` Hannes Reinecke
2026-01-09 19:18 ` John Meneghini
2026-01-11 9:33 ` Nilay Shroff
2026-01-12 8:14 ` Daniel Wagner [this message]
2026-01-13 6:10 ` Nilay Shroff
2026-01-13 13:55 ` John Meneghini
2025-02-14 8:02 ` [PATCH 2/2] nvme-fc: rely on state transitions to handle connectivity loss Daniel Wagner
2025-02-20 10:36 ` Sagi Grimberg
2025-02-20 8:00 ` [PATCH 0/2] nvme-fc: fix schedule in atomic context Daniel Wagner
2025-02-20 12:50 ` Shinichiro Kawasaki
2025-02-20 17:23 ` 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=d8512cdc-bdcd-44ff-a56a-974b4464a7a5@flourine.local \
--to=dwagner@suse.de \
--cc=axboe@kernel.dk \
--cc=emilne@redhat.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=james.smart@broadcom.com \
--cc=jmeneghi@redhat.com \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=mlombard@redhat.com \
--cc=nilay@linux.ibm.com \
--cc=nnmlinux@linux.ibm.com \
--cc=sagi@grimberg.me \
--cc=shinichiro.kawasaki@wdc.com \
--cc=wagi@kernel.org \
--cc=wenxiong@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
all inboxes | Powered by JetHome®