qubes-core-admin icon indicating copy to clipboard operation
qubes-core-admin copied to clipboard

Don't apply PM overrides to thunderbolt when PCI hotplug enabled

Open dsg22 opened this issue 6 months ago • 6 comments

These are only needed because Qubes disabled PCI hotplugging in kernel config. If the user compiled a kernel with it enabled, the kernel does PM better.

dsg22 avatar Aug 30 '25 21:08 dsg22

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 70.55%. Comparing base (a930d4e) to head (454dd54).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #727   +/-   ##
=======================================
  Coverage   70.55%   70.55%           
=======================================
  Files          61       61           
  Lines       13642    13642           
=======================================
  Hits         9625     9625           
  Misses       4017     4017           
Flag Coverage Δ
unittests 70.55% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Aug 30 '25 22:08 codecov[bot]

Would it be possible for the Linux kernel to handle power management even with PCI hotplug disabled?

DemiMarie avatar Aug 30 '25 23:08 DemiMarie

Would it be possible for the Linux kernel to handle power management even with PCI hotplug disabled?

I have no idea, sadly. I think @HW42 can probably explain it. My understanding is that the reason for his suspend PM patches is because of this inability to do power managment when virtualisation is in use and PCI hotplug disabled. I'm curious about the details myself.

dsg22 avatar Aug 31 '25 00:08 dsg22

See description of the patch adding this option: https://github.com/QubesOS/qubes-linux-kernel/blob/main/xen-pciback-pm-suspend.patch

marmarek avatar Aug 31 '25 01:08 marmarek

See description of the patch adding this option: https://github.com/QubesOS/qubes-linux-kernel/blob/main/xen-pciback-pm-suspend.patch

It doesn't really explain the problem that motivated the patch though, beyond that it doesn't work "for some, not yet fully clear, reasons". But I guess maybe we still don't know what's causing it. If so, it's not possible to answer @DemiMarie's question.

dsg22 avatar Aug 31 '25 02:08 dsg22

See description of the patch adding this option: https://github.com/QubesOS/qubes-linux-kernel/blob/main/xen-pciback-pm-suspend.patch

It doesn't really explain the problem that motivated the patch though, beyond that it doesn't work "for some, not yet fully clear, reasons". But I guess maybe we still don't know what's causing it. If so, it's not possible to answer @DemiMarie's question.

It's actually pretty simple what causes it. This line https://github.com/torvalds/linux/blob/c8bc81a52d5a2ac2e4b257ae123677cf94112755/drivers/pci/pci-acpi.c#L820 causes pciehp_is_native to return false for any Thunderbolt ports, which in turn causes pci_bridge_d3_possible to return false for those ports: https://github.com/torvalds/linux/blob/c8bc81a52d5a2ac2e4b257ae123677cf94112755/drivers/pci/pci.c#L3060 and hence the kernel completely blocks D3 for the ports.

RealityAnomaly avatar Aug 31 '25 03:08 RealityAnomaly