mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Len Brown <len.brown@intel.com>
Cc: gluk@php4.ru, linux-kernel@vger.kernel.org, rathamahata@php4.ru
Subject: Re: 2.6.3 Oops when power-off via sys-rq
Date: Thu, 26 Feb 2004 17:14:37 -0800	[thread overview]
Message-ID: <20040226171437.031226d0.akpm@osdl.org> (raw)
In-Reply-To: <1077836027.22401.85.camel@dhcppc4>

Len Brown <len.brown@intel.com> wrote:
>
> Alexander,
> Please file an bug at bugzilla.kernel.org
> category: power management
> component: ACPI

We'll need this fix (at least).  But I haven't tested it yet.





sysrq-o is supposed to power off the machine.  But if it calls into ACPI (at
least) it does lots of sleepy things, so we best not do this from interrupt
context.


---

 kernel/power/poweroff.c |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff -puN kernel/power/poweroff.c~poweroff-atomicity-fix kernel/power/poweroff.c
--- 25/kernel/power/poweroff.c~poweroff-atomicity-fix	2004-02-26 05:13:59.000000000 -0800
+++ 25-akpm/kernel/power/poweroff.c	2004-02-26 05:18:31.000000000 -0800
@@ -8,33 +8,33 @@
 #include <linux/sysrq.h>
 #include <linux/init.h>
 #include <linux/pm.h>
+#include <linux/workqueue.h>
 
-
-/**
- * handle_poweroff	-	sysrq callback for power down
- * @key: key pressed (unused)
- * @pt_regs: register state (unused)
- * @kbd: keyboard state (unused)
- * @tty: tty involved (unused)
- *
+/*
  * When the user hits Sys-Rq o to power down the machine this is the
  * callback we use.
  */
 
-static void handle_poweroff (int key, struct pt_regs *pt_regs,
-			     struct tty_struct *tty)
+static void do_poweroff(void *dummy)
 {
 	if (pm_power_off)
 		pm_power_off();
 }
 
+static DECLARE_WORK(poweroff_work, do_poweroff, 0);
+
+static void handle_poweroff(int key, struct pt_regs *pt_regs,
+				struct tty_struct *tty)
+{
+	schedule_work(&poweroff_work);
+}
+
 static struct sysrq_key_op	sysrq_poweroff_op = {
 	.handler        = handle_poweroff,
 	.help_msg       = "powerOff",
 	.action_msg     = "Power Off\n"
 };
 
-
 static int pm_sysrq_init(void)
 {
 	register_sysrq_key('o', &sysrq_poweroff_op);

_


  reply	other threads:[~2004-02-27  1:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <A6974D8E5F98D511BB910002A50A6647615F3396@hdsmsx402.hd.intel.com>
2004-02-26 22:53 ` Len Brown
2004-02-27  1:14   ` Andrew Morton [this message]
2004-02-27 13:36     ` Alexander Y. Fomichev
2004-02-26 12:52 Alexander Y. Fomichev

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=20040226171437.031226d0.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=gluk@php4.ru \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rathamahata@php4.ru \
    /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

all inboxes | Powered by JetHome®