linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-nvme@lists.infradead.org, sagi@grimberg.me,
	Rafael Wysocki <rafael.j.wysocki@intel.com>,
	Vidya Sagar <vidyas@nvidia.com>
Subject: Re: [PATCH] nvme/pci: default to simple suspend
Date: Mon, 7 Feb 2022 08:06:55 -0800	[thread overview]
Message-ID: <20220207160655.GB635727@dhcp-10-100-145-180.wdc.com> (raw)
In-Reply-To: <20220204071012.GA28638@lst.de>

On Fri, Feb 04, 2022 at 08:10:12AM +0100, Christoph Hellwig wrote:
> On Wed, Feb 02, 2022 at 08:03:34AM -0800, Keith Busch wrote:
> > On Wed, Feb 02, 2022 at 08:55:02AM +0100, Christoph Hellwig wrote:
> > > On Tue, Feb 01, 2022 at 08:50:06AM -0800, Keith Busch wrote:
> > > > There is no complete set of attributes a driver can check to know if
> > > > nvme power management is the correct thing to do in a runtime suspend
> > > > situation. Every attempt so far to optimize idle power consumption and
> > > > resume latency for a particular platform just leads to regressions
> > > > elsewhere.
> > > > 
> > > > Default to the simple shutdown since it is the historically safest
> > > > option, and provide a user parameter to override it if the user knows
> > > > it's safe to use for their platform.
> > > 
> > > Sigh.  The platforms really should be asking for a explicit D3cold if
> > > they need one..
> > 
> > It's too late now, but perhaps the new property should have been
> > inverted since preparing for D3 was the previous default behavior;
> > platforms could have instead explicitly asked for "no-D3" if they wanted
> > it. That would have been easier for backward compatibility.
> 
> I'd really prefer to sort this out at the platform level.  We can't work
> around broken platforms in nvme forever.

I agree, but I'm not sure how to get everyone aligned.

How about this to resolve the regressions: if the platform doesn't
provide StorageD3Enable property, can we just default to the simple
shutdown method? We'd only use the nvme power management capabilities if
the platform explicity says it doesn't want D3, making the default the
same as the legacy behavior.

---
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index d8585df2c2fd..edd8f7dae77f 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -20,6 +20,7 @@
 #include <linux/mutex.h>
 #include <linux/once.h>
 #include <linux/pci.h>
+#include <linux/property.h>
 #include <linux/suspend.h>
 #include <linux/t10-pi.h>
 #include <linux/types.h>
@@ -3086,7 +3087,9 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	quirks |= check_vendor_combination_bug(pdev);
 
-	if (!noacpi && acpi_storage_d3(&pdev->dev)) {
+	if (!noacpi && (acpi_storage_d3(&pdev->dev) ||
+			!device_property_present(&pdev->dev,
+						 "StorageD3Enable"))) {
 		/*
 		 * Some systems use a bios work around to ask for D3 on
 		 * platforms that support kernel managed suspend.
--


  reply	other threads:[~2022-02-07 16:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-01 16:50 [PATCH] nvme/pci: default to simple suspend Keith Busch
2022-02-01 17:49 ` Vidya Sagar
2022-02-02  7:55 ` Christoph Hellwig
2022-02-02 16:03   ` Keith Busch
2022-02-04  7:10     ` Christoph Hellwig
2022-02-07 16:06       ` Keith Busch [this message]
2022-02-08 14:37         ` Christoph Hellwig
2022-02-08 17:14           ` Keith Busch
2022-02-09  7:48             ` Christoph Hellwig
2022-04-11 13:58 ` Manivannan Sadhasivam
2022-04-23  5:49   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220207160655.GB635727@dhcp-10-100-145-180.wdc.com \
    --to=kbusch@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-nvme@lists.infradead.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=sagi@grimberg.me \
    --cc=vidyas@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).