All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme: do not try to reconfigure APST when the controller is not live
@ 2021-04-09  9:49 Christoph Hellwig
  2021-04-19  7:09 ` Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christoph Hellwig @ 2021-04-09  9:49 UTC (permalink / raw)
  To: sagi, kbusch; +Cc: linux-nvme, Peng Liu

Do not call nvme_configure_apst when the controller is not live, given
that nvme_configure_apst will fail due the lack of an admin queue when
the controller is being torn down and nvme_set_latency_tolerance is
called from dev_pm_qos_hide_latency_tolerance.

Fixes: 510a405d945b("nvme: fix memory leak for power latency tolerance")
Reported-by: Peng Liu <liupeng17@lenovo.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/host/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 63a1e6cc27acab..f3c7b1cb2c7c8c 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2740,7 +2740,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);
 	}
 }
 
-- 
2.30.1


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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvme: do not try to reconfigure APST when the controller is not live
  2021-04-09  9:49 [PATCH] nvme: do not try to reconfigure APST when the controller is not live Christoph Hellwig
@ 2021-04-19  7:09 ` Christoph Hellwig
  2021-04-19 15:16 ` Keith Busch
  2021-05-01 11:36 ` Hannes Reinecke
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2021-04-19  7:09 UTC (permalink / raw)
  To: sagi, kbusch; +Cc: linux-nvme, Peng Liu

ping?

On Fri, Apr 09, 2021 at 11:49:05AM +0200, Christoph Hellwig wrote:
> Do not call nvme_configure_apst when the controller is not live, given
> that nvme_configure_apst will fail due the lack of an admin queue when
> the controller is being torn down and nvme_set_latency_tolerance is
> called from dev_pm_qos_hide_latency_tolerance.
> 
> Fixes: 510a405d945b("nvme: fix memory leak for power latency tolerance")
> Reported-by: Peng Liu <liupeng17@lenovo.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/nvme/host/core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 63a1e6cc27acab..f3c7b1cb2c7c8c 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2740,7 +2740,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);
>  	}
>  }
>  
> -- 
> 2.30.1
> 
> 
> _______________________________________________
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvme: do not try to reconfigure APST when the controller is not live
  2021-04-09  9:49 [PATCH] nvme: do not try to reconfigure APST when the controller is not live Christoph Hellwig
  2021-04-19  7:09 ` Christoph Hellwig
@ 2021-04-19 15:16 ` Keith Busch
  2021-05-01 11:36 ` Hannes Reinecke
  2 siblings, 0 replies; 4+ messages in thread
From: Keith Busch @ 2021-04-19 15:16 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: sagi, linux-nvme, Peng Liu

On Fri, Apr 09, 2021 at 11:49:05AM +0200, Christoph Hellwig wrote:
> Do not call nvme_configure_apst when the controller is not live, given
> that nvme_configure_apst will fail due the lack of an admin queue when
> the controller is being torn down and nvme_set_latency_tolerance is
> called from dev_pm_qos_hide_latency_tolerance.
> 
> Fixes: 510a405d945b("nvme: fix memory leak for power latency tolerance")
> Reported-by: Peng Liu <liupeng17@lenovo.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks good.

Reviewed-by: Keith Busch <kbusch@kernel.org>

> ---
>  drivers/nvme/host/core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 63a1e6cc27acab..f3c7b1cb2c7c8c 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2740,7 +2740,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);
>  	}
>  }
>  
> -- 
> 2.30.1
> 

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvme: do not try to reconfigure APST when the controller is not live
  2021-04-09  9:49 [PATCH] nvme: do not try to reconfigure APST when the controller is not live Christoph Hellwig
  2021-04-19  7:09 ` Christoph Hellwig
  2021-04-19 15:16 ` Keith Busch
@ 2021-05-01 11:36 ` Hannes Reinecke
  2 siblings, 0 replies; 4+ messages in thread
From: Hannes Reinecke @ 2021-05-01 11:36 UTC (permalink / raw)
  To: Christoph Hellwig, sagi, kbusch; +Cc: linux-nvme, Peng Liu

On 4/9/21 11:49 AM, Christoph Hellwig wrote:
> Do not call nvme_configure_apst when the controller is not live, given
> that nvme_configure_apst will fail due the lack of an admin queue when
> the controller is being torn down and nvme_set_latency_tolerance is
> called from dev_pm_qos_hide_latency_tolerance.
> 
> Fixes: 510a405d945b("nvme: fix memory leak for power latency tolerance")
> Reported-by: Peng Liu <liupeng17@lenovo.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>   drivers/nvme/host/core.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 63a1e6cc27acab..f3c7b1cb2c7c8c 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2740,7 +2740,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);
>   	}
>   }
>   
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-01 11:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09  9:49 [PATCH] nvme: do not try to reconfigure APST when the controller is not live Christoph Hellwig
2021-04-19  7:09 ` Christoph Hellwig
2021-04-19 15:16 ` Keith Busch
2021-05-01 11:36 ` Hannes Reinecke

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.