Re: [PATCH] nvme-pci: Shutdown the device if D3Cold is allowed by the user

Christoph Hellwig
2024-12-12T05:59:24Z

On Mon, Dec 09, 2024 at 08:08:21PM +0530, Manivannan Sadhasivam wrote:
> >
> > The istory here is the the NVMe internal power states are significantly
> > better for the SSDs. It avoid shutting down the SSD frequently, which
> > creates a lot of extra erase cycles and reduces life time. It also
> > prevents the SSD from performing maintainance operations while the host
> > system is idle, which is the perfect time for them. But the idea of
> > putting all periphals into D3 is gaining a lot of ground because it
> > makes the platform vendors life a lot simpler at the cost of others.
>
> No, I disagree with the last comment. When the system goes to low power mode
> (like S2R/hibernate), it *does* makes a lot of sense to put the devices into
> D3Cold to save power.

Yes. That's what the pm_suspend_via_firmware call in nvme_suspend is
supposed to catch. If that is not the right way to check for a
non-runtime suspend we'll need to improve the interface. Which really
are a mess, and the last thing I want is more "intelligence" in the
drivers. We need go information from the PM core what is going on so
that things work out of the box. Overloading obscure sysfs files with
new logic queried from a driver is a complete no-go.

> The current reality is that most of the devicetree platforms *do* want to power
> down the NVMe during suspend. Only when NVMe is used in an OS like Android, we
> might not want to do so (that's something for future, but still a possibility).

So fix the bloody interface instead of piling up hacks in drivers.