Bug 216263 - Thunderbolt on Dell XPS 13 9300 & 7390 2-in-1 takes 8 sec to suspend and 8 sec to resume.
Summary: Thunderbolt on Dell XPS 13 9300 & 7390 2-in-1 takes 8 sec to suspend and 8 se...
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: PCI (show other bugs)
Hardware: Intel Linux
: P1 normal
Assignee: drivers_pci@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks: 178231
  Show dependency tree
 
Reported: 2022-07-20 21:03 UTC by Todd Brandt
Modified: 2022-07-20 23:33 UTC (History)
0 users

See Also:
Kernel Version: 5.19.0-rc7
Subsystem:
Regression: No
Bisected commit-id:


Attachments
dell-7390_freeze-thunderbolt.html (1016.27 KB, text/html)
2022-07-20 21:03 UTC, Todd Brandt
Details
dell-7390_freeze-thunderbolt-removed.html (665.30 KB, text/html)
2022-07-20 21:04 UTC, Todd Brandt
Details
dell-9300_freeze-thunderbolt.html (718.52 KB, text/html)
2022-07-20 22:04 UTC, Todd Brandt
Details
dell-9300_freeze-thunderbolt-removed.html (608.82 KB, text/html)
2022-07-20 22:05 UTC, Todd Brandt
Details
otcpl-dell-9300-icl_freeze-thunderbolt.html (657.74 KB, text/html)
2022-07-20 23:33 UTC, Todd Brandt
Details
otcpl-dell-9300-icl_freeze-thunderbolt-removed.html (545.52 KB, text/html)
2022-07-20 23:33 UTC, Todd Brandt
Details

Description Todd Brandt 2022-07-20 21:03:47 UTC
Created attachment 301465 [details]
dell-7390_freeze-thunderbolt.html

This performance issue was found running sleepgraph on linux 5.19.0-rc7 on the Dell XPS 13 7390 2-in-1. For reasons unknown, the thunderbolt device takes a full 8 seconds to suspend and a full 8 seconds to resume even though no physical devices are connected.

The issue seems to occur in the both the dpm_suspend and dpm_resume phase. There are 4 thunderbolt devices: 2 pcieports and 2 thunderbolt NHIs. The suspend & resume callbacks for these devices spawn async threads that take 8 seconds to complete. The time is shown at the end of dpm_suspend/dpm_resume when async_synchronize_full is called.

The time appears to be spent in the ACPI calls: \_SB.PCIO.TBT0._ON and \_SB.PCIO.TBT1._ON. 

If I disable the 4 thunderbolt devices and run another suspend/resume, the issue goes away. So if thunderbolt is not needed, you can avoid this issue by running this script at boot:

#!/bin/sh

if [ $USER != "root" ]; then
    echo "Can only be run as root"
    exit
fi

THUNPCI1="/sys/bus/pci/devices/0000:00:07.2"
THUNPCI2="/sys/bus/pci/devices/0000:00:07.0"
THUNDEV="/sys/bus/pci/drivers/thunderbolt"

if [ -e $THUNDEV/0000:00:0d.3 ]; then
    echo 0000:00:0d.3 > $THUNDEV/unbind
fi
if [ -e $THUNDEV/0000:00:0d.2 ]; then
    echo 0000:00:0d.2 > $THUNDEV/unbind
fi
if [ -e $THUNPCI1 ]; then
    echo 1 > $THUNPCI1/remove
fi
if [ -e $THUNPCI2 ]; then
    echo 1 > $THUNPCI2/remove
fi

I'm attaching two sleepgraph timelines. The first is the problem timeline run with thunderbolt enabled. The second is run with thunderbolt disabled with the above script. 

dell-7390_freeze-thunderbolt.html
dell-7390_freeze-thunderbolt-removed.html

The dmesg logs and system info are in the timelines themselves. Just click the "dmesg" and "log" buttons in the upper right hand corner of the timelines.
Comment 1 Todd Brandt 2022-07-20 21:04:22 UTC
Created attachment 301466 [details]
dell-7390_freeze-thunderbolt-removed.html
Comment 2 Todd Brandt 2022-07-20 22:04:44 UTC
Created attachment 301467 [details]
dell-9300_freeze-thunderbolt.html
Comment 3 Todd Brandt 2022-07-20 22:05:15 UTC
Created attachment 301468 [details]
dell-9300_freeze-thunderbolt-removed.html
Comment 4 Todd Brandt 2022-07-20 22:06:33 UTC
I just confirmed the exact same issue on the dell XPS 13 9300. Both this as the 7390 are Ice Lake machines. Attached are the before and after thunderbolt timelines.
Comment 5 Todd Brandt 2022-07-20 23:33:20 UTC
Created attachment 301469 [details]
otcpl-dell-9300-icl_freeze-thunderbolt.html
Comment 6 Todd Brandt 2022-07-20 23:33:58 UTC
Created attachment 301470 [details]
otcpl-dell-9300-icl_freeze-thunderbolt-removed.html

Note You need to log in before you can comment on or make changes to this bug.