From: kbusch@kernel.org (Keith Busch)
Subject: [PATCHv2 6/6] nvme-pci: Use host managed power state for suspend
Date: Thu, 16 May 2019 08:26:58 -0600 [thread overview]
Message-ID: <20190516142657.GD23333@localhost.localdomain> (raw)
In-Reply-To: <CAJZ5v0iC44O_gLMHnLui+tH+BuHKJzh_WC7PV3JFJwhj041=1A@mail.gmail.com>
On Thu, May 16, 2019@02:29:10AM -0700, Rafael J. Wysocki wrote:
> This is a bit problematic with respect to hibernation.
>
> Sorry for failing to mention that before, it escaped me somehow.
>
> So the problem is that this will be invoked as the ->restore()
> callback and it need not be suitable for that depending on whether or
> not the driver is present in the restore kernel. [There is another
> issue related to the fact that the last stage of hibernation doesn't
> return "true" from pm_suspend_via_firmware(), but that needs to be
> fixed elsewhere.] If it is there, it will run nvme_deep_state(ndev),
> so all should be fine, but if it isn't there, the PCI bus type will
> apply the default handling to the device and that's to disable it via
> do_pci_disable_device() it this particular case, as per
> pci_pm_freeze(), so nvme_make_operational(ndev) should not be called
> then AFAICS.
>
> IMO it is better to just do the nvme_dev_disable()/nvme_reset_ctrl()
> things in the hibernation path anyway, so I would rename the existing
> nvme_suspend/resume() to nvme_simple_suspend/resume() (or similar),
> respectively, and define new nvme_suspend/resume() to do something
> like:
>
> return pm_suspend_via_firmware() || !ndev->ctrl.npss ?
> nvme_simple_suspend(dev) : nvme_deep_state(ndev);
>
> and
>
> return pm_resume_via_firmware() || !ndev->ctrl.npss ?
> nvme_simple_resume(dev) : nvme_make_operational(ndev);
>
> respectively.
>
> > nvme_reset_ctrl(&ndev->ctrl);
> > return 0;
> > }
> > --
>
> Then, you can populate nvme_dev_pm_ops as follows:
>
> static const struct dev_pm_ops = {
> .suspend = nvme_suspend,
> .resume = nvme_resume,
> .freeze = nvme_simple_suspend,
> .thaw = nvme_simple_resume,
> .poweroff = nvme_simple_suspend,
> .restore = nvme_simple_resume,
> };
>
> and it should all work.
Thanks for the pointers, I'll give that idea a shot.
next prev parent reply other threads:[~2019-05-16 14:26 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-15 16:36 [PATCH 1/6] nvme-pci: Fix controller freeze wait disabling Keith Busch
2019-05-15 16:36 ` [PATCH 2/6] nvme-pci: Don't disable on timeout in reset state Keith Busch
2019-05-16 3:07 ` Ming Lei
2019-05-16 14:33 ` Keith Busch
2019-05-16 6:27 ` Christoph Hellwig
2019-05-15 16:36 ` [PATCH 3/6] nvme-pci: Unblock reset_work on IO failure Keith Busch
2019-05-16 3:13 ` Ming Lei
2019-05-16 14:14 ` Keith Busch
2019-05-17 2:31 ` Ming Lei
2019-05-16 6:28 ` Christoph Hellwig
2019-05-15 16:36 ` [PATCH 4/6] nvme-pci: Sync queues on reset Keith Busch
2019-05-16 3:34 ` Ming Lei
2019-05-16 6:29 ` Christoph Hellwig
2019-05-16 14:08 ` Keith Busch
2019-05-16 13:43 ` Minwoo Im
2019-05-15 16:36 ` [PATCH 5/6] nvme: Export get and set features Keith Busch
2019-05-16 6:26 ` Christoph Hellwig
2019-05-16 13:47 ` Minwoo Im
2019-05-15 16:36 ` [PATCHv2 6/6] nvme-pci: Use host managed power state for suspend Keith Busch
2019-05-15 19:33 ` Mario.Limonciello
2019-05-15 19:34 ` Keith Busch
2019-05-15 19:43 ` Mario.Limonciello
2019-05-16 6:25 ` Christoph Hellwig
2019-05-16 14:24 ` Keith Busch
2019-05-17 9:08 ` Christoph Hellwig
2019-05-16 9:29 ` Rafael J. Wysocki
2019-05-16 14:26 ` Keith Busch [this message]
2019-05-16 18:27 ` Kai-Heng Feng
2019-05-16 18:33 ` Mario.Limonciello
2019-05-16 19:38 ` Keith Busch
2019-05-16 20:25 ` Rafael J. Wysocki
2019-05-16 20:39 ` Keith Busch
2019-05-16 20:56 ` Rafael J. Wysocki
2019-05-17 8:39 ` Rafael J. Wysocki
2019-05-17 9:05 ` Christoph Hellwig
2019-05-17 9:17 ` Rafael J. Wysocki
2019-05-17 9:35 ` Christoph Hellwig
2019-05-17 10:34 ` Rafael J. Wysocki
2019-05-22 6:47 ` Kai Heng Feng
2019-05-22 15:52 ` Christoph Hellwig
2019-05-22 16:02 ` Keith Busch
2019-05-22 16:35 ` Mario.Limonciello
2019-05-22 16:56 ` Keith Busch
2019-05-22 23:08 ` Keith Busch
2019-05-23 15:27 ` Keith Busch
2019-05-17 9:22 ` Kai-Heng Feng
2019-05-17 9:32 ` Rafael J. Wysocki
2019-05-16 20:24 ` Rafael J. Wysocki
2019-05-16 2:43 ` [PATCH 1/6] nvme-pci: Fix controller freeze wait disabling Ming Lei
2019-05-17 18:40 ` Keith Busch
2019-05-16 6:27 ` 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=20190516142657.GD23333@localhost.localdomain \
--to=kbusch@kernel.org \
/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