From: "willy tarreau" <wtarreau-Qt13gs6zZMY@public.gmane.org>
To: andrew.grover-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Cc: Acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: [PATCH][2.4] acpi S5 poweroff fix
Date: Tue, 29 Apr 2003 20:15:18 +0200 (CEST) [thread overview]
Message-ID: <20030429181518.96485.qmail@web41601.mail.yahoo.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2494 bytes --]
Hello Andy,
since I have this new laptop (sony vaio pcg-fx705), ACPI has never allowed
me to shutdown correctly. It always hangs and I have to maintain the power
button pressed to power off, whatever the version of your acpi patch I was
using. Today, I had a bit of free time, so I investigated into the code and
finally fixed the problem :-)
Basically, two unrelated things :
1) I noticed that "echo 5 >/proc/acpi/sleep" would oops, so I manually copied
the oops and discovered that acpi_restore_state_mem() crashed, trying to
affet 'pmd' a NULL value. Then I realized that it was because on this path,
acpi_save_state_mem() was never called in S5. I first thought this was
intentional because S5 is not expected to return, but reading through the
code, I found a conflict such as "if (state < 5) { ... if (state != 5) ..."
so I was sure that the first one should have included 5, and I changed the
'<' to '<=' so that acpi_save_state_mem() is now called.
It still didn't work, and I noticed that in acpi_suspend(), the call to
acpi_system_suspend() is expected to do the right job and certainly not to
return. But acpi_system_suspend() does nothing if called with state=5 !
So I added the check for ACPI_STATE_S5 at the same level as _S1 because it
semt right to me.
=> with these 2 changes, echoing 5 in /proc/acpi/sleep now turns my notebook
OFF !!!
=> I diffed original (20030424) and my changes and put them in the first
attached patch.
2) The sad thing is that even after that, neither Alt-SysRq-O nor halt would
power off. I saw that acpi_poweroff() was a simpler than the code path
executed from acpi_suspend(5). I tried to duplicate part of the code, but
no lock. I think I missed some bits. So I did it far simpler : now
acpi_poweroff() only calls acpi_suspend(ACPI_STATE_S5) and everything works
fine ! => hence the second patch, still against 20030424.
Although I'm not sure that the second case affects everybody, because it might
be caused by side-effects, but from what I've understood from the code, I'm
pretty sure that nobody can power off by echoing 5 to /proc/acpi/sleep !
Here are the two patches, please review them and apply them if you agree !
Cheers,
Willy (happy with a notebook that powers down for the first time in months !)
___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com
[-- Attachment #2: acpi-20030424-S5-fix.diff --]
[-- Type: application/octet-stream, Size: 531 bytes --]
--- ./drivers/acpi/system.c-orig Tue Apr 29 17:39:34 2003
+++ ./drivers/acpi/system.c Tue Apr 29 19:08:09 2003
@@ -180,7 +180,7 @@
return AE_ERROR;
}
- if (state < ACPI_STATE_S5) {
+ if (state <= ACPI_STATE_S5) {
/* Tell devices to stop I/O and actually save their state.
* It is theoretically possible that something could fail,
* so handle that gracefully..
@@ -277,6 +277,7 @@
switch (state) {
case ACPI_STATE_S1:
+ case ACPI_STATE_S5:
barrier();
status = acpi_enter_sleep_state(state);
break;
[-- Attachment #3: acpi-20030424-pwoff-use-suspend.diff --]
[-- Type: application/octet-stream, Size: 339 bytes --]
--- ./drivers/acpi/system.c-working Tue Apr 29 19:09:19 2003
+++ ./drivers/acpi/system.c Tue Apr 29 19:36:08 2003
@@ -90,9 +90,7 @@
static void
acpi_power_off (void)
{
- acpi_enter_sleep_state_prep(ACPI_STATE_S5);
- ACPI_DISABLE_IRQS();
- acpi_enter_sleep_state(ACPI_STATE_S5);
+ acpi_suspend(ACPI_STATE_S5);
}
#endif /*CONFIG_PM*/
next reply other threads:[~2003-04-29 18:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-29 18:15 willy tarreau [this message]
2003-04-30 12:09 ` [PATCH][2.4] acpi S5 poweroff fix Derek Broughton
[not found] ` <03ea01c30f11$53ec94a0$3746028e-dP0OE4Ef7fWw5LPnMra/2Q@public.gmane.org>
2003-04-30 13:42 ` Ducrot Bruno
[not found] ` <20030429181518.96485.qmail-NXgsjPK8tUaA/QwVtaZbd3CJp6faPEW9@public.gmane.org>
2003-04-30 14:29 ` Markus Gaugusch
2003-04-30 15:02 ` Derek Broughton
[not found] ` <Pine.LNX.4.53.0304301628010.4213-sxQ525G0OhRQK2oVCIMtW7NldLUNz+W/@public.gmane.org>
2003-04-30 19:38 ` Karol Kozimor
[not found] ` <20030430193855.GA21497-DETuoxkZsSqrDJvtcaxF/A@public.gmane.org>
2003-05-02 8:44 ` Ducrot Bruno
-- strict thread matches above, loose matches on Subject: below --
2003-05-12 8:35 Yu, Luming
[not found] ` <3ACA40606221794F80A5670F0AF15F842722F6-4yWAQGcml64gGBtAFL8yw7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2003-05-13 12:43 ` Ducrot Bruno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030429181518.96485.qmail@web41601.mail.yahoo.com \
--to=wtarreau-qt13gs6zzmy@public.gmane.org \
--cc=Acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=andrew.grover-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox