patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / arch / ia64 / kernel / process.c
index 0d245cb..7455e48 100644 (file)
@@ -7,6 +7,7 @@
 #define __KERNEL_SYSCALLS__    /* see <asm/unistd.h> */
 #include <linux/config.h>
 
+#include <linux/cpu.h>
 #include <linux/pm.h>
 #include <linux/elf.h>
 #include <linux/errno.h>
@@ -14,6 +15,7 @@
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/module.h>
+#include <linux/notifier.h>
 #include <linux/personality.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/thread_info.h>
 #include <linux/unistd.h>
 #include <linux/efi.h>
+#include <linux/interrupt.h>
 
+#include <asm/cpu.h>
 #include <asm/delay.h>
 #include <asm/elf.h>
 #include <asm/ia32.h>
+#include <asm/irq.h>
 #include <asm/pgalloc.h>
 #include <asm/processor.h>
 #include <asm/sal.h>
+#include <asm/tlbflush.h>
 #include <asm/uaccess.h>
 #include <asm/unwind.h>
 #include <asm/user.h>
@@ -90,6 +96,7 @@ show_regs (struct pt_regs *regs)
 {
        unsigned long ip = regs->cr_iip + ia64_psr(regs)->ri;
 
+       print_modules();
        printk("\nPid: %d, CPU %d, comm: %20s\n", current->pid, smp_processor_id(), current->comm);
        printk("psr : %016lx ifs : %016lx ip  : [<%016lx>]    %s\n",
               regs->cr_ipsr, regs->cr_ifs, ip, print_tainted());
@@ -180,6 +187,40 @@ default_idle (void)
                        safe_halt();
 }
 
+#ifdef CONFIG_HOTPLUG_CPU
+/* We don't actually take CPU down, just spin without interrupts. */
+static inline void play_dead(void)
+{
+       extern void ia64_cpu_local_tick (void);
+       /* Ack it */
+       __get_cpu_var(cpu_state) = CPU_DEAD;
+
+       /* We shouldn't have to disable interrupts while dead, but
+        * some interrupts just don't seem to go away, and this makes
+        * it "work" for testing purposes. */
+       max_xtp();
+       local_irq_disable();
+       /* Death loop */
+       while (__get_cpu_var(cpu_state) != CPU_UP_PREPARE)
+               cpu_relax();
+
+       /*
+        * Enable timer interrupts from now on
+        * Not required if we put processor in SAL_BOOT_RENDEZ mode.
+        */
+       local_flush_tlb_all();
+       cpu_set(smp_processor_id(), cpu_online_map);
+       wmb();
+       ia64_cpu_local_tick ();
+       local_irq_enable();
+}
+#else
+static inline void play_dead(void)
+{
+       BUG();
+}
+#endif /* CONFIG_HOTPLUG_CPU */
+
 void __attribute__((noreturn))
 cpu_idle (void *unused)
 {
@@ -195,7 +236,6 @@ cpu_idle (void *unused)
                if (!need_resched())
                        min_xtp();
 #endif
-
                while (!need_resched()) {
                        if (mark_idle)
                                (*mark_idle)(1);
@@ -210,6 +250,8 @@ cpu_idle (void *unused)
 #endif
                schedule();
                check_pgt_cache();
+               if (cpu_is_offline(smp_processor_id()))
+                       play_dead();
        }
 }
 
@@ -657,11 +699,6 @@ get_wchan (struct task_struct *p)
        struct unw_frame_info info;
        unsigned long ip;
        int count = 0;
-       /*
-        * These bracket the sleeping functions..
-        */
-#      define first_sched      ((unsigned long) scheduling_functions_start_here)
-#      define last_sched       ((unsigned long) scheduling_functions_end_here)
 
        /*
         * Note: p may not be a blocked task (it could be current or
@@ -676,12 +713,10 @@ get_wchan (struct task_struct *p)
                if (unw_unwind(&info) < 0)
                        return 0;
                unw_get_ip(&info, &ip);
-               if (ip < first_sched || ip >= last_sched)
+               if (!in_sched_functions(ip))
                        return ip;
        } while (count++ < 16);
        return 0;
-#      undef first_sched
-#      undef last_sched
 }
 
 void