linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Janne Grunau <j@jannau.net>
To: Hector Martin <marcan@marcan.st>
Cc: Christoph Hellwig <hch@lst.de>, Keith Busch <kbusch@kernel.org>,
	Sagi Grimberg <sagi@grimberg.me>,
	James Smart <james.smart@broadcom.com>,
	Chaitanya Kulkarni <kch@nvidia.com>,
	Sven Peter <sven@svenpeter.dev>,
	asahi@lists.linux.dev, linux-nvme@lists.infradead.org
Subject: Re: [PATCH 1/9] nvme-apple: fix controller shutdown in apple_nvme_disable
Date: Tue, 10 Jan 2023 18:47:45 +0100	[thread overview]
Message-ID: <20230110174745.GA3576@jannau.net> (raw)
In-Reply-To: <c20485ec-28aa-2a45-3eba-8fa384ce0349@marcan.st>

On 2022-11-30 00:41:45 +0900, Hector Martin wrote:
> On 29/11/2022 22.22, Christoph Hellwig wrote:
> > nvme_shutdown_ctrl already shuts the controller down, there is no
> > need to also call nvme_disable_ctrl for the shutdown case.
> > 
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > ---
> >  drivers/nvme/host/apple.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/nvme/host/apple.c b/drivers/nvme/host/apple.c
> > index 94ef797e8b4a5f..56d9e9be945b76 100644
> > --- a/drivers/nvme/host/apple.c
> > +++ b/drivers/nvme/host/apple.c
> > @@ -831,7 +831,8 @@ static void apple_nvme_disable(struct apple_nvme *anv, bool shutdown)
> >  
> >  		if (shutdown)
> >  			nvme_shutdown_ctrl(&anv->ctrl);
> > -		nvme_disable_ctrl(&anv->ctrl);
> > +		else
> > +			nvme_disable_ctrl(&anv->ctrl);
> >  	}
> >  
> >  	WRITE_ONCE(anv->ioq.enabled, false);
> 
> Reviewed-by: Hector Martin <marcan@marcan.st>
> 
> I looked at some of our other implementations and we always seem to do
> both, but this makes sense. If it breaks something we'll notice and
> shout loudly when it makes it into an -rc at the latest :)

This breaks resume for the apple nvme controller. The immediate problem 
is that apple_nvme_reset_work() uses NVME_CC_ENABLE to decide whether to 
call apple_nvme_disable(). Only nvme_disable_ctrl(ctrl, false) clears 
NVME_CC_ENABLE.

Even after extending the check to consider NVME_CC_SHN_NORMAL resume is 
still broken. The host specific reset to re-enable the controller works 
but IO is blocked. The controller logs following messages into its 
syslog:

| RTKit: syslog message: cmd.c:728: Oldest tag 12 is 19 seconds VERY OLD with cmdQe:2
| RTKit: syslog message: cmd.c:732: Oldest tag is about to crash!!
| RTKit: syslog message: cmd.c:720: Oldest high water mark moved up to 21,tag 12, cmdQ CQ_PRI0W

This looks looks like the controller reset after/during shutdown is required
on this controller.

Below patch fixes resume for me. I can send this with comment to
prevent repeating this regression or if preferred handle this in
nvme_disable_ctrl() either via a quirk or an additional parameter.

Janne

--- 
diff --git a/drivers/nvme/host/apple.c b/drivers/nvme/host/apple.c
index e13a992b6096..82396f9486e1 100644
--- a/drivers/nvme/host/apple.c
+++ b/drivers/nvme/host/apple.c
@@ -867,7 +867,9 @@ static void apple_nvme_disable(struct apple_nvme *anv, bool shutdown)
			apple_nvme_remove_cq(anv);
		}
 
-               nvme_disable_ctrl(&anv->ctrl, shutdown);
+               if (shutdown)
+                       nvme_disable_ctrl(&anv->ctrl, true);
+               nvme_disable_ctrl(&anv->ctrl, false);
	}
 
	WRITE_ONCE(anv->ioq.enabled, false);


  reply	other threads:[~2023-01-10 17:48 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-29 13:21 remove path cleanups Christoph Hellwig
2022-11-29 13:22 ` [PATCH 1/9] nvme-apple: fix controller shutdown in apple_nvme_disable Christoph Hellwig
2022-11-29 15:41   ` Hector Martin
2023-01-10 17:47     ` Janne Grunau [this message]
2023-01-11  4:09       ` Hector Martin
2023-01-11  9:30       ` Linux kernel regression tracking (#adding)
2022-12-06 10:37   ` Eric Curtin
2022-12-06 12:15   ` Sagi Grimberg
2022-11-29 13:22 ` [PATCH 2/9] nvme: use nvme_wait_ready in nvme_shutdown_ctrl Christoph Hellwig
2022-11-29 15:57   ` Pankaj Raghav
2022-11-30 13:57     ` Christoph Hellwig
2022-11-30 14:27       ` Pankaj Raghav
2022-11-30 16:15         ` Keith Busch
2022-12-06 13:33         ` Christoph Hellwig
2022-11-29 13:22 ` [PATCH 3/9] nvme: merge nvme_shutdown_ctrl into nvme_disable_ctrl Christoph Hellwig
2022-11-29 15:44   ` Hector Martin
2022-12-06 12:18   ` Sagi Grimberg
2022-11-29 13:22 ` [PATCH 4/9] nvme-pci: remove nvme_disable_admin_queue Christoph Hellwig
2022-12-06 10:38   ` Eric Curtin
2022-12-06 12:18   ` Sagi Grimberg
2022-11-29 13:22 ` [PATCH 5/9] nvme-pci: remove nvme_pci_disable Christoph Hellwig
2022-12-06 10:39   ` Eric Curtin
2022-12-06 12:19   ` Sagi Grimberg
2022-11-29 13:22 ` [PATCH 6/9] nvme-pci: cleanup nvme_suspend_queue Christoph Hellwig
2022-12-06 12:20   ` Sagi Grimberg
2022-11-29 13:22 ` [PATCH 7/9] nvme-pci: rename nvme_disable_io_queues Christoph Hellwig
2022-12-06 12:21   ` Sagi Grimberg
2022-11-29 13:22 ` [PATCH 8/9] nvme-pci: return early on ctrl state mismatch in nvme_reset_work Christoph Hellwig
2022-12-06 11:26   ` Keith Busch
2022-12-06 13:38     ` Christoph Hellwig
2022-12-06 12:21   ` Sagi Grimberg
2022-11-29 13:22 ` [PATCH 9/9] nvme-pci: split out a nvme_pci_ctrl_is_dead helper Christoph Hellwig
2022-12-06 12:23   ` Sagi Grimberg
2022-12-06  8:18 ` remove path cleanups Christoph Hellwig
2022-12-06 11:26 ` 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=20230110174745.GA3576@jannau.net \
    --to=j@jannau.net \
    --cc=asahi@lists.linux.dev \
    --cc=hch@lst.de \
    --cc=james.smart@broadcom.com \
    --cc=kbusch@kernel.org \
    --cc=kch@nvidia.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=marcan@marcan.st \
    --cc=sagi@grimberg.me \
    --cc=sven@svenpeter.dev \
    /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).