Bug 22932

Summary: [REGRESSION] [2.6.37-rc1] Fan noise after suspend to ram/disk
Product: ACPI Reporter: Maciej Rutecki (maciej.rutecki)
Component: Power-FanAssignee: Rafael J. Wysocki (rjw)
Status: CLOSED CODE_FIX    
Severity: normal CC: kruk.jaroslaw, lenb, maciej.rutecki, rjw, rui.zhang, tomi
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.37-rc1 Subsystem:
Regression: Yes Bisected commit-id:
Bug Depends on:    
Bug Blocks: 7216, 21782    
Attachments: ACPI / power: Do not reference count power resources without checking state
ACPI: Rework PM routines related to power resources
Platform / x86: Make fujitsu_laptop use acpi_bus_update_power()

Description Maciej Rutecki 2010-11-14 20:16:21 UTC
Subject    : [REGRESSION] [2.6.37-rc1] Fan noise after suspend to ram/disk
Submitter  : Maciej Rutecki <maciej.rutecki@gmail.com>
Date       : 2010-11-04 16:06
Message-ID : 201011041706.59046.maciej.rutecki@gmail.com
References : http://marc.info/?l=linux-kernel&m=128888684308982&w=2

This entry is being used for tracking a regression from 2.6.36. Please don't
close it until the problem is fixed in the mainline.
Comment 1 Len Brown 2010-11-16 02:20:26 UTC
try reverting this commit: 3e384ee6c687cb397581ee8f9440fc8220cfac80
"ACPI / PM: Fix reference counting of power resources"
Comment 2 Maciej Rutecki 2010-11-16 15:44:17 UTC
Already I run patch from Zhang Rui (http://marc.info/?l=linux-kernel&m=128987068408102&w=2). When I finish then I will revert commit above.
Comment 3 Maciej Rutecki 2010-11-16 19:26:15 UTC
(In reply to comment #1)
> try reverting this commit: 3e384ee6c687cb397581ee8f9440fc8220cfac80
> "ACPI / PM: Fix reference counting of power resources"

You probably have right. Revert this commit seems solve problem.

Regards
Comment 4 Maciej Rutecki 2010-11-16 19:30:11 UTC
Caused by:

commit 3e384ee6c687cb397581ee8f9440fc8220cfac80
Author: Rafael J. Wysocki <rjw@sisk.pl>
Date:   Fri Oct 22 02:35:54 2010 +0200

    ACPI / PM: Fix reference counting of power resources

    Reported-by: Matthew Garrett <mjg@redhat.com>
    Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
    Signed-off-by: Len Brown <len.brown@intel.com>

First-Bad-Commit : 3e384ee6c687cb397581ee8f9440fc8220cfac80
Comment 5 Rafael J. Wysocki 2010-11-16 21:58:53 UTC
Please try if applying the following three patches on top of the
failing commit fixes the problem:

https://patchwork.kernel.org/patch/287542/
https://patchwork.kernel.org/patch/287562/
https://patchwork.kernel.org/patch/287552/
Comment 6 Maciej Rutecki 2010-11-17 17:23:27 UTC
I try apply these patches on 2.6.37-rc1, but patches won't apply correctly:

root@gumis:/usr/src/linux-2.6.37-rc1# patch -p1 < RFC-RFT-1-3-ACPI-PM-Register-acpi_power_driver-early.patch 
patching file drivers/acpi/bus.c
Hunk #1 FAILED at 1025.
1 out of 1 hunk FAILED -- saving rejects to file drivers/acpi/bus.c.rej
patching file drivers/acpi/scan.c
Hunk #1 succeeded at 1550 (offset 7 lines).
root@gumis:/usr/src/linux-2.6.37-rc1# patch -p1 < RFC-RFT-2-3-ACPI-PM-Register-power-resource-devices-as-soon-as-they-are-needed.patch 
patching file drivers/acpi/scan.c
Hunk #1 succeeded at 827 (offset 9 lines).
Hunk #2 succeeded at 857 (offset 9 lines).
Hunk #3 succeeded at 1312 (offset 2 lines).
root@gumis:/usr/src/linux-2.6.37-rc1# patch -p1 < RFC-RFT-3-3-ACPI-PM-Fix-initial-reference-counting-of-power-resources.patch 
patching file drivers/acpi/scan.c
Hunk #1 succeeded at 889 (offset 9 lines).
root@gumis:/usr/src/linux-2.6.37-rc1#

So I manually edit drivers/acpi/bus.c and remove acpi_power_init(); from static int __init acpi_init(void). Should use another kernel?

After the reboot & s2ram I have still the same problem.
Comment 7 Rafael J. Wysocki 2010-11-17 20:40:02 UTC
OK, thanks for testing.

I'll try to figure out what's wrong in the next few of days.
Comment 8 Rafael J. Wysocki 2010-11-17 22:41:19 UTC
Created attachment 37372 [details]
ACPI / power: Do not reference count power resources without checking state

Can you check if this patch (without the previous 3 patches) on top of the
failing commit makes any difference?
Comment 9 Maciej Rutecki 2010-11-18 18:54:21 UTC
(In reply to comment #8)
> Created an attachment (id=37372) [details]
> ACPI / power: Do not reference count power resources without checking state
> 
> Can you check if this patch (without the previous 3 patches) on top of the
> failing commit makes any difference?

Tested 2 times when CPU temperature is below 1st trip point (CPU=40*C vs. trip point=45*C) and seems be OK.

Tested on 2.6.37-rc1 + yours patch.

Thanks
Comment 10 Rafael J. Wysocki 2010-11-18 21:46:53 UTC
Thanks for testing.

This patch may be sufficient for 2.6.37, but I think more changes will be
necessary in general, so I'll have some more patches to test if you don't
mind.
Comment 11 Rafael J. Wysocki 2010-11-18 22:42:28 UTC
Handled-By : Rafael J. Wysocki <rjw@sisk.pl>
Patch : https://bugzilla.kernel.org/attachment.cgi?id=37372
Comment 12 Maciej Rutecki 2010-11-19 19:06:21 UTC
(In reply to comment #10)
> Thanks for testing.
> 
> This patch may be sufficient for 2.6.37, but I think more changes will be
> necessary in general, so I'll have some more patches to test if you don't
> mind.

I don't see any problem test another yours patches. I will wait for it.

Regards
Comment 13 Rafael J. Wysocki 2010-11-21 14:49:21 UTC
Created attachment 37822 [details]
ACPI: Rework PM routines related to power resources

Please test if your machine behaves correctly with this patch applied
(on top of the current mainline kernel).
Comment 14 Maciej Rutecki 2010-11-22 17:54:32 UTC
(In reply to comment #13)
> Created an attachment (id=37822) [details]
> ACPI: Rework PM routines related to power resources
> 
> Please test if your machine behaves correctly with this patch applied
> (on top of the current mainline kernel).

Works OK. Fan doesn't run on full speed, but seed depends on current temperature, as should. You can add "Tested-by" for your patch.

Thanks for help
Comment 15 Rafael J. Wysocki 2010-11-25 00:05:11 UTC
Ignore-Patch : https://bugzilla.kernel.org/attachment.cgi?id=37822
Patch : https://patchwork.kernel.org/patch/354682/
Comment 16 Rafael J. Wysocki 2010-11-25 00:07:26 UTC
Ignore-Patch : https://bugzilla.kernel.org/attachment.cgi?id=37372
Comment 17 Maciej Rutecki 2010-12-05 13:49:48 UTC
Bug still present in -rc4. When patch from https://bugzilla.kernel.org/show_bug.cgi?id=22932#c13 will be add to 2.6.37?
Comment 18 Maciej Rutecki 2010-12-10 21:23:31 UTC
Bug still present in -rc5
Comment 19 Jaroslaw Kruk 2010-12-11 15:26:23 UTC
I use kernel 2.6.37-rc5+ and notice bug describe in this issue. I apply patch 37372 and for 2 days seems to be OK, but today when I resume my laptop (after suspend it to ram) fan are noise again. I suspend it another one, after one minute, and resume again and then everything are OK. I think, that patch 37372 is not complete, and sometimes did not work properly.
Comment 20 Rafael J. Wysocki 2010-12-11 19:27:27 UTC
Have you tested the patch from comment #13 ?
Comment 21 Jaroslaw Kruk 2010-12-11 20:23:17 UTC
No. This one I don't apply, but I'll do it now. Is patch from comment #13 (37822) should be apply instead of patch from comment #8 (37372) ?
Comment 22 Rafael J. Wysocki 2010-12-11 20:31:43 UTC
The patch from comment #8 is a minimal fix for 2.6.37, but the one from
comment #13 is what we're going to do eventually in 2.6.38, more or less.
Comment 23 Jaroslaw Kruk 2010-12-11 21:19:05 UTC
I applied patch from comment #13 and kernel doesn't compile now. The error is as follows:

  CC [M]  drivers/platform/x86/fujitsu-laptop.o
drivers/platform/x86/fujitsu-laptop.c: In function 'acpi_fujitsu_add':
drivers/platform/x86/fujitsu-laptop.c:692: error: implicit declaration of function 'acpi_bus_get_power'
Comment 24 Rafael J. Wysocki 2010-12-11 22:23:28 UTC
Created attachment 39882 [details]
Platform / x86: Make fujitsu_laptop use acpi_bus_update_power()

It looks like you need this patch in addition.
Comment 25 Jaroslaw Kruk 2010-12-11 23:10:22 UTC
Now (after patch from comment #24) is much better. Kernel compiled correctly and looks like it works, but I will be observe it and report how it works.

Thanks for help.
Comment 26 Jaroslaw Kruk 2010-12-16 13:48:36 UTC
I still use this patch, and everything is OK. Today I applied it on kernel 2.6.37-rc6 and I will be watch is resume work properly.
Comment 27 Maciej Rutecki 2010-12-17 14:35:49 UTC
Clean 2.6.37-rc6 seems work OK.

Thanks
Comment 28 Rafael J. Wysocki 2010-12-17 19:40:04 UTC
I think we can close this bug, because the most annoying symptoms are
fixed by:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=212967c69afd348342548272aedbe4d46a9325d6

and the overall power resources rework is slated for 2.6.38.