[PATCH v1 0/1] nvme: Fix problem when booting from NVMe drive was leading to a hang.
Keith Busch
kbusch at kernel.org
Thu Feb 22 12:36:31 PST 2024
On Thu, Feb 22, 2024 at 08:02:52PM +0000, Michael Kropaczek wrote:
> The function nvme_dev_disable() changed here is called from the nvme_shutdown() subsequently through nvme_disable_prepare_reset() with the flag shutdown being set as true.
>
> Considering the re-usability of the code, would it be correct to wrap up the change into if(shutdown) statement?
>
> The reason for asking is that disabling of host memory should follow other calls as well and placing it within the body of nvme_shutdown() would require more adjustments.
>
> The call to nvme_disable_prepare_reset() with the flag shutdown set as true is made whenever the NVMe controller should be shut down anyway.
Just calling nvme_set_host_mem() should be sufficient; no need to free
the memory here as we may just be giving it back to the device on the
reset or resume side.
And per spec, the device is supposed to automatically clear its host
memory enabling on a reset or shutdown, so this shouldn't be necessary.
Sounds like something isn't spec complaint in your environment.
Going through the git histroy, we use to disable host mem here, but
timeout handling doesn't work within nvme_dev_disable(). All the
operations done from here need to guarantee forward progress, and this
set function command doesn't do that. The only example of admin commands
that handle their own timeout is the queue deletion sequence.
More information about the Linux-nvme
mailing list