mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Pierre Ossman <drzeus-list@drzeus.cx>
Cc: ncunningham@cyclades.com, Pavel Machek <pavel@ucw.cz>,
	Meelis Roos <mroos@linux.ee>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Len Brown <len.brown@intel.com>
Subject: Re: reboot vs poweroff
Date: Thu, 01 Sep 2005 11:00:44 -0600	[thread overview]
Message-ID: <m1aciwpvsz.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <43171C02.30402@drzeus.cx> (Pierre Ossman's message of "Thu, 01 Sep 2005 17:19:30 +0200")

Pierre Ossman <drzeus-list@drzeus.cx> writes:

> Eric W. Biederman wrote:
>
>>Hmm.  Looking at that bug report it specifies 2.6.11.  Does this
>>problem really happen in 2.6.13?
>>
>>  
>>
>
> I first noticed it in 2.6.11. It was fixed sometime during 2.6.13-rc
> only to be killed of again in 2.6.13-rc7. The bugzilla now has a patch
> for 2.6.13 which fixes the problem again.

Thanks.

This is clearly a code path I missed when I was fixing things.

When I made the final acpi change I checked for any other users
of device_suspend and it seems I was blind and missed this one.
Looking again...

The patch in the bug report looks correct.  However it is still
a little incomplete.  In particular the reboot notifier is not
being called, and since not everything has been converted into
using shutdown methods that could lead to some other inconsistent
behavior.

Does anyone have any problems with the patch below?
If not I will send this off to Linus..

Eric


---

 include/linux/reboot.h |    1 +
 kernel/power/disk.c    |    7 ++-----
 kernel/sys.c           |   10 ++++++++++
 3 files changed, 13 insertions(+), 5 deletions(-)

6afa3b66c6b3b135442886b80913e80f10ae886d
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -63,6 +63,7 @@ extern void kernel_restart(char *cmd);
 extern void kernel_halt(void);
 extern void kernel_power_off(void);
 extern void kernel_kexec(void);
+extern int kernel_suspend(void);
 
 /*
  * Emergency restart, callable from an interrupt handler.
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -17,12 +17,12 @@
 #include <linux/delay.h>
 #include <linux/fs.h>
 #include <linux/mount.h>
+#include <linux/pm.h>
 
 #include "power.h"
 
 
 extern suspend_disk_method_t pm_disk_mode;
-extern struct pm_ops * pm_ops;
 
 extern int swsusp_suspend(void);
 extern int swsusp_write(void);
@@ -49,14 +49,11 @@ dev_t swsusp_resume_device;
 
 static void power_down(suspend_disk_method_t mode)
 {
-	unsigned long flags;
 	int error = 0;
 
-	local_irq_save(flags);
 	switch(mode) {
 	case PM_DISK_PLATFORM:
- 		device_shutdown();
-		error = pm_ops->enter(PM_SUSPEND_DISK);
+		error = kernel_suspend();
 		break;
 	case PM_DISK_SHUTDOWN:
 		kernel_power_off();
diff --git a/kernel/sys.c b/kernel/sys.c
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -28,6 +28,7 @@
 #include <linux/suspend.h>
 #include <linux/tty.h>
 #include <linux/signal.h>
+#include <linux/pm.h>
 
 #include <linux/compat.h>
 #include <linux/syscalls.h>
@@ -420,6 +421,15 @@ void kernel_power_off(void)
 }
 EXPORT_SYMBOL_GPL(kernel_power_off);
 
+int kernel_suspend(void)
+{
+	notifier_call_chain(&reboot_notifier_list, SYS_POWER_OFF, NULL);
+	system_state = SYSTEM_POWER_OFF;
+	device_shutdown();
+	return pm_ops->enter(PM_SUSPEND_DISK);
+}
+EXPORT_SYMBOL_GPL(kernel_suspend);
+
 /*
  * Reboot system call: for obvious reasons only root may call it,
  * and even root needs to set up some magic numbers in the registers


  reply	other threads:[~2005-09-01 17:01 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-29  0:17 Linux 2.6.13 Linus Torvalds
2005-08-29  0:43 ` Jesper Juhl
2005-08-29  3:05   ` Linus Torvalds
2005-08-29 10:57 ` Steven Rostedt
2005-08-29 12:17   ` Nigel Cunningham
2005-08-29 12:25     ` Jörn Engel
2005-08-29 12:28       ` Nigel Cunningham
2005-08-29 14:25     ` Antonino A. Daplas
2005-08-29 14:42       ` Steven Rostedt
2005-08-29 14:50       ` Linus Torvalds
2005-08-29 15:44         ` [PATCH] convert signal handling of NODEFER to act like other Unix boxes Steven Rostedt
2005-08-29 18:04         ` [PATCH] convert signal handling of NODEFER to act like other Unix boxes. [take2] Steven Rostedt
2005-08-29 12:19 ` Linux 2.6.13 Nigel Cunningham
2005-08-29 14:22   ` Roland Dreier
2005-09-01  6:24     ` reboot vs poweroff (was: Linux 2.6.13) Meelis Roos
2005-09-01  6:48       ` Nigel Cunningham
2005-09-01  7:33         ` Meelis Roos
2005-09-01 12:32           ` Pierre Ossman
2005-09-01 12:48             ` Nigel Cunningham
2005-09-01 15:15               ` Eric W. Biederman
2005-09-01 15:19                 ` reboot vs poweroff Pierre Ossman
2005-09-01 17:00                   ` Eric W. Biederman [this message]
2005-09-01 18:19                     ` Pierre Ossman
2005-09-01 18:23                       ` Eric W. Biederman
2005-09-01 21:11                         ` Nigel Cunningham
2005-09-02  4:46                           ` Eric W. Biederman
2005-09-01 20:22                     ` Pavel Machek
2005-09-02  4:26                       ` Eric W. Biederman
2005-09-01 21:09                 ` reboot vs poweroff (was: Linux 2.6.13) Nigel Cunningham
2005-08-29 18:23 ` Oops in 2.6.13 (was Linux 2.6.13 ) Masoud Sharbiani
2005-08-29 20:13   ` Lee Revell
2005-08-30  3:47     ` Masoud Sharbiani
2005-08-30 22:41 ` Linux 2.6.13 Henrik Persson
2005-09-01  2:29   ` Greg KH
2005-09-03  9:22     ` Henrik Persson
2005-08-31 12:42 ` Alexandre Buisse
2005-09-01 18:23 reboot vs poweroff Brown, Len
2005-09-02  4:43 ` Eric W. Biederman
2005-09-10 21:07 ` Eric W. Biederman
2005-09-11  8:43   ` Meelis Roos
2005-09-11  8:53     ` Eric W. Biederman

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=m1aciwpvsz.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=drzeus-list@drzeus.cx \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mroos@linux.ee \
    --cc=ncunningham@cyclades.com \
    --cc=pavel@ucw.cz \
    /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

Powered by JetHome