Bug 6612 - S3: resume poweroff due to outstanding button event
Summary: S3: resume poweroff due to outstanding button event
Alias: None
Product: ACPI
Classification: Unclassified
Component: Other (show other bugs)
Hardware: i386 Linux
: P2 normal
Assignee: Arnaud Patard
Depends on: 6634
  Show dependency tree
Reported: 2006-05-24 14:52 UTC by Henrique de Moraes Holschuh
Modified: 2006-06-25 21:37 UTC (History)
2 users (show)

See Also:
Kernel Version:
Tree: Mainline
Regression: ---

patch from Arnaud Patard: delete powerbutton event after resume from S3 (751 bytes, patch)
2006-05-24 14:55 UTC, Henrique de Moraes Holschuh
Details | Diff
Incremental patch using acpi_set_register instead of acpi_clear_event (1.01 KB, patch)
2006-05-29 08:49 UTC, Arnaud Patard
Details | Diff

Description Henrique de Moraes Holschuh 2006-05-24 14:52:18 UTC
Most recent kernel where this bug did not occur: n/a
Distribution: Mainline + acpi-release-20060310-2.6.16 patches
Hardware Environment: Thinkpad T43 2687
Software Environment: Debian
Problem Description:

Resuming from S3 (suspend-to-ram) using the power button causes a stray
power-button event which shutdowns the machine.  Apparently, ACPI 3.0 P62 says
the kernel should be cleaning up the stray powerbutton event, instead of letting
userspace deal with the mess.

There is an analysis and patch about this issue at

I am just reporting the bug (which I verified), and the possible solution by Mr.
Arnaud Patard in the above mentioned post.

Steps to reproduce:
  boot with a kernel using acpi_sleep=s3_bios
  do echo mem > /sys/power/state (preferably using a properly setup hibernate
  wake machine up using the power button
Comment 1 Henrique de Moraes Holschuh 2006-05-24 14:55:23 UTC
Created attachment 8201 [details]
patch from Arnaud Patard: delete powerbutton event after resume from S3

Patch and analysis by Arnaud Patard <apatard <at> mandriva.com>, posted to:
Comment 2 Shaohua 2006-05-25 20:13:46 UTC
This is a downside in the patch. 'acpi_clear_event' isn't supposed to be 
called with interrupt disabled (it uses mutex).
Comment 3 Henrique de Moraes Holschuh 2006-05-26 04:24:56 UTC
Can't the code be modifed to use a semasphore of some sort, so that it supresses
the powerbutton event after the mutex is released?
Comment 4 Arnaud Patard 2006-05-26 05:08:44 UTC
Reply to comment #2: 

Calling acpi_set_register() with ACPI_MTX_DO_NOT_LOCK instead of calling
acpi_clear_event() would be better ?
Comment 5 Shaohua 2006-05-28 19:22:12 UTC
Yes, I agree acpi_set_register() is the right way.
Comment 6 Arnaud Patard 2006-05-29 08:49:11 UTC
Created attachment 8223 [details]
Incremental patch using acpi_set_register instead of acpi_clear_event

This is an incremental version but I can send a full version if preferred :)
Comment 7 Robert Moore 2006-05-31 10:27:29 UTC
It's a bit nasty to use a global variable within ACPICA, 
Comment 8 Len Brown 2006-05-31 22:38:43 UTC
While the patch in comment #6 treats the symptom, the proper
fix is to enable acpi_clear_event() to be called 
from interrupt context.

To do that, the semaphore that acpi_set_register() uses
needs to be replaced by a spin-lock.  Fixing that is the
subject of bug #6634
Comment 9 Arnaud Patard 2006-06-01 10:03:28 UTC
Ok. So, we'll have to wait having a fix for the bug #6634 ? 
Or one may change the acpi_clear_event prototype to get a second argument
(ACPI_MTX_DO_NOT_LOCK or ACPI_MTX_LOCK) (I admit that this change of prototype
is a ugly workaround :/ ) ?
Comment 10 Len Brown 2006-06-15 20:08:33 UTC
ACPICA 20060608 replaced the mutex in acpi_set_register()  
with a spin-lock, so the original patch in comment #1  
no longer needs to be modified. 
Comment 11 Len Brown 2006-06-25 21:37:20 UTC
shipped in 2.6.17-git9, closed. 

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