ia64: convert to dynamic percpu allocator
[safe/jmp/linux-2.6] / arch / ia64 / kernel / process.c
index 58dcfac..9bcec99 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/delay.h>
 #include <linux/kdebug.h>
 #include <linux/utsname.h>
+#include <linux/tracehook.h>
 
 #include <asm/cpu.h>
 #include <asm/delay.h>
@@ -55,6 +56,10 @@ void (*ia64_mark_idle)(int);
 
 unsigned long boot_option_idle_override = 0;
 EXPORT_SYMBOL(boot_option_idle_override);
+unsigned long idle_halt;
+EXPORT_SYMBOL(idle_halt);
+unsigned long idle_nomwait;
+EXPORT_SYMBOL(idle_nomwait);
 
 void
 ia64_do_show_stack (struct unw_frame_info *info, void *arg)
@@ -156,22 +161,21 @@ show_regs (struct pt_regs *regs)
                show_stack(NULL, NULL);
 }
 
-void tsk_clear_notify_resume(struct task_struct *tsk)
+/* local support for deprecated console_print */
+void
+console_print(const char *s)
 {
-#ifdef CONFIG_PERFMON
-       if (tsk->thread.pfm_needs_checking)
-               return;
-#endif
-       if (test_ti_thread_flag(task_thread_info(tsk), TIF_RESTORE_RSE))
-               return;
-       clear_ti_thread_flag(task_thread_info(tsk), TIF_NOTIFY_RESUME);
+       printk(KERN_EMERG "%s", s);
 }
 
 void
-do_notify_resume_user (sigset_t *unused, struct sigscratch *scr, long in_syscall)
+do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall)
 {
        if (fsys_mode(current, &scr->pt)) {
-               /* defer signal-handling etc. until we return to privilege-level 0.  */
+               /*
+                * defer signal-handling etc. until we return to
+                * privilege-level 0.
+                */
                if (!ia64_psr(&scr->pt)->lp)
                        ia64_psr(&scr->pt)->lp = 1;
                return;
@@ -179,16 +183,33 @@ do_notify_resume_user (sigset_t *unused, struct sigscratch *scr, long in_syscall
 
 #ifdef CONFIG_PERFMON
        if (current->thread.pfm_needs_checking)
+               /*
+                * Note: pfm_handle_work() allow us to call it with interrupts
+                * disabled, and may enable interrupts within the function.
+                */
                pfm_handle_work();
 #endif
 
        /* deal with pending signal delivery */
-       if (test_thread_flag(TIF_SIGPENDING))
+       if (test_thread_flag(TIF_SIGPENDING)) {
+               local_irq_enable();     /* force interrupt enable */
                ia64_do_signal(scr, in_syscall);
+       }
+
+       if (test_thread_flag(TIF_NOTIFY_RESUME)) {
+               clear_thread_flag(TIF_NOTIFY_RESUME);
+               tracehook_notify_resume(&scr->pt);
+               if (current->replacement_session_keyring)
+                       key_replace_session_keyring();
+       }
 
        /* copy user rbs to kernel rbs */
-       if (unlikely(test_thread_flag(TIF_RESTORE_RSE)))
+       if (unlikely(test_thread_flag(TIF_RESTORE_RSE))) {
+               local_irq_enable();     /* force interrupt enable */
                ia64_sync_krbs();
+       }
+
+       local_irq_disable();    /* force interrupt disable */
 }
 
 static int pal_halt        = 1;
@@ -230,7 +251,6 @@ default_idle (void)
 /* We don't actually take CPU down, just spin without interrupts. */
 static inline void play_dead(void)
 {
-       extern void ia64_cpu_local_tick (void);
        unsigned int this_cpu = smp_processor_id();
 
        /* Ack it */
@@ -269,7 +289,7 @@ void cpu_idle_wait(void)
 {
        smp_mb();
        /* kick all the CPUs so that they exit out of pm_idle */
-       smp_call_function(do_nothing, NULL, 0, 1);
+       smp_call_function(do_nothing, NULL, 1);
 }
 EXPORT_SYMBOL_GPL(cpu_idle_wait);
 
@@ -402,7 +422,7 @@ ia64_load_extra (struct task_struct *task)
  * so there is nothing to worry about.
  */
 int
-copy_thread (int nr, unsigned long clone_flags,
+copy_thread(unsigned long clone_flags,
             unsigned long user_stack_base, unsigned long user_stack_size,
             struct task_struct *p, struct pt_regs *regs)
 {