Bug 198583

Summary: `acpi_pm_finish()` takes over 140 ms during suspend
Product: ACPI Reporter: Paul Menzel (pmenzel+bugzilla.kernel.org)
Component: OtherAssignee: Zhang Rui (rui.zhang)
Status: RESOLVED DUPLICATE    
Severity: normal CC: pmenzel+bugzilla.kernel.org, rui.zhang, yu.c.chen
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.15-rc9 Subsystem:
Regression: No Bisected commit-id:
Attachments: Compressed HTML output of `sudo ./sleepgraph.py -config config/suspend-callgraph.cfg`
Screenshot from HTML output of `sleepgraph.py`
`acpidump -o …`

Description Paul Menzel 2018-01-25 08:34:24 UTC
Created attachment 273855 [details]
Compressed HTML output of `sudo ./sleepgraph.py -config config/suspend-callgraph.cfg`

On the TUXEDO Book BU1406 [1], benchmarking suspend times with `sudo ./sleepgraph.py -config config/suspend-callgraph.cfg` [2], it turns out that `acpi_pm_finish()` takes over 140 ms.

> acpi_pm_finish (144.631 ms) resume_machine

Looking into the “children”, the following method takes the longest time.

> acpi_ps_parse_aml (143.203 ms @ 570.791149)

Please find the compressed HTML file attached. The output of `acpidump` follows.

[1] https://www.tuxedocomputers.com/
[2] https://github.com/01org/pm-graph
Comment 1 Paul Menzel 2018-01-25 08:36:00 UTC
Created attachment 273857 [details]
Screenshot from HTML output of `sleepgraph.py`
Comment 2 Paul Menzel 2018-01-25 08:38:13 UTC
Created attachment 273859 [details]
`acpidump -o …`
Comment 3 Zhang Rui 2018-01-29 06:00:10 UTC
it is probably caused by the EC transactions. We used to have a patch to fix it, but the patch was reverted later because of regressions.
can you please try 4.12 kernel (which contains the patch) and see if the problem is gone?
Comment 4 Paul Menzel 2018-01-29 12:08:14 UTC
(In reply to Zhang Rui from comment #3)
> it is probably caused by the EC transactions. We used to have a patch to fix
> it, but the patch was reverted later because of regressions.
> can you please try 4.12 kernel (which contains the patch) and see if the
> problem is gone?

True. I guess you mean bug #185611 and commit c3a696b6e8f8 (ACPI / EC: Use busy polling mode when GPE is not enabled) and the revert commit 	662591461c (ACPI / EC: Drop EC noirq hooks to fix a regression) [1].

I’ll try to test that.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=66259146
Comment 5 Paul Menzel 2018-02-13 15:45:23 UTC
I tested the commit,  but it didn’t improve anything. It could be that PTI is at fault though, cf. bug 185611, comment 52 [1].

[1] https://bugzilla.kernel.org/show_bug.cgi?id=185611#c52
Comment 6 Chen Yu 2018-03-16 04:23:46 UTC
(In reply to Paul Menzel from comment #5)
> I tested the commit,  but it didn’t improve anything. It could be that PTI
> is at fault though, cf. bug 185611, comment 52 [1].
> 
> [1] https://bugzilla.kernel.org/show_bug.cgi?id=185611#c52
OK, 
Does it help to disable the pti by appending nopti?
Comment 7 Chen Yu 2018-03-26 08:01:36 UTC
@Paul,
Do you have a chance to confirm this?
Comment 8 Chen Yu 2018-03-26 08:09:00 UTC
Assumed to be duplicated of 198909, let's move there and debug then.

*** This bug has been marked as a duplicate of bug 198909 ***