Bug 186221 - pcieport takes more than 1 second to suspend and more than 1 second to resume - Macbook Pro 2015
Summary: pcieport takes more than 1 second to suspend and more than 1 second to resume...
Alias: None
Product: Drivers
Classification: Unclassified
Component: PCI (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Chen Yu
Depends on:
Blocks: 178231
  Show dependency tree
Reported: 2016-11-01 07:31 UTC by Zhang Rui
Modified: 2017-02-13 06:39 UTC (History)
2 users (show)

See Also:
Kernel Version: 4.8
Regression: No
Bisected commit-id:

acpidump output (263.83 KB, application/octet-stream)
2016-11-01 07:32 UTC, Zhang Rui
the opcode log during resumed invoking _PS0 (199.24 KB, text/plain)
2017-02-06 09:19 UTC, Chen Yu

Description Zhang Rui 2016-11-01 07:31:29 UTC
During suspend to mem/freeze, pcieport either take more than 1 second to suspend, or more than 1 second to resume, or even both.
analyze_suspend shows that most of the time is spent in acpi_ps_parse_aml.
Comment 1 Zhang Rui 2016-11-01 07:32:04 UTC
Created attachment 243421 [details]
acpidump output
Comment 2 Zhang Rui 2016-11-29 08:06:38 UTC
Hi, Yu,
please confirm if the problem is gone with boot option pcie_ports=compat
Comment 3 Chen Yu 2016-12-01 00:21:27 UTC
tested on top of 4.9-rc7, with pcie_ports=compat, the resume time for pcieport(0000:00:1c.5) has not dropped, it's 1131ms.
Comment 4 Zhang Rui 2016-12-01 02:01:01 UTC
so this is not a duplicate of bug #99751
Comment 5 Chen Yu 2017-02-06 09:16:14 UTC
According to suspenresume result based on ftrace, it tooks more than 1 second to finish the following process on device:
# cat /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:66/path
# cat /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:66/adr

pci_pm_resume_noirq->acpi_device_set_power, thus _PS0 under this device has taken more than 1 second to finish.

Method (_PS0, 0, Serialized)  // _PS0: Power State 0
                    If (((OSDW () && NVME) == 0x00))
                        GD56 = 0x01
                        PSTA = 0x00
                        Local0 = 0x00
                        While ((\_SB.PCI0.RP06.PSTA != 0x00))
                            If ((Local0 > 0x1388))

                            Sleep (0x01)

                        Sleep (0x46)
                        L23D = 0x01
                        Sleep (0x01)
                        Local0 = 0x00
                        While (L23D)
                            If ((Local0 > 0x04))

                            Sleep (0x01)

                        LEDM = 0x00
                        Local0 = (Timer + 0x00989680)
                        While ((Timer <= Local0))
                            If (((LACT == 0x01) && (\_SB.PCI0.RP06.SSD0.CLAS == 0x01)))

                            Sleep (0x0A)

Furthermore, according to acpi tracer result by appending:
 acpi.trace_method_name=_SB.PCI0.RP06._PS0 acpi.trace_state=opcode
it shows that the third while loop is always running until time out,
that is to say, the condition of
(LACT == 0x01) && (\_SB.PCI0.RP06.SSD0.CLAS == 0x01)
is never met.

While LACT and _SB.PCI-.RP06.SSD0.CLAS is located in pci config space,
I'd rather regard this issue as a firmware problem.
Comment 6 Chen Yu 2017-02-06 09:19:52 UTC
Created attachment 254211 [details]
the opcode log during resumed invoking  _PS0

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