[PATCH] nvme: fix APST error for power latency tolerance

Peng Liu pngliu at hotmail.com
Wed Mar 24 02:38:12 GMT 2021


On Tue, Mar 23, 2021 at 04:23:21PM +0000, Christoph Hellwig wrote:
> On Tue, Mar 23, 2021 at 03:31:33PM +0800, pngliu at hotmail.com wrote:
> > From: Peng Liu <liupeng17 at 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.

  irq/165-pciehp-939   [039] ....  1529.443824: nvme_configure_apst
                                          <-nvme_set_latency_tolerance
  irq/165-pciehp-939   [039] ....  1529.443836: <stack trace>
 => nvme_configure_apst
 => nvme_set_latency_tolerance
 => apply_constraint
 => __dev_pm_qos_remove_request
 => __dev_pm_qos_drop_user_request.isra.7
 => dev_pm_qos_update_user_latency_tolerance
 => dev_pm_qos_hide_latency_tolerance
 => nvme_uninit_ctrl
 => nvme_remove
 => pci_device_remove
 => device_release_driver_internal
 => device_release_driver
 => pci_stop_bus_device
 => pci_stop_and_remove_bus_device
 => pciehp_unconfigure_device
 => pciehp_disable_slot
 => pciehp_handle_disable_request
 => pciehp_ist
 => irq_thread_fn
 => irq_thread
 => kthread
 => ret_from_fork



More information about the Linux-nvme mailing list