linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] perform reboot notification in process context
@ 2001-03-04 11:13 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2001-03-04 11:13 UTC (permalink / raw)
  To: Alan Cox, Linus Torvalds; +Cc: lkml

ctrl_alt_del() is called from hard interrupt context.
It traverses the reboot_notifier_list.  Many of the
callouts on that list are not designed to be called
in this context.

DAC960_Finalise()
        Calls remove_proc_entry() within interrupt context.
        remove_proc_entry uses spin_lock()s.
	Can deadlock.

drivers/char/sbc60xxwdt.c:sbc60xxwdt_unload()
        Calls misc_deregister which calls down().

drivers/i2o/i2o_core.c
        calls i2o_post_wait()
        calls i2o_reset_controller()

        Both of these schedule().  Crashes every time.

drivers/scsi/gdth.c
        gdth_halt()
        calls gdth_do_cmd
                does down().


This patch makes keventd do the callout.


--- linux-2.4.3-pre1/kernel/sys.c	Tue Oct 17 06:58:51 2000
+++ linux-akpm/kernel/sys.c	Sun Mar  4 22:04:57 2001
@@ -330,6 +330,12 @@
 	return 0;
 }
 
+static void deferred_cad(void *dummy)
+{
+	notifier_call_chain(&reboot_notifier_list, SYS_RESTART, NULL);
+	machine_restart(NULL);
+}
+
 /*
  * This function gets called by ctrl-alt-del - ie the keyboard interrupt.
  * As it's called within an interrupt, it may NOT sync: the only choice
@@ -337,10 +343,13 @@
  */
 void ctrl_alt_del(void)
 {
-	if (C_A_D) {
-		notifier_call_chain(&reboot_notifier_list, SYS_RESTART, NULL);
-		machine_restart(NULL);
-	} else
+	static struct tq_struct cad_tq = {
+		routine: deferred_cad,
+	};
+
+	if (C_A_D)
+		schedule_task(&cad_tq);
+	else
 		kill_proc(1, SIGINT, 1);
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-03-04 11:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-04 11:13 [patch] perform reboot notification in process context Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).