lkml.org 
[lkml]   [2018]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] nvme-pci: use NOWAIT flag for nvme_set_host_mem
On Tue, Jan 30, 2018 at 11:41:07AM +0800, jianchao.wang wrote:
> Another point that confuses me is that whether nvme_set_host_mem is necessary
> in nvme_dev_disable ?
> As the comment:
> ----
> /*
> * If the controller is still alive tell it to stop using the
> * host memory buffer. In theory the shutdown / reset should
> * make sure that it doesn't access the host memoery anymore,
> * but I'd rather be safe than sorry..
> */
> if (dev->host_mem_descs)
> nvme_set_host_mem(dev, 0);
> ----
> It is to avoid accessing to host memory from controller. But the host memory is just
> freed when nvme_remove. It looks like we just need to do this in nvme_remove.
> For example:
> -----
> @@ -2553,6 +2545,14 @@ static void nvme_remove(struct pci_dev *pdev)
> flush_work(&dev->ctrl.reset_work);
> nvme_stop_ctrl(&dev->ctrl);
> nvme_remove_namespaces(&dev->ctrl);
> + /*
> + * If the controller is still alive tell it to stop using the
> + * host memory buffer. In theory the shutdown / reset should
> + * make sure that it doesn't access the host memoery anymore,
> + * but I'd rather be safe than sorry..
> + */
> + if (dev->host_mem_descs)
> + nvme_set_host_mem(dev, 0);
> nvme_dev_disable(dev, true);
> nvme_free_host_mem(dev);
> ----
>
> If anything missed, please point out.
> That's really appreciated.

I don't make any such controller, so I can't speak to the necessity of
having this here. I just think having it in the controller disabling
path is for safety. We want the controller to acknowledge that it has
completed any use of the HMB before we make it so it can't access it.

\
 
 \ /
  Last update: 2018-01-30 17:09    [W:0.032 / U:3.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site