Skip to contentSkip to conversation

2.4.22-pre7 : ACPI poweroff fix

PATCH Marcelo Tosatti 1 participant 1 message Jul 24, 2003 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Andrew,

What is your opinion on this patch?

Quoted 113 lines · Willy Tarreau

Hi Marcelo,

[ this is a resend, there has been a delivery failure at conectiva. If
you want, I can forward you the copy from the mailer daemon ]

here are those fixes again. I have received a second report that it fixed the ACPI poweroff bug (this time, for <[email protected]>). IIRC, when you unroll the code, it's obviously buggy because a function (of which I don't remember the name, it's 3 months old) is called explicitely for state=S5, but avoids this value within the tests !

Please apply it, or ask Andrew for some feedback. It seems as if he doesn't receive my emails, I've sent him these patches 2 or 3 times since, including one on the acpi-devel list, but never got any feedback (or I had no luck and mailed him during his hollidays) :-(

Unfortunately, I have not kept the original mail containing my analysis of the problem at this time.

Thanks in advance,
Willy

----- Forwarded message from Willy Tarreau <[email protected]> -----

Date: Thu, 10 Jul 2003 09:58:50 +0200
From: Willy Tarreau <[email protected]>
To: Aschwin Marsman <[email protected]>
Cc: Marcelo Tosatti <[email protected]>,
lkml <[email protected]>
Subject: Re: Linux 2.4.22-pre4
In-Reply-To: <[email protected]>
User-Agent: Mutt/1.4i
Precedence: bulk
X-Mailing-List: [email protected]

Hi !

Quoted 9 lines · Aschwin Marsman
Quoted 7 lines · Marcelo Tosatti

Hi,

Here goes -pre4. It contains a lot of updates and fixes.

We decided to include this new code quota code which allows usage of quotas with 32bit UID/GIDs.

Quoted 7 lines
Quoted 3 lines

Most Toshibas should work now due to an important ACPI fix.

Please help and test.

I use -pre3 with succes, only power down is currently not working (only the discs shutdown, no real poweroff). That's why I disabled apm and enabled apm in the kernel with -pre4, but that gives:

I remember having had problems with ACPI because my power off didn't work. After reading through the code, I noticed that due to erroneous comparisons, some code path would never be executed, and/or some preparatory work before entering S5 would be done twice, or could not recover from error, I don't recall exactly. So I sent the two patches below to the acpi-devel list twice, but never got any reply.

I don't even know if they still apply, but you can try them anyway, they're simple.

If I recall correctly, the first one should be enough to poweroff with a simple "echo 5 > /proc/acpi/sleep", while the second one allows the system to use this for poweroff.

Cheers,
Willy

drivers/acpi/system.c renamed from drivers/acpi/system.c-orig +2 -1
@@ -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;
drivers/acpi/system.c renamed from drivers/acpi/system.c-orig +1 -3
@@ -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*/