[patch] perform reboot notification in process context

From: Andrew Morton (andrewm@uow.edu.au)
Date: Sun Mar 04 2001 - 06:13:40 EST


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);
 }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Mar 07 2001 - 21:00:15 EST