From: Christoph Hellwig <hch@lst.de>
To: Mario Limonciello <mario.limonciello@amd.com>
Cc: Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@fb.com>,
Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
"open list:NVM EXPRESS DRIVER" <linux-nvme@lists.infradead.org>,
open list <linux-kernel@vger.kernel.org>,
Patrick Huang <patrick.huang@amd.com>,
linux-pci@vger.kernel.org
Subject: Re: [PATCH] nvme-pci: Disable LTR for simple suspend
Date: Tue, 15 Mar 2022 08:22:33 +0100 [thread overview]
Message-ID: <20220315072233.GA2288@lst.de> (raw)
In-Reply-To: <20220314135537.1565-1-mario.limonciello@amd.com>
On Mon, Mar 14, 2022 at 08:55:37AM -0500, Mario Limonciello wrote:
> Some drives from SSSTC are showing stability problems after s0i3
> entry when the Linux kernel is in s2idle loop if LTR has been
> enabled. This leads to failures to resume.
>
> This appears to be a firmware issue specific to SSSTC SSDs, but to
> avoid this class of problem, disable LTR when going into s2idle and
> simple suspend has been set.
This seems like a giant hammer to do this for all NVMe devices,
why not quirk the specific ones?
> +static void nvme_suspend_ltr(struct device *dev, bool disable)
> +{
> + struct pci_dev *pdev = to_pci_dev(dev);
> + struct nvme_dev *ndev = pci_get_drvdata(pdev);
> +
> + if (disable) {
> + u16 word;
> +
> + pcie_capability_read_word(pdev, PCI_EXP_DEVCTL2, &word);
> + ndev->restore_ltr = word & PCI_EXP_DEVCTL2_LTR_EN;
> + pcie_capability_clear_word(pdev, PCI_EXP_DEVCTL2,
> + PCI_EXP_DEVCTL2_LTR_EN);
> + } else if (ndev->restore_ltr) {
> + pcie_capability_set_word(pdev, PCI_EXP_DEVCTL2,
> + PCI_EXP_DEVCTL2_LTR_EN);
> + }
> +}
The calling conventions of this function are rather strange by
mixing up two very different things.
I think two PCI-level helpers to disable LTR and return the status
it ways in and to enable LTR would be really nice to have here.
> if (ndev->last_ps == U32_MAX ||
> nvme_set_power_state(ctrl, ndev->last_ps) != 0)
> goto reset;
> @@ -3239,6 +3259,11 @@ static int nvme_suspend(struct device *dev)
>
> ndev->last_ps = U32_MAX;
>
> + /* If using s2idle with simple suspend, disable LTR to avoid problems. */
Overly long line here.
next prev parent reply other threads:[~2022-03-15 7:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-14 13:55 [PATCH] nvme-pci: Disable LTR for simple suspend Mario Limonciello
2022-03-15 7:22 ` Christoph Hellwig [this message]
2022-03-15 15:58 ` Limonciello, Mario
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=20220315072233.GA2288@lst.de \
--to=hch@lst.de \
--cc=axboe@fb.com \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=patrick.huang@amd.com \
--cc=sagi@grimberg.me \
/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