Bug 204321

Summary: ACPI fan resume is too long
Product: ACPI Reporter: Todd Brandt (todd.e.brandt)
Component: Power-FanAssignee: acpi_power-fan
Status: CLOSED CODE_FIX    
Severity: normal CC: rui.zhang
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 5.2.0 Subsystem:
Regression: No Bisected commit-id:
Bug Depends on:    
Bug Blocks: 178231    
Attachments: icelake-u-acpi-fan.html
issue.def
issue.def

Description Todd Brandt 2019-07-26 01:17:49 UTC
Created attachment 283973 [details]
icelake-u-acpi-fan.html

The ACPI fan driver shouldn't be forcibly re-enabled after each resume, or at least it shouldn't take this long as it's a synchronous device.
Comment 1 Todd Brandt 2019-07-26 01:18:53 UTC
Created attachment 283975 [details]
issue.def
Comment 2 Todd Brandt 2019-07-26 01:21:50 UTC
Created attachment 283977 [details]
issue.def
Comment 3 Todd Brandt 2019-12-09 22:38:14 UTC
Raphael has created a patch which appears to have fixed this issue

https://marc.info/?l=linux-pm&m=157542447022126&w=2

These are the results with the patch applied. I'll change this to fixed once the patch makes it upstream.

[After the patch]

Kernel              Host                      Test Run    Count Rate
5.4.0-acpifanfix    otcpl-whl-u-clear         mem-x2351    1    0.04%
5.4.0-acpifanfix    otcpl-z170x-ud5           mem-x2369    0    0%
5.4.0-acpifanfix    otcpl-z170x-ud5           freeze-x2492 0    0%
5.4.0-acpifanfix    otcpl-whl-u-clear         freeze-x2411 0    0%
5.4.0-acpifanfix    otcpl-whl-u               mem-x2289    0    0%
5.4.0-acpifanfix    otcpl-whl-u               freeze-x2389 0    0%
5.4.0-acpifanfix    otcpl-icl-u-2             mem-x2273    0    0%
5.4.0-acpifanfix    otcpl-icl-u-2             freeze-x817  0    0%
5.4.0-acpifanfix    otcpl-glk-rvp-1           freeze-x122  0    0%
5.4.0-acpifanfix    otcpl-dell-p5510-xeon-1   mem-x1851    0    0%
5.4.0-acpifanfix    otcpl-dell-p5510-xeon-1   freeze-x1994 0    0%
5.4.0-acpifanfix    otcpl-dell-inspiron-3493  mem-x1722    0    0%
5.4.0-acpifanfix    otcpl-dell-inspiron-3493  freeze-x2102 0    0%
5.4.0-acpifanfix    otcpl-cfl-u-01            mem-x39      0    0%
5.4.0-acpifanfix    otcpl-cfl-u-01            freeze-x2091 0    0%
5.4.0-acpifanfix    otcpl-cfl-h               mem-x415     0    0%
5.4.0-acpifanfix    otcpl-cfl-h               freeze-x2265 0    0%
5.4.0-acpifanfix    otcpl-aml-y               mem-x3126    0    0%
5.4.0-acpifanfix    otcpl-aml-y               freeze-x2288 0    0%

Compared to the data without the patch

[Before the patch]

Kernel    Host                      Test Run    Count Rate
5.3.0+    otcpl-icl-u-2             mem-x2571    2571 100.00%
5.3.0+    otcpl-whl-u               mem-x2497    2497 100.00%
5.3.0+    otcpl-cfl-h               mem-x2068    2068 100.00%
5.3.0+    otcpl-glk-rvp-1           mem-x75      74   98.67%
5.3.0+    otcpl-cfl-u-01            mem-x1074    1050 97.77%
5.3.0+    otcpl-glk-rvp-1           freeze-x45   12   26.67%
5.3.0+    otcpl-whl-u               freeze-x2649 428  16.16%
5.3.0+    otcpl-aml-y               freeze-x2434 373  15.32%
5.3.0+    otcpl-cfl-u-01            freeze-x2419 123  5.08%
5.3.0+    otcpl-latexo-ivb-cpt      freeze-x1914 97   5.07%
5.3.0+    otcpl-whl-u-clear         mem-x2640    69   2.61%
5.3.0+    otcpl-icl-u-2             freeze-x2757 59   2.14%
5.3.0+    otcpl-whl-u-clear         freeze-x2830 53   1.87%
5.3.0+    otcpl-tgl-rvp             freeze-x2086 20   0.96%
5.3.0+    otcpl-cfl-h               freeze-x2457 8    0.33%
5.3.0+    otcpl-latexo-ivb-cpt      mem-x2000    4    0.20%
5.3.0+    otcpl-aml-y               mem-x2727    2    0.07%
5.3.0+    otcpl-z170x-ud5           mem-x2669    0    0%    
5.3.0+    otcpl-z170x-ud5           freeze-x2881 0    0%    
5.3.0+    otcpl-lenovo-ideapad-130  mem-x2000    0    0%    
5.3.0+    otcpl-lenovo-ideapad-130  freeze-x2000 0    0%    
5.3.0+    otcpl-dell-p5510-xeon-2   mem-x570     0    0%    
5.3.0+    otcpl-dell-p5510-xeon-2   freeze-x1093 0    0%    
5.3.0+    otcpl-dell-p5510-xeon-1   mem-x2209    0    0%    
5.3.0+    otcpl-dell-p5510-xeon-1   freeze-x2431 0    0%    
5.3.0+    otcpl-dell-inspiron-3493  freeze-x1170 0    0%    
5.3.0+    otcpl-chromebook-hsw      freeze-x1305 0    0%    
5.3.0+    otcpl-chromebook-hsw      freeze-x368  0    0%
Comment 4 Zhang Rui 2019-12-29 13:54:59 UTC
Problem fixed in 5.5-rc2 by below commit
commit b9ea0bae260f6aae546db224daa6ac1bd9d94b91
Author:     Rafael J. Wysocki <rafael.j.wysocki@intel.com>
AuthorDate: Wed Dec 4 02:54:27 2019 +0100
Commit:     Rafael J. Wysocki <rafael.j.wysocki@intel.com>
CommitDate: Tue Dec 10 00:22:18 2019 +0100

    ACPI: PM: Avoid attaching ACPI PM domain to certain devices
    
    Certain ACPI-enumerated devices represented as platform devices in
    Linux, like fans, require special low-level power management handling
    implemented by their drivers that is not in agreement with the ACPI
    PM domain behavior.  That leads to problems with managing ACPI fans
    during system-wide suspend and resume.
    
    For this reason, make acpi_dev_pm_attach() skip the affected devices
    by adding a list of device IDs to avoid to it and putting the IDs of
    the affected devices into that list.
    
    Fixes: e5cc8ef31267 (ACPI / PM: Provide ACPI PM callback routines for subsystems)
    Reported-by: Zhang Rui <rui.zhang@intel.com>
    Tested-by: Todd Brandt <todd.e.brandt@linux.intel.com>
    Cc: 3.10+ <stable@vger.kernel.org> # 3.10+
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>