Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: "Bjorn Helgaas" <bhelgaas@google.com>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>,
	"Mika Westerberg" <mika.westerberg@linux.intel.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	iain@orangesquash.org.uk,
	"Shyam Sundar S K" <Shyam-sundar.S-k@amd.com>,
	"open list:PCI SUBSYSTEM" <linux-pci@vger.kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Lukas Wunner" <lukas@wunner.de>,
	stable@vger.kernel.org
Subject: Re: [PATCH v21] PCI: Avoid D3 at suspend for AMD PCIe root ports w/ USB4 controllers
Date: Tue, 3 Oct 2023 15:02:41 -0500	[thread overview]
Message-ID: <84d840c3-5557-4b18-8d49-e60759cfb27d@amd.com> (raw)
In-Reply-To: <20231003195947.GA685849@bhelgaas>

On 10/3/2023 14:59, Bjorn Helgaas wrote:
> On Tue, Oct 03, 2023 at 02:24:26PM -0500, Mario Limonciello wrote:
>> On 10/3/2023 14:16, Bjorn Helgaas wrote:
>>> On Tue, Oct 03, 2023 at 01:37:34PM -0500, Mario Limonciello wrote:
>>>> On 10/3/2023 13:31, Bjorn Helgaas wrote:
>> ...
> 
>>>>> That's one thing I liked about the v20 iteration -- instead of
>>>>> pci_d3cold_disable(), we changed dev->pme_support, which should mean
>>>>> that we only avoid D3hot/D3cold if we need PMEs while in those states,
>>>>> so I assumed that we *could* use D3 when we don't need the wakeups.
>>>>
>>>> If you think it's worth spinning again for this optimization I think a
>>>> device_may_wakeup() check on the root port can achieve the same result as
>>>> the v20 PME solution did, but without the walking of a tree in the quirk.
>>>
>>> Why would we use device_may_wakeup() here?  That seems like too much
>>> assumption about the suspend path,
>>
>> Because that's what pci_target_state() passes as well to determine if a
>> wakeup is needed.
> 
> That's exactly what I mean about having too many assumptions here
> about other parts of the kernel.  I like pme_support because it's the
> most specific piece of information about the issue and we don't have
> to know anything about how pci_target_state() works to understand it.
> 

Got it.

>>> and we already have the Root Port
>>> pci_dev, so rp->pme_support is available.  What about something like
>>> this:
>>
>> It includes the round trip to config space which Lukas called out as
>> negative previously but it should work.
> 
> True.  But I can't get too excited about one config read in the resume
> path.
> 
>>> +	rp = pcie_find_root_port(dev);
>>> +	if (!rp->pm_cap)
>>> +		return;
>>> +
>>> +	rp->pme_support &= ~((PCI_PM_CAP_PME_D3hot|PCI_PM_CAP_PME_D3cold) >>
>>> +				    PCI_PM_CAP_PME_SHIFT);
> 
> Is it actually necessary to look up the Root Port here?  Would it be
> enough if we removed D3 from the xHCI devices (0x162e, 0x162f, 0x1668,
> 0x1669), e.g., just do this:
> 
>    dev->pme_support &= ~((PCI_PM_CAP_PME_D3hot|PCI_PM_CAP_PME_D3cold) >>
>                                PCI_PM_CAP_PME_SHIFT);
> 
> I assume that if we knew the xHCI couldn't generate wakeups from D3,
> we would leave the xHCI in D0, and that would mean we'd also leave the
> Root Port in D0?
> 
> Or is the desired behavior that we put the xHCI in D3hot/cold and only
> leave the the Root Port in D0?
> 
> Bjorn

The intended behavior is that the PCI end points go into D3, but the 
root port stays in D0.  That matches how Windows behaves.

  reply	other threads:[~2023-10-03 20:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-02 18:09 [PATCH v21] PCI: Avoid D3 at suspend for AMD PCIe root ports w/ USB4 controllers Mario Limonciello
2023-10-03  9:41 ` Mika Westerberg
2023-10-03 17:24 ` Bjorn Helgaas
2023-10-03 18:06   ` Mario Limonciello
2023-10-03 18:31     ` Bjorn Helgaas
2023-10-03 18:37       ` Mario Limonciello
2023-10-03 19:16         ` Bjorn Helgaas
2023-10-03 19:24           ` Mario Limonciello
2023-10-03 19:59             ` Bjorn Helgaas
2023-10-03 20:02               ` Mario Limonciello [this message]
2023-10-03 20:00 ` Lukas Wunner
2023-10-03 20:16   ` Mario Limonciello
2023-10-03 20:29     ` Lukas Wunner

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=84d840c3-5557-4b18-8d49-e60759cfb27d@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=bhelgaas@google.com \
    --cc=hdegoede@redhat.com \
    --cc=helgaas@kernel.org \
    --cc=iain@orangesquash.org.uk \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rjw@rjwysocki.net \
    --cc=stable@vger.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