]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/s390/kernel/process.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb
[linux-2.6-omap-h63xx.git] / arch / s390 / kernel / process.c
index eb43c3b31269c64fe7da6f04f8a99bc53c82d2b2..29f7884b4ffad57c3f709f714959dc8c52c7f3f1 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/smp.h>
 #include <linux/stddef.h>
 #include <linux/unistd.h>
@@ -43,6 +44,7 @@
 #include <asm/processor.h>
 #include <asm/irq.h>
 #include <asm/timer.h>
+#include <asm/cpu.h>
 
 asmlinkage void ret_from_fork(void) asm ("ret_from_fork");
 
@@ -90,11 +92,20 @@ EXPORT_SYMBOL(unregister_idle_notifier);
 
 void do_monitor_call(struct pt_regs *regs, long interruption_code)
 {
+#ifdef CONFIG_SMP
+       struct s390_idle_data *idle;
+
+       idle = &__get_cpu_var(s390_idle);
+       spin_lock(&idle->lock);
+       idle->idle_time += get_clock() - idle->idle_enter;
+       idle->in_idle = 0;
+       spin_unlock(&idle->lock);
+#endif
        /* disable monitor call class 0 */
        __ctl_clear_bit(8, 15);
 
-       atomic_notifier_call_chain(&idle_chain, CPU_NOT_IDLE,
-                           (void *)(long) smp_processor_id());
+       atomic_notifier_call_chain(&idle_chain, S390_CPU_NOT_IDLE,
+                                  (void *)(long) smp_processor_id());
 }
 
 extern void s390_handle_mcck(void);
@@ -104,6 +115,9 @@ extern void s390_handle_mcck(void);
 static void default_idle(void)
 {
        int cpu, rc;
+#ifdef CONFIG_SMP
+       struct s390_idle_data *idle;
+#endif
 
        /* CPU is going idle. */
        cpu = smp_processor_id();
@@ -115,7 +129,7 @@ static void default_idle(void)
        }
 
        rc = atomic_notifier_call_chain(&idle_chain,
-                       CPU_IDLE, (void *)(long) cpu);
+                                       S390_CPU_IDLE, (void *)(long) cpu);
        if (rc != NOTIFY_OK && rc != NOTIFY_DONE)
                BUG();
        if (rc != NOTIFY_OK) {
@@ -140,7 +154,14 @@ static void default_idle(void)
                s390_handle_mcck();
                return;
        }
-
+#ifdef CONFIG_SMP
+       idle = &__get_cpu_var(s390_idle);
+       spin_lock(&idle->lock);
+       idle->idle_count++;
+       idle->in_idle = 1;
+       idle->idle_enter = get_clock();
+       spin_unlock(&idle->lock);
+#endif
        trace_hardirqs_on();
        /* Wait for external, I/O or machine check interrupt. */
        __load_psw_mask(psw_kernel_bits | PSW_MASK_WAIT |
@@ -165,7 +186,7 @@ void show_regs(struct pt_regs *regs)
 
         printk("CPU:    %d    %s\n", task_thread_info(tsk)->cpu, print_tainted());
         printk("Process %s (pid: %d, task: %p, ksp: %p)\n",
-              current->comm, current->pid, (void *) tsk,
+              current->comm, task_pid_nr(current), (void *) tsk,
               (void *) tsk->thread.ksp);
 
        show_registers(regs);
@@ -253,14 +274,12 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long new_stackp,
        save_fp_regs(&current->thread.fp_regs);
        memcpy(&p->thread.fp_regs, &current->thread.fp_regs,
               sizeof(s390_fp_regs));
-        p->thread.user_seg = __pa((unsigned long) p->mm->pgd) | _SEGMENT_TABLE;
        /* Set a new TLS ?  */
        if (clone_flags & CLONE_SETTLS)
                p->thread.acrs[0] = regs->gprs[6];
 #else /* CONFIG_64BIT */
        /* Save the fpu registers to new thread structure. */
        save_fp_regs(&p->thread.fp_regs);
-        p->thread.user_seg = __pa((unsigned long) p->mm->pgd) | _REGION_TABLE;
        /* Set a new TLS ?  */
        if (clone_flags & CLONE_SETTLS) {
                if (test_thread_flag(TIF_31BIT)) {