Re: [PATCH] nvme-pci: Use non-operational power state instead of D3 on Suspend-to-Idle
From: Keith Busch
Date: Fri May 10 2019 - 09:58:31 EST
On Thu, May 09, 2019 at 10:30:52PM -0700, Christoph Hellwig wrote:
> Also I don't see any reason why we'd need to do the freeze game on
Right, definitely no reason for resume.
> Even on suspend it looks a little odd to me, as in theory
> the PM core should have already put the system into a quiescent state.
> But maybe we actually need it there, in which case a comment would
> be helpful.
I wasn't sure if suspend prevents a kthread or work queue from
running. For example, if the device sends a namespace notify AEN during
S2I, does the nvme scan_work run?
Since I wasn't sure, I took a paranoid approach to ensure nothing was
in flight, but I'd be happy if this is unnecessary.
> > + if (!pm_suspend_via_firmware())
> > + return nvme_set_power(&ndev->ctrl, 0);
> Don't we need to save the previous power state here and restore that?
> For example if someone set a specific state through nvme-cli?
Sure, we can do that. It would have been super if the spec had this
set feature command's CQE DW0 return the previous power state so we
could set the new and save the old in a single command, but two commands
is just a minor inconvenience.