Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Peng Liu <pngliu@hotmail.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	kbusch@kernel.org, linux-nvme@lists.infradead.org,
	Peng Liu <liupeng17@lenovo.com>
Subject: Re: [PATCH] nvme: fix APST error for power latency tolerance
Date: Fri, 9 Apr 2021 08:19:21 +0100	[thread overview]
Message-ID: <20210409071921.GA4184967@infradead.org> (raw)
In-Reply-To: <20210324075824.GA2648357@infradead.org>

On Wed, Mar 24, 2021 at 07:58:24AM +0000, Christoph Hellwig wrote:
> On Wed, Mar 24, 2021 at 10:38:12AM +0800, Peng Liu wrote:
> > On Tue, Mar 23, 2021 at 04:23:21PM +0000, Christoph Hellwig wrote:
> > > On Tue, Mar 23, 2021 at 03:31:33PM +0800, pngliu@hotmail.com wrote:
> > > > From: Peng Liu <liupeng17@lenovo.com>
> > > > 
> > > > Clear apsta so that nvme_configure_apst() does not execute
> > > > nvme_set_features(), which will fail because admin_q is either not set up
> > > > yet or no longer available at the time of nvme_uninit_ctrl() being called,
> > > > and this leads to the error message "nvme nvme0: failed to set APST feature
> > > > (-19)".
> > > > 
> > > > Fixes: 510a405d945b("nvme: fix memory leak for power latency tolerance")
> > > 
> > > How did you get into this situation?  For PCIe nvme_uninit_ctrl is
> > > only called at the end of ->remove and ->delete_ctrl, so how do we end
> > > up in nvme_configure_apst after that?
> > 
> > I got into it with nvme surprise and non-surprise hot-removal tests.
> > Below is the stack ftrace result for nvme_configure_apst under the
> > surprise hot-removal, and it is similar for the non-surprise hot-removal.
> 
> Ok, looks like dev_pm_qos_hide_latency_tolerance calls back into
> nvme_set_latency_tolerance, which is a little .. unexpected.
> 
> Does this patch work for you?

ping?

> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 0896e21642beba..d5d7e0cdd78d80 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2681,7 +2681,8 @@ static void nvme_set_latency_tolerance(struct device *dev, s32 val)
>  
>  	if (ctrl->ps_max_latency_us != latency) {
>  		ctrl->ps_max_latency_us = latency;
> -		nvme_configure_apst(ctrl);
> +		if (ctrl->state == NVME_CTRL_LIVE)
> +			nvme_configure_apst(ctrl);
>  	}
>  }
>  
> 
> _______________________________________________
> Linux-nvme mailing list
> Linux-nvme@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-nvme
---end quoted text---

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  reply	other threads:[~2021-04-09  7:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23  7:31 [PATCH] nvme: fix APST error for power latency tolerance pngliu
2021-03-23 16:23 ` Christoph Hellwig
2021-03-24  2:38   ` Peng Liu
2021-03-24  7:58     ` Christoph Hellwig
2021-04-09  7:19       ` Christoph Hellwig [this message]
2021-04-09  8:12         ` Peng Liu

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=20210409071921.GA4184967@infradead.org \
    --to=hch@infradead.org \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=liupeng17@lenovo.com \
    --cc=pngliu@hotmail.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