X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=arch%2Fs390%2Fkernel%2Fprocess.c;h=ce203154d8ce3a6c8f9bf4a07cd7ad072e3b3ec8;hb=c489f4451965f4d355340ea1e60a5863c9ed2890;hp=441975b796fb03d901cef8a63dc3414a3a2b508c;hpb=dce554708cdb02a1053ca3a68997b9facbfde5ce;p=safe%2Fjmp%2Flinux-2.6 diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c index 441975b..ce20315 100644 --- a/arch/s390/kernel/process.c +++ b/arch/s390/kernel/process.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -28,14 +29,13 @@ #include #include #include -#include #include #include #include #include #include #include - +#include #include #include #include @@ -43,6 +43,7 @@ #include #include #include +#include asmlinkage void ret_from_fork(void) asm ("ret_from_fork"); @@ -90,6 +91,15 @@ 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); @@ -104,21 +114,27 @@ extern void s390_handle_mcck(void); static void default_idle(void) { int cpu, rc; + int nr_calls = 0; + void *hcpu; +#ifdef CONFIG_SMP + struct s390_idle_data *idle; +#endif /* CPU is going idle. */ cpu = smp_processor_id(); - + hcpu = (void *)(long)cpu; local_irq_disable(); if (need_resched()) { local_irq_enable(); return; } - rc = atomic_notifier_call_chain(&idle_chain, - S390_CPU_IDLE, (void *)(long) cpu); - if (rc != NOTIFY_OK && rc != NOTIFY_DONE) - BUG(); - if (rc != NOTIFY_OK) { + rc = __atomic_notifier_call_chain(&idle_chain, S390_CPU_IDLE, hcpu, -1, + &nr_calls); + if (rc == NOTIFY_BAD) { + nr_calls--; + __atomic_notifier_call_chain(&idle_chain, S390_CPU_NOT_IDLE, + hcpu, nr_calls, NULL); local_irq_enable(); return; } @@ -136,11 +152,22 @@ static void default_idle(void) local_mcck_disable(); if (test_thread_flag(TIF_MCCK_PENDING)) { local_mcck_enable(); + /* disable monitor call class 0 */ + __ctl_clear_bit(8, 15); + atomic_notifier_call_chain(&idle_chain, S390_CPU_NOT_IDLE, + hcpu); local_irq_enable(); 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 | @@ -161,13 +188,15 @@ void cpu_idle(void) void show_regs(struct pt_regs *regs) { - struct task_struct *tsk = current; - - 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, - (void *) tsk->thread.ksp); - + print_modules(); + printk("CPU: %d %s %s %.*s\n", + task_thread_info(current)->cpu, print_tainted(), + init_utsname()->release, + (int)strcspn(init_utsname()->version, " "), + init_utsname()->version); + printk("Process %s (pid: %d, task: %p, ksp: %p)\n", + current->comm, current->pid, current, + (void *) current->thread.ksp); show_registers(regs); /* Show stack backtrace if pt_regs is from kernel mode */ if (!(regs->psw.mask & PSW_MASK_PSTATE)) @@ -253,14 +282,12 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long new_stackp, save_fp_regs(¤t->thread.fp_regs); memcpy(&p->thread.fp_regs, ¤t->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)) {