X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fia64%2Fkernel%2Fprocess.c;h=355d57970ba31cf3368aa61e5c32c92b81a85029;hb=cc169158e75d370ff961e5653a326a7ee1688b6b;hp=00de4e4b596ed08b0e9ba016f5b2413407ffb420;hpb=207e0a826fdee4bfe853681aef2175a739c11286;p=linux-2.6.git diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c index 00de4e4b5..355d57970 100644 --- a/arch/ia64/kernel/process.c +++ b/arch/ia64/kernel/process.c @@ -4,6 +4,9 @@ * Copyright (C) 1998-2003 Hewlett-Packard Co * David Mosberger-Tang * 04/11/17 Ashok Raj Added CPU Hotplug Support + * + * 2005-10-07 Keith Owens + * Add notify_die() hooks. */ #define __KERNEL_SYSCALLS__ /* see */ #include @@ -33,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -40,7 +44,6 @@ #include #include #include -#include #include "entry.h" @@ -154,8 +157,6 @@ show_regs (struct pt_regs *regs) show_stack(NULL, NULL); } -EXPORT_SYMBOL_GPL(show_regs); - void do_notify_resume_user (sigset_t *oldset, struct sigscratch *scr, long in_syscall) { @@ -181,7 +182,7 @@ static int can_do_pal_halt = 1; static int __init nohalt_setup(char * str) { - pal_halt = 0; + pal_halt = can_do_pal_halt = 0; return 1; } __setup("nohalt", nohalt_setup); @@ -198,11 +199,13 @@ update_pal_halt_status(int status) void default_idle (void) { - while (!need_resched()) + local_irq_enable(); + while (!need_resched()) { if (can_do_pal_halt) safe_halt(); else cpu_relax(); + } } #ifdef CONFIG_HOTPLUG_CPU @@ -264,16 +267,20 @@ void __attribute__((noreturn)) cpu_idle (void) { void (*mark_idle)(int) = ia64_mark_idle; + int cpu = smp_processor_id(); /* endless idle loop with no priority at all */ while (1) { + if (can_do_pal_halt) + clear_thread_flag(TIF_POLLING_NRFLAG); + else + set_thread_flag(TIF_POLLING_NRFLAG); + + if (!need_resched()) { + void (*idle)(void); #ifdef CONFIG_SMP - if (!need_resched()) min_xtp(); #endif - while (!need_resched()) { - void (*idle)(void); - if (__get_cpu_var(cpu_idle_state)) __get_cpu_var(cpu_idle_state) = 0; @@ -285,17 +292,17 @@ cpu_idle (void) if (!idle) idle = default_idle; (*idle)(); - } - - if (mark_idle) - (*mark_idle)(0); - + if (mark_idle) + (*mark_idle)(0); #ifdef CONFIG_SMP - normal_xtp(); + normal_xtp(); #endif + } + preempt_enable_no_resched(); schedule(); + preempt_disable(); check_pgt_cache(); - if (cpu_is_offline(smp_processor_id())) + if (cpu_is_offline(cpu)) play_dead(); } } @@ -320,7 +327,7 @@ ia64_save_extra (struct task_struct *task) #endif #ifdef CONFIG_IA32_SUPPORT - if (IS_IA32_PROCESS(ia64_task_regs(task))) + if (IS_IA32_PROCESS(task_pt_regs(task))) ia32_save_state(task); #endif } @@ -345,7 +352,7 @@ ia64_load_extra (struct task_struct *task) #endif #ifdef CONFIG_IA32_SUPPORT - if (IS_IA32_PROCESS(ia64_task_regs(task))) + if (IS_IA32_PROCESS(task_pt_regs(task))) ia32_load_state(task); #endif } @@ -480,7 +487,7 @@ copy_thread (int nr, unsigned long clone_flags, * If we're cloning an IA32 task then save the IA32 extra * state from the current task to the new task */ - if (IS_IA32_PROCESS(ia64_task_regs(current))) { + if (IS_IA32_PROCESS(task_pt_regs(current))) { ia32_save_state(p); if (clone_flags & CLONE_SETTLS) retval = ia32_clone_tls(p, child_ptregs); @@ -592,13 +599,11 @@ do_dump_task_fpu (struct task_struct *task, struct unw_frame_info *info, void *a } void -ia64_do_copy_regs (struct unw_frame_info *info, void *arg) +do_copy_regs (struct unw_frame_info *info, void *arg) { do_copy_task_regs(current, info, arg); } -EXPORT_SYMBOL_GPL(ia64_do_copy_regs); - void do_dump_fpu (struct unw_frame_info *info, void *arg) { @@ -611,7 +616,7 @@ dump_task_regs(struct task_struct *task, elf_gregset_t *regs) struct unw_frame_info tcore_info; if (current == task) { - unw_init_running(ia64_do_copy_regs, regs); + unw_init_running(do_copy_regs, regs); } else { memset(&tcore_info, 0, sizeof(tcore_info)); unw_init_from_blocked_task(&tcore_info, task); @@ -623,7 +628,7 @@ dump_task_regs(struct task_struct *task, elf_gregset_t *regs) void ia64_elf_core_copy_regs (struct pt_regs *pt, elf_gregset_t dst) { - unw_init_running(ia64_do_copy_regs, dst); + unw_init_running(do_copy_regs, dst); } int @@ -695,7 +700,7 @@ int kernel_thread_helper (int (*fn)(void *), void *arg) { #ifdef CONFIG_IA32_SUPPORT - if (IS_IA32_PROCESS(ia64_task_regs(current))) { + if (IS_IA32_PROCESS(task_pt_regs(current))) { /* A kernel thread is always a 64-bit process. */ current->thread.map_base = DEFAULT_MAP_BASE; current->thread.task_size = DEFAULT_TASK_SIZE; @@ -715,8 +720,13 @@ flush_thread (void) /* drop floating-point and debug-register state if it exists: */ current->thread.flags &= ~(IA64_THREAD_FPH_VALID | IA64_THREAD_DBG_VALID); ia64_drop_fpu(current); - if (IS_IA32_PROCESS(ia64_task_regs(current))) +#ifdef CONFIG_IA32_SUPPORT + if (IS_IA32_PROCESS(task_pt_regs(current))) { ia32_drop_partial_page_list(current); + current->thread.task_size = IA32_PAGE_OFFSET; + set_fs(USER_DS); + } +#endif } /* @@ -726,6 +736,7 @@ flush_thread (void) void exit_thread (void) { + ia64_drop_fpu(current); #ifdef CONFIG_PERFMON /* if needed, stop monitoring and flush state to perfmon context */ @@ -736,7 +747,7 @@ exit_thread (void) if (current->thread.flags & IA64_THREAD_DBG_VALID) pfm_release_debug_registers(current); #endif - if (IS_IA32_PROCESS(ia64_task_regs(current))) + if (IS_IA32_PROCESS(task_pt_regs(current))) ia32_drop_partial_page_list(current); } @@ -792,19 +803,17 @@ cpu_halt (void) void machine_restart (char *restart_cmd) { + (void) notify_die(DIE_MACHINE_RESTART, restart_cmd, NULL, 0, 0, 0); (*efi.reset_system)(EFI_RESET_WARM, 0, 0, NULL); } -EXPORT_SYMBOL(machine_restart); - void machine_halt (void) { + (void) notify_die(DIE_MACHINE_HALT, "", NULL, 0, 0, 0); cpu_halt(); } -EXPORT_SYMBOL(machine_halt); - void machine_power_off (void) { @@ -813,23 +822,3 @@ machine_power_off (void) machine_halt(); } -EXPORT_SYMBOL(machine_power_off); - -void -ia64_freeze_cpu (struct unw_frame_info *info, void *arg) -{ - current->thread.ksp = (__u64)(info->sw) - 16; - for (;;) local_irq_disable(); -} - -EXPORT_SYMBOL_GPL(ia64_freeze_cpu); - -void -ia64_start_dump (struct unw_frame_info *info, void *arg) -{ - struct dump_call_param *param = arg; - - param->func(param->regs, info); -} - -EXPORT_SYMBOL_GPL(ia64_start_dump);