Pull cpuidle into release branch
[pandora-kernel.git] / arch / ia64 / kernel / crash.c
index aeb79fb..f1cf2df 100644 (file)
@@ -118,11 +118,6 @@ machine_crash_shutdown(struct pt_regs *pt)
 static void
 machine_kdump_on_init(void)
 {
-       if (!ia64_kimage) {
-               printk(KERN_NOTICE "machine_kdump_on_init(): "
-                               "kdump not configured\n");
-               return;
-       }
        local_irq_disable();
        kexec_disable_iosapic();
        machine_kexec(ia64_kimage);
@@ -156,24 +151,38 @@ kdump_init_notifier(struct notifier_block *self, unsigned long val, void *data)
        if (!kdump_on_init)
                return NOTIFY_DONE;
 
-       if (val != DIE_INIT_MONARCH_ENTER &&
-           val != DIE_INIT_SLAVE_ENTER &&
+       if (!ia64_kimage) {
+               if (val == DIE_INIT_MONARCH_LEAVE)
+                       ia64_mca_printk(KERN_NOTICE
+                                       "%s: kdump not configured\n",
+                                       __FUNCTION__);
+               return NOTIFY_DONE;
+       }
+
+       if (val != DIE_INIT_MONARCH_LEAVE &&
+           val != DIE_INIT_SLAVE_LEAVE &&
+           val != DIE_INIT_MONARCH_PROCESS &&
            val != DIE_MCA_RENDZVOUS_LEAVE &&
            val != DIE_MCA_MONARCH_LEAVE)
                return NOTIFY_DONE;
 
        nd = (struct ia64_mca_notify_die *)args->err;
-       /* Reason code 1 means machine check rendezous*/
-       if ((val == DIE_INIT_MONARCH_ENTER || val == DIE_INIT_SLAVE_ENTER) &&
-                nd->sos->rv_rc == 1)
+       /* Reason code 1 means machine check rendezvous*/
+       if ((val == DIE_INIT_MONARCH_LEAVE || val == DIE_INIT_SLAVE_LEAVE
+           || val == DIE_INIT_MONARCH_PROCESS) && nd->sos->rv_rc == 1)
                return NOTIFY_DONE;
 
        switch (val) {
-               case DIE_INIT_MONARCH_ENTER:
+               case DIE_INIT_MONARCH_PROCESS:
+                       atomic_set(&kdump_in_progress, 1);
+                       *(nd->monarch_cpu) = -1;
+                       break;
+               case DIE_INIT_MONARCH_LEAVE:
                        machine_kdump_on_init();
                        break;
-               case DIE_INIT_SLAVE_ENTER:
-                       unw_init_running(kdump_cpu_freeze, NULL);
+               case DIE_INIT_SLAVE_LEAVE:
+                       if (atomic_read(&kdump_in_progress))
+                               unw_init_running(kdump_cpu_freeze, NULL);
                        break;
                case DIE_MCA_RENDZVOUS_LEAVE:
                        if (atomic_read(&kdump_in_progress))
@@ -215,8 +224,10 @@ static ctl_table sys_table[] = {
 static int
 machine_crash_setup(void)
 {
+       /* be notified before default_monarch_init_process */
        static struct notifier_block kdump_init_notifier_nb = {
                .notifier_call = kdump_init_notifier,
+               .priority = 1,
        };
        int ret;
        if((ret = register_die_notifier(&kdump_init_notifier_nb)) != 0)