1 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
3 #include <linux/errno.h>
4 #include <linux/kernel.h>
8 #include <linux/slab.h>
9 #include <linux/sched.h>
10 #include <linux/module.h>
13 #include <linux/random.h>
16 #include <linux/utsname.h>
21 #include <linux/hw_breakpoint.h>
24 #include <asm/syscalls.h>
26 #include <asm/uaccess.h>
70 if (fpu_allocated(&src->
thread.fpu)) {
72 ret = fpu_alloc(&dst->
thread.fpu);
82 fpu_free(&tsk->
thread.fpu);
159 if (!use_eager_fpu())
163 static void hard_disable_TSC(
void)
171 if (!test_and_set_thread_flag(
TIF_NOTSC))
180 static void hard_enable_TSC(
void)
185 static void enable_TSC(
void)
188 if (test_and_clear_thread_flag(
TIF_NOTSC))
231 unsigned long debugctl = get_debugctlmsr();
237 update_debugctlmsr(debugctl);
240 if (test_tsk_thread_flag(prev_p,
TIF_NOTSC) ^
241 test_tsk_thread_flag(next_p,
TIF_NOTSC)) {
243 if (test_tsk_thread_flag(next_p,
TIF_NOTSC))
262 propagate_user_return_notify(prev_p, next_p);
287 sys_clone(
unsigned long clone_flags,
unsigned long newsp,
288 void __user *parent_tid,
void __user *child_tid,
struct pt_regs *
regs)
292 return do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid);
305 #ifdef CONFIG_APM_MODULE
309 static inline int hlt_use_halt(
void)
315 static inline void play_dead(
void)
322 void enter_idle(
void)
328 static void __exit_idle(
void)
360 boot_init_stack_canary();
364 tick_nohz_idle_enter();
366 while (!need_resched()) {
400 tick_nohz_idle_exit();
413 if (hlt_use_halt()) {
436 #ifdef CONFIG_APM_MODULE
464 static void mwait_idle(
void)
466 if (!need_resched()) {
489 static void poll_idle(
void)
494 while (!need_resched())
513 #define MWAIT_INFO 0x05
514 #define MWAIT_ECX_EXTENDED_INFO 0x01
515 #define MWAIT_EDX_C1 0xf0
554 if (amd_e400_c1e_mask !=
NULL)
555 cpumask_clear_cpu(cpu, amd_e400_c1e_mask);
563 static void amd_e400_idle(
void)
568 if (!amd_e400_c1e_detected) {
574 amd_e400_c1e_detected =
true;
577 pr_info(
"System has AMD C1E enabled\n");
581 if (amd_e400_c1e_detected) {
585 cpumask_set_cpu(cpu, amd_e400_c1e_mask);
591 pr_info(
"Switch to broadcast mode on CPU%d\n", cpu);
612 pr_warn_once(
"WARNING: polling idle and HT enabled, performance may degrade\n");
622 pr_info(
"using mwait in idle threads\n");
626 pr_info(
"using AMD E400 aware idle routine\n");
636 zalloc_cpumask_var(&amd_e400_c1e_mask,
GFP_KERNEL);
644 if (!
strcmp(str,
"poll")) {
645 pr_info(
"using polling idle threads\n");
648 }
else if (!
strcmp(str,
"mwait")) {
650 WARN_ONCE(1,
"\"idle=mwait\" will be removed in 2012\n");
651 }
else if (!
strcmp(str,
"halt")) {
661 }
else if (!
strcmp(str,
"nomwait")) {
685 unsigned long range_end = mm->
brk + 0x02000000;