linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jingar, Rajvi" <rajvi.jingar@intel.com>
To: Bjorn Helgaas <helgaas@kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>
Cc: "Wysocki, Rafael J" <rafael.j.wysocki@intel.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	David Box <david.e.box@linux.intel.com>,
	Linux PCI <linux-pci@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>
Subject: RE: [PATCH v5 2/2] PCI/PM: Fix pci_pm_suspend_noirq() to disable PTM
Date: Fri, 13 May 2022 22:00:48 +0000	[thread overview]
Message-ID: <SJ0PR11MB5070B095B8A28634B43A231F9ECA9@SJ0PR11MB5070.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220512183540.GA859016@bhelgaas>


> -----Original Message-----
> From: Bjorn Helgaas <helgaas@kernel.org>
> Sent: Thursday, May 12, 2022 11:36 AM
> To: Rafael J. Wysocki <rafael@kernel.org>
> Cc: Jingar, Rajvi <rajvi.jingar@intel.com>; Wysocki, Rafael J
> <rafael.j.wysocki@intel.com>; Bjorn Helgaas <bhelgaas@google.com>; David Box
> <david.e.box@linux.intel.com>; Linux PCI <linux-pci@vger.kernel.org>; Linux
> Kernel Mailing List <linux-kernel@vger.kernel.org>; Linux PM <linux-
> pm@vger.kernel.org>
> Subject: Re: [PATCH v5 2/2] PCI/PM: Fix pci_pm_suspend_noirq() to disable PTM
> 
> On Thu, May 12, 2022 at 07:52:36PM +0200, Rafael J. Wysocki wrote:
> > On Thu, May 12, 2022 at 7:42 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
> > > On Thu, May 12, 2022 at 03:49:18PM +0200, Rafael J. Wysocki wrote:
> 
> > > > Something like this should suffice IMV:
> > > >
> > > > if (!dev_state_saved || pci_dev->current_state != PCI_D3cold)
> > > >
> > > >         pci_disable_ptm(pci_dev);
> > >
> > > It makes sense to me that we needn't disable PTM if the device is in
> > > D3cold.  But the "!dev_state_saved" condition depends on what the
> > > driver did.  Why is that important?  Why should we not do the
> > > following?
> > >
> > >   if (pci_dev->current_state != PCI_D3cold)
> > >     pci_disable_ptm(pci_dev);
> >
> > We can do this too.  I thought we could skip the power state check if
> > dev_state_saved was unset, because then we would know that the power
> > state was not D3cold.  It probably isn't worth the hassle though.
>

We see issue with certain platforms where only checking if device power 
state in D3Cold is not enough and the !dev_state_saved check is needed
when disabling PTM. Device like nvme is relying on ASPM, it stays in D0 but 
state is saved. Touching the config space wakes up the device which 
prevents the system from entering into low power state.

Following would fix the issue:

 if (!pci_dev->state_save) {
                pci_save_state(pci_dev);

               pci_disable_ptm(pci_dev);

                if (!pci_dev->skip_bus_pm && pci_power_manageable(pci_dev))
                        pci_prepare_to_sleep(pci_dev);
}

> Ah, thanks.  IMHO it's easier to analyze for correctness if we only
> check the power state.
> 
> Bjorn

  reply	other threads:[~2022-05-13 22:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220429210538.2270472-1-rajvi.jingar@intel.com>
     [not found] ` <20220429210538.2270472-2-rajvi.jingar@intel.com>
2022-05-12 13:49   ` [PATCH v5 2/2] PCI/PM: Fix pci_pm_suspend_noirq() to disable PTM Rafael J. Wysocki
2022-05-12 17:42     ` Bjorn Helgaas
2022-05-12 17:52       ` Rafael J. Wysocki
2022-05-12 18:35         ` Bjorn Helgaas
2022-05-13 22:00           ` Jingar, Rajvi [this message]
2022-05-14 17:12             ` Rafael J. Wysocki
2022-05-16 20:09             ` Bjorn Helgaas
2022-05-16 20:59               ` Rafael J. Wysocki
2022-05-17 14:48                 ` Bjorn Helgaas
2022-05-17 14:54                   ` Rafael J. Wysocki
2022-05-17 18:05                     ` David E. Box
2022-05-19 19:01                       ` Rafael J. Wysocki
2022-05-23 18:32                         ` Bjorn Helgaas
2022-05-23 19:02                           ` Rafael J. Wysocki

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=SJ0PR11MB5070B095B8A28634B43A231F9ECA9@SJ0PR11MB5070.namprd11.prod.outlook.com \
    --to=rajvi.jingar@intel.com \
    --cc=bhelgaas@google.com \
    --cc=david.e.box@linux.intel.com \
    --cc=helgaas@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rafael@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;
as well as URLs for NNTP newsgroup(s).