All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] nvme: fix memory leak for power latency tolerance req
@ 2019-05-17  2:30 Yufen Yu
  2019-05-17 12:22 ` David Milburn
  0 siblings, 1 reply; 6+ messages in thread
From: Yufen Yu @ 2019-05-17  2:30 UTC (permalink / raw)


nvme_init_ctrl() initialize latency tolerance controls and
kzalloc structdev_pm_qos_request 'req' in nvme_init_ctrl().
The only way to free the 'req' is nvme_init_identify(), when
apst is disable and prev_apst is enable.

But, prev_apst is disable when device probe, and we will
miss to free it when the device does't support APST.

To fix the problem, we need to hide latency tolerance and
free 'req' in nvme_uninit_ctrl().

Fixes: c5552fde102fc("nvme: Enable autonomous power state transitions")
Suggested-by: Keith Busch <keith.busch at intel.com>
Signed-off-by: Yufen Yu <yuyufen at huawei.com>
---
 drivers/nvme/host/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 15d114787d6a..e13670dcf590 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3687,6 +3687,7 @@ EXPORT_SYMBOL_GPL(nvme_start_ctrl);
 
 void nvme_uninit_ctrl(struct nvme_ctrl *ctrl)
 {
+	dev_pm_qos_hide_latency_tolerance(ctrl->device);
 	cdev_device_del(&ctrl->cdev, ctrl->device);
 }
 EXPORT_SYMBOL_GPL(nvme_uninit_ctrl);
-- 
2.16.2.dirty

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

* [PATCH v2] nvme: fix memory leak for power latency tolerance req
  2019-05-17  2:30 [PATCH v2] nvme: fix memory leak for power latency tolerance req Yufen Yu
@ 2019-05-17 12:22 ` David Milburn
  2019-05-17 18:36   ` Keith Busch
  0 siblings, 1 reply; 6+ messages in thread
From: David Milburn @ 2019-05-17 12:22 UTC (permalink / raw)


Hi,

On 05/16/2019 09:30 PM, Yufen Yu wrote:
> nvme_init_ctrl() initialize latency tolerance controls and
> kzalloc structdev_pm_qos_request 'req' in nvme_init_ctrl().
> The only way to free the 'req' is nvme_init_identify(), when
> apst is disable and prev_apst is enable.
> 
> But, prev_apst is disable when device probe, and we will
> miss to free it when the device does't support APST.
> 
> To fix the problem, we need to hide latency tolerance and
> free 'req' in nvme_uninit_ctrl().
> 
> Fixes: c5552fde102fc("nvme: Enable autonomous power state transitions")
> Suggested-by: Keith Busch <keith.busch at intel.com>
> Signed-off-by: Yufen Yu <yuyufen at huawei.com>
> ---
>   drivers/nvme/host/core.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 15d114787d6a..e13670dcf590 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -3687,6 +3687,7 @@ EXPORT_SYMBOL_GPL(nvme_start_ctrl);
>   
>   void nvme_uninit_ctrl(struct nvme_ctrl *ctrl)
>   {
> +	dev_pm_qos_hide_latency_tolerance(ctrl->device);
>   	cdev_device_del(&ctrl->cdev, ctrl->device);
>   }
>   EXPORT_SYMBOL_GPL(nvme_uninit_ctrl);
> 

This one works too. Thanks

Tested-by: David Milburn <dmilburn at redhat.com>

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

* [PATCH v2] nvme: fix memory leak for power latency tolerance req
  2019-05-17 12:22 ` David Milburn
@ 2019-05-17 18:36   ` Keith Busch
  2019-05-24  8:20     ` Sagi Grimberg
  0 siblings, 1 reply; 6+ messages in thread
From: Keith Busch @ 2019-05-17 18:36 UTC (permalink / raw)


On Fri, May 17, 2019@05:22:48AM -0700, David Milburn wrote:
> On 05/16/2019 09:30 PM, Yufen Yu wrote:
> >   void nvme_uninit_ctrl(struct nvme_ctrl *ctrl)
> >   {
> > +	dev_pm_qos_hide_latency_tolerance(ctrl->device);
> >   	cdev_device_del(&ctrl->cdev, ctrl->device);
> >   }
> >   EXPORT_SYMBOL_GPL(nvme_uninit_ctrl);
> > 
> 
> This one works too. Thanks
> 
> Tested-by: David Milburn <dmilburn at redhat.com>

Thanks, applied for 5.2

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

* [PATCH v2] nvme: fix memory leak for power latency tolerance req
  2019-05-17 18:36   ` Keith Busch
@ 2019-05-24  8:20     ` Sagi Grimberg
  2019-05-24 20:44       ` Keith Busch
  0 siblings, 1 reply; 6+ messages in thread
From: Sagi Grimberg @ 2019-05-24  8:20 UTC (permalink / raw)



> Thanks, applied for 5.2

This should probably be sent to stable as well...

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

* [PATCH v2] nvme: fix memory leak for power latency tolerance req
  2019-05-24  8:20     ` Sagi Grimberg
@ 2019-05-24 20:44       ` Keith Busch
  2019-05-24 22:53         ` Sagi Grimberg
  0 siblings, 1 reply; 6+ messages in thread
From: Keith Busch @ 2019-05-24 20:44 UTC (permalink / raw)


On Fri, May 24, 2019@01:20:08AM -0700, Sagi Grimberg wrote:
> 
> > Thanks, applied for 5.2
> 
> This should probably be sent to stable as well...

Want to place bets on if stable-bot auto-selects it? :)

But yes, should apply to 4.14+.

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

* [PATCH v2] nvme: fix memory leak for power latency tolerance req
  2019-05-24 20:44       ` Keith Busch
@ 2019-05-24 22:53         ` Sagi Grimberg
  0 siblings, 0 replies; 6+ messages in thread
From: Sagi Grimberg @ 2019-05-24 22:53 UTC (permalink / raw)



>>> Thanks, applied for 5.2
>>
>> This should probably be sent to stable as well...
> 
> Want to place bets on if stable-bot auto-selects it? :)
> 
> But yes, should apply to 4.14+.

Yea, just need to make sure that whoever picks this up tags it
for stable # 4.14+

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

end of thread, other threads:[~2019-05-24 22:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-17  2:30 [PATCH v2] nvme: fix memory leak for power latency tolerance req Yufen Yu
2019-05-17 12:22 ` David Milburn
2019-05-17 18:36   ` Keith Busch
2019-05-24  8:20     ` Sagi Grimberg
2019-05-24 20:44       ` Keith Busch
2019-05-24 22:53         ` Sagi Grimberg

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.