[PATCH] nvme: do not try to reconfigure APST when the controller is not live

Hannes Reinecke hare at suse.de
Sat May 1 12:36:11 BST 2021


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 at lenovo.com>
> Signed-off-by: Christoph Hellwig <hch at 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 at suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare at 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



More information about the Linux-nvme mailing list