Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <chaitanyak@nvidia.com>
To: Keith Busch <kbusch@meta.com>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
	"hch@lst.de" <hch@lst.de>
Cc: Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCH] nvme-pci: try function level reset on init failure
Date: Tue, 15 Jul 2025 00:27:45 +0000	[thread overview]
Message-ID: <a3dc9e19-8c2b-4985-9426-627ba084e855@nvidia.com> (raw)
In-Reply-To: <20250714171328.681885-1-kbusch@meta.com>

On 7/14/25 10:13, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
>
> I've encountered various nvme devices that for whatever reason are stuck
> in a reset state. Historically these have required a power cycle to make
> them usable again. Vendors don't report any problem with the device when
> we ship these for analysis.
>
> In many cases, a PCIe FLR is sufficient to restart operation without a
> power cycle. Try it if controller reset fails the first time.
>
> Signed-off-by: Keith Busch <kbusch@kernel.org>

I hope there are no setups that are relying on this failure and okay
with implicit PCIe FLR and any side-effects it might have,
but I think that is okay, looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck

> ---
>   drivers/nvme/host/pci.c | 14 ++++++++++++--
>   1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 4cf87fb5d8573..85749f19e3a23 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -2067,8 +2067,18 @@ static int nvme_pci_configure_admin_queue(struct nvme_dev *dev)
>   	 * might be pointing at!
>   	 */
>   	result = nvme_disable_ctrl(&dev->ctrl, false);
> -	if (result < 0)
> -		return result;
> +	if (result < 0) {
> +		struct pci_dev *pdev = to_pci_dev(dev->dev);
> +
> +		result = pcie_flr(pdev);
> +		if (result < 0)
> +			return result;
> +		pci_restore_state(pdev);
> +
> +		result = nvme_disable_ctrl(&dev->ctrl, false);
> +		if (result < 0)
> +			return result;
> +	}
>   
>   	result = nvme_alloc_queue(dev, 0, NVME_AQ_DEPTH);
>   	if (result)


  reply	other threads:[~2025-07-15  0:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-14 17:13 [PATCH] nvme-pci: try function level reset on init failure Keith Busch
2025-07-15  0:27 ` Chaitanya Kulkarni [this message]
2025-07-15  7:45 ` Christoph Hellwig
2025-07-15 13: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=a3dc9e19-8c2b-4985-9426-627ba084e855@nvidia.com \
    --to=chaitanyak@nvidia.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=kbusch@meta.com \
    --cc=linux-nvme@lists.infradead.org \
    /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