mbox series

[0/2] Put XHCI controllers into D3 at S4/S5

Message ID 20240712185418.937087-1-superm1@kernel.org (mailing list archive)
Headers show
Series Put XHCI controllers into D3 at S4/S5 | expand

Message

Mario Limonciello July 12, 2024, 6:54 p.m. UTC
From: Mario Limonciello <mario.limonciello@amd.com>

When the system is put into S4 or S5 XHCI controllers remain in D0.  This
causes higher power consumption and may compromise energy certifications.
Consequently some systems consume more power in S5 than s0i3.

This affects all PCIe devices, but looking at breakdowns XHCI is the
biggest offender for power consumption.

This series checks if any wakeups are needed and puts controllers into D3
if no wakeup necessary.

This series is a spiritual successor to [1] which aimed to do this more
generally in PCI.  It also accomplishes similar goals as [2], but aims for
both S4 and S5.

[1] https://lore.kernel.org/linux-pci/20231213182656.6165-1-mario.limonciello@amd.com/#t
[2] https://lore.kernel.org/linux-pci/9d2f1619-1c61-4e8c-b28d-d4eddefa45c3@amd.com/T/

Mario Limonciello (2):
  xhci: pci: If no ports have wakeup enabled then disable PCI device at
    S4
  xhci: pci: Put XHCI controllers into D3hot at shutdown

 drivers/usb/host/xhci-pci.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

Comments

Mario Limonciello Aug. 20, 2024, 2:06 a.m. UTC | #1
On 7/12/24 13:54, superm1@kernel.org wrote:
> From: Mario Limonciello <mario.limonciello@amd.com>
> 
> When the system is put into S4 or S5 XHCI controllers remain in D0.  This
> causes higher power consumption and may compromise energy certifications.
> Consequently some systems consume more power in S5 than s0i3.
> 
> This affects all PCIe devices, but looking at breakdowns XHCI is the
> biggest offender for power consumption.
> 
> This series checks if any wakeups are needed and puts controllers into D3
> if no wakeup necessary.
> 
> This series is a spiritual successor to [1] which aimed to do this more
> generally in PCI.  It also accomplishes similar goals as [2], but aims for
> both S4 and S5.
> 
> [1] https://lore.kernel.org/linux-pci/20231213182656.6165-1-mario.limonciello@amd.com/#t
> [2] https://lore.kernel.org/linux-pci/9d2f1619-1c61-4e8c-b28d-d4eddefa45c3@amd.com/T/
> 
> Mario Limonciello (2):
>    xhci: pci: If no ports have wakeup enabled then disable PCI device at
>      S4
>    xhci: pci: Put XHCI controllers into D3hot at shutdown
> 
>   drivers/usb/host/xhci-pci.c | 17 +++++++++++------
>   1 file changed, 11 insertions(+), 6 deletions(-)
> 

Hello,

Any feedback for this series?

Thanks,
Kai-Heng Feng Aug. 22, 2024, 7:15 a.m. UTC | #2
Hi Mario,

On Tue, Aug 20, 2024 at 10:06 AM Mario Limonciello <superm1@kernel.org> wrote:
>
> On 7/12/24 13:54, superm1@kernel.org wrote:
> > From: Mario Limonciello <mario.limonciello@amd.com>
> >
> > When the system is put into S4 or S5 XHCI controllers remain in D0.  This
> > causes higher power consumption and may compromise energy certifications.
> > Consequently some systems consume more power in S5 than s0i3.
> >
> > This affects all PCIe devices, but looking at breakdowns XHCI is the
> > biggest offender for power consumption.
> >
> > This series checks if any wakeups are needed and puts controllers into D3
> > if no wakeup necessary.
> >
> > This series is a spiritual successor to [1] which aimed to do this more
> > generally in PCI.  It also accomplishes similar goals as [2], but aims for
> > both S4 and S5.
> >
> > [1] https://lore.kernel.org/linux-pci/20231213182656.6165-1-mario.limonciello@amd.com/#t
> > [2] https://lore.kernel.org/linux-pci/9d2f1619-1c61-4e8c-b28d-d4eddefa45c3@amd.com/T/
> >
> > Mario Limonciello (2):
> >    xhci: pci: If no ports have wakeup enabled then disable PCI device at
> >      S4
> >    xhci: pci: Put XHCI controllers into D3hot at shutdown
> >
> >   drivers/usb/host/xhci-pci.c | 17 +++++++++++------
> >   1 file changed, 11 insertions(+), 6 deletions(-)
> >
>
> Hello,
>
> Any feedback for this series?

Does commit 0fab972eef49 ("drivers: core: Detach device from power
domain on shutdown") work for your case?
The commit was reverted because it regressed some DT based devices,
but probably still worth doing for ACPI based systems.

Kai-Heng

>
> Thanks,
Mario Limonciello Aug. 22, 2024, 7:21 p.m. UTC | #3
On 8/22/2024 02:15, Kai-Heng Feng wrote:
> Hi Mario,
> 
> On Tue, Aug 20, 2024 at 10:06 AM Mario Limonciello <superm1@kernel.org> wrote:
>>
>> On 7/12/24 13:54, superm1@kernel.org wrote:
>>> From: Mario Limonciello <mario.limonciello@amd.com>
>>>
>>> When the system is put into S4 or S5 XHCI controllers remain in D0.  This
>>> causes higher power consumption and may compromise energy certifications.
>>> Consequently some systems consume more power in S5 than s0i3.
>>>
>>> This affects all PCIe devices, but looking at breakdowns XHCI is the
>>> biggest offender for power consumption.
>>>
>>> This series checks if any wakeups are needed and puts controllers into D3
>>> if no wakeup necessary.
>>>
>>> This series is a spiritual successor to [1] which aimed to do this more
>>> generally in PCI.  It also accomplishes similar goals as [2], but aims for
>>> both S4 and S5.
>>>
>>> [1] https://lore.kernel.org/linux-pci/20231213182656.6165-1-mario.limonciello@amd.com/#t
>>> [2] https://lore.kernel.org/linux-pci/9d2f1619-1c61-4e8c-b28d-d4eddefa45c3@amd.com/T/
>>>
>>> Mario Limonciello (2):
>>>     xhci: pci: If no ports have wakeup enabled then disable PCI device at
>>>       S4
>>>     xhci: pci: Put XHCI controllers into D3hot at shutdown
>>>
>>>    drivers/usb/host/xhci-pci.c | 17 +++++++++++------
>>>    1 file changed, 11 insertions(+), 6 deletions(-)
>>>
>>
>> Hello,
>>
>> Any feedback for this series?
> 
> Does commit 0fab972eef49 ("drivers: core: Detach device from power
> domain on shutdown") work for your case?
> The commit was reverted because it regressed some DT based devices,
> but probably still worth doing for ACPI based systems.
> 
> Kai-Heng
> 
>>
>> Thanks,

Thanks for pointing that out and Mathias thanks for the comments.  I've 
spent some time today looking at the different permutations of patches 
to see what happens at shutdown to devices.

These are all the patches I tested (in various combinations)

Baseline: 6.11-rc4
FS: 6.11-rc4 + 0fab972eef49
ML: 6.11-rc4 + this series
KH: 6.11-rc4 + 
https://lore.kernel.org/linux-pci/9d2f1619-1c61-4e8c-b28d-d4eddefa45c3@amd.com/T/#md69ca96133ae0191eefb2f7f5003ce9cc180ec76

The results are available here (in markdown):
https://gist.github.com/superm1/f8f81e52f5b1d55b64493fdaec38e31c

It seems to me:
* FS didn't change anything
* ML only affects the XHCI controllers (into D3 at S5).
* KH in any combination is the best

Considering this I will scrap this patch series and I will leave a 
comment your patch KH.  Hope we can get that in, it's great.

Thanks!