mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Christoph Hellwig <hch@lst.de>
Cc: kbusch@kernel.org, axboe@kernel.dk, sagi@grimberg.me,
	linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-pci@vger.kernel.org, andersson@kernel.org,
	konradybcio@kernel.org, Bjorn Helgaas <bhelgaas@google.com>,
	"Rafael J. Wysocki" <rjw@sisk.pl>
Subject: Re: [PATCH] nvme-pci: Shutdown the device if D3Cold is allowed by the user
Date: Mon, 18 Nov 2024 20:28:20 +0530	[thread overview]
Message-ID: <20241118145820.2ecu5hzb2r5ygjvi@thinkpad> (raw)
In-Reply-To: <20241118125817.GA28046@lst.de>

On Mon, Nov 18, 2024 at 01:58:17PM +0100, Christoph Hellwig wrote:
> On Mon, Nov 18, 2024 at 01:53:44PM +0530, Manivannan Sadhasivam wrote:
> > PCI core allows users to configure the D3Cold state for each PCI device
> > through the sysfs attribute '/sys/bus/pci/devices/.../d3cold_allowed'. This
> > attribute sets the 'pci_dev:d3cold_allowed' flag and could be used by users
> > to allow/disallow the PCI devices to enter D3Cold during system suspend.
> >
> > So make use of this flag in the NVMe driver to shutdown the NVMe device
> > during system suspend if the user has allowed D3Cold for the device.
> > Existing checks in the NVMe driver decide whether to shut down the device
> > (based on platform/device limitations), so use this flag as the last resort
> > to keep the existing behavior.
> 
> Umm, what?  The documentation of this attribute says:
> 
> "d3cold_allowed is bit to control whether the corresponding PCI
>  device can be put into D3Cold state.  If it is cleared, the
>  device will never be put into D3Cold state.  If it is set, the
>  device may be put into D3Cold state if other requirements are
>  satisfied too.  Reading this attribute will show the current
>  value of d3cold_allowed bit. Writing this attribute will
>  the value of d3cold_allowed bit."
> 
> Which honestly already sounds rather non-specific, but everything but
> a mandate for drivers to act on it.
> 
> The only place currently checking it is pci_dev_check_d3cold in the
> PCI core, which is used to set the bridge_d3 attibute.
> 

Yeah, it is pretty much used internally up until now. But the attribute looks
like a close match of what I could find for this usecase and that's why I used
it.

> So blindly using it in a driver to force a different PM strategy feels
> completely wrong.  Even if the attrite should have that effect it
> needs to happen through a well documented PCI or PM layer helper and
> open coded like this.
> 

Ok. I'd like to get some feedback from Bjorn H (PCI maintainer) about using this
attribute before moving forward with a helper.

Thanks!

- Mani

-- 
மணிவண்ணன் சதாசிவம்

  reply	other threads:[~2024-11-18 14:58 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-18  8:23 Manivannan Sadhasivam
2024-11-18 12:58 ` Christoph Hellwig
2024-11-18 14:58   ` Manivannan Sadhasivam [this message]
2024-11-22 22:20 ` Bjorn Helgaas
2024-11-23  9:01   ` Manivannan Sadhasivam
2024-11-26 17:11     ` Bjorn Andersson
2024-11-27  5:49       ` Manivannan Sadhasivam
2024-12-05 23:29     ` Bjorn Helgaas
2024-12-06  1:49       ` Bjorn Helgaas
2024-12-09 13:36         ` Christoph Hellwig
2024-12-09 14:38           ` Manivannan Sadhasivam
2024-12-12  5:59             ` Christoph Hellwig
2024-12-12 12:21               ` Rafael J. Wysocki
2024-12-12 12:49                 ` Ulf Hansson
2024-12-12 15:13                   ` Christoph Hellwig
2024-12-13 14:35                     ` Rafael J. Wysocki
2024-12-14  6:30                       ` Manivannan Sadhasivam
2024-12-16 16:23                         ` Christoph Hellwig
2024-12-16 16:42                           ` Rafael J. Wysocki
2024-12-16 16:48                             ` Manivannan Sadhasivam
2024-12-16 17:28                               ` Rafael J. Wysocki
2024-12-16 17:39                                 ` Manivannan Sadhasivam
2024-12-16 19:10                                   ` Rafael J. Wysocki
2024-12-20 15:15                             ` Konrad Dybcio
2024-12-21  3:38                               ` Manivannan Sadhasivam
2024-12-21 11:17                                 ` Konrad Dybcio
2024-12-26 16:22                                   ` Manivannan Sadhasivam
2025-01-03  7:28                               ` Christoph Hellwig
2025-01-03 11:48                                 ` Konrad Dybcio
2024-12-16 16:24                         ` Rafael J. Wysocki
2024-12-16 17:11                           ` Manivannan Sadhasivam
2024-12-16 17:35                             ` Rafael J. Wysocki
2024-12-16 17:52                               ` Manivannan Sadhasivam
2024-12-16 19:34                                 ` Rafael J. Wysocki
2024-12-16 19:40                                   ` Keith Busch
2024-12-16 19:43                                     ` Rafael J. Wysocki
2024-12-17  5:26                                   ` manivannan.sadhasivam
2024-12-17 19:45                                     ` Rafael J. Wysocki
2024-12-19  8:02                                       ` Manivannan Sadhasivam
2024-12-19 12:45                                         ` Rafael J. Wysocki
2024-12-19 16:41                                           ` Ulf Hansson
2024-12-19 18:28                                             ` Rafael J. Wysocki
2025-01-03  7:26                                               ` Christoph Hellwig
2024-12-19  6:30                                 ` Christoph Hellwig
2024-12-19  8:03                                   ` Manivannan Sadhasivam
2024-12-09 14:43         ` Manivannan Sadhasivam
2024-12-09 14:57       ` Manivannan Sadhasivam

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=20241118145820.2ecu5hzb2r5ygjvi@thinkpad \
    --to=manivannan.sadhasivam@linaro.org \
    --cc=andersson@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=bhelgaas@google.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rjw@sisk.pl \
    --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

all inboxes | Powered by JetHome®