diff options
Diffstat (limited to 'arch/x86/kernel/process.c')
-rw-r--r-- | arch/x86/kernel/process.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 6afa5232dbb7..ca989158e847 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -8,7 +8,7 @@ | |||
8 | #include <linux/module.h> | 8 | #include <linux/module.h> |
9 | #include <linux/pm.h> | 9 | #include <linux/pm.h> |
10 | #include <linux/clockchips.h> | 10 | #include <linux/clockchips.h> |
11 | #include <linux/ftrace.h> | 11 | #include <trace/power.h> |
12 | #include <asm/system.h> | 12 | #include <asm/system.h> |
13 | #include <asm/apic.h> | 13 | #include <asm/apic.h> |
14 | #include <asm/idle.h> | 14 | #include <asm/idle.h> |
@@ -22,6 +22,9 @@ EXPORT_SYMBOL(idle_nomwait); | |||
22 | 22 | ||
23 | struct kmem_cache *task_xstate_cachep; | 23 | struct kmem_cache *task_xstate_cachep; |
24 | 24 | ||
25 | DEFINE_TRACE(power_start); | ||
26 | DEFINE_TRACE(power_end); | ||
27 | |||
25 | int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) | 28 | int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) |
26 | { | 29 | { |
27 | *dst = *src; | 30 | *dst = *src; |
@@ -65,11 +68,11 @@ void exit_thread(void) | |||
65 | { | 68 | { |
66 | struct task_struct *me = current; | 69 | struct task_struct *me = current; |
67 | struct thread_struct *t = &me->thread; | 70 | struct thread_struct *t = &me->thread; |
71 | unsigned long *bp = t->io_bitmap_ptr; | ||
68 | 72 | ||
69 | if (me->thread.io_bitmap_ptr) { | 73 | if (bp) { |
70 | struct tss_struct *tss = &per_cpu(init_tss, get_cpu()); | 74 | struct tss_struct *tss = &per_cpu(init_tss, get_cpu()); |
71 | 75 | ||
72 | kfree(t->io_bitmap_ptr); | ||
73 | t->io_bitmap_ptr = NULL; | 76 | t->io_bitmap_ptr = NULL; |
74 | clear_thread_flag(TIF_IO_BITMAP); | 77 | clear_thread_flag(TIF_IO_BITMAP); |
75 | /* | 78 | /* |
@@ -78,6 +81,7 @@ void exit_thread(void) | |||
78 | memset(tss->io_bitmap, 0xff, t->io_bitmap_max); | 81 | memset(tss->io_bitmap, 0xff, t->io_bitmap_max); |
79 | t->io_bitmap_max = 0; | 82 | t->io_bitmap_max = 0; |
80 | put_cpu(); | 83 | put_cpu(); |
84 | kfree(bp); | ||
81 | } | 85 | } |
82 | 86 | ||
83 | ds_exit_thread(current); | 87 | ds_exit_thread(current); |
@@ -324,7 +328,7 @@ void stop_this_cpu(void *dummy) | |||
324 | /* | 328 | /* |
325 | * Remove this CPU: | 329 | * Remove this CPU: |
326 | */ | 330 | */ |
327 | cpu_clear(smp_processor_id(), cpu_online_map); | 331 | set_cpu_online(smp_processor_id(), false); |
328 | disable_local_APIC(); | 332 | disable_local_APIC(); |
329 | 333 | ||
330 | for (;;) { | 334 | for (;;) { |
@@ -474,12 +478,13 @@ static int __cpuinit check_c1e_idle(const struct cpuinfo_x86 *c) | |||
474 | return 1; | 478 | return 1; |
475 | } | 479 | } |
476 | 480 | ||
477 | static cpumask_t c1e_mask = CPU_MASK_NONE; | 481 | static cpumask_var_t c1e_mask; |
478 | static int c1e_detected; | 482 | static int c1e_detected; |
479 | 483 | ||
480 | void c1e_remove_cpu(int cpu) | 484 | void c1e_remove_cpu(int cpu) |
481 | { | 485 | { |
482 | cpu_clear(cpu, c1e_mask); | 486 | if (c1e_mask != NULL) |
487 | cpumask_clear_cpu(cpu, c1e_mask); | ||
483 | } | 488 | } |
484 | 489 | ||
485 | /* | 490 | /* |
@@ -508,8 +513,8 @@ static void c1e_idle(void) | |||
508 | if (c1e_detected) { | 513 | if (c1e_detected) { |
509 | int cpu = smp_processor_id(); | 514 | int cpu = smp_processor_id(); |
510 | 515 | ||
511 | if (!cpu_isset(cpu, c1e_mask)) { | 516 | if (!cpumask_test_cpu(cpu, c1e_mask)) { |
512 | cpu_set(cpu, c1e_mask); | 517 | cpumask_set_cpu(cpu, c1e_mask); |
513 | /* | 518 | /* |
514 | * Force broadcast so ACPI can not interfere. Needs | 519 | * Force broadcast so ACPI can not interfere. Needs |
515 | * to run with interrupts enabled as it uses | 520 | * to run with interrupts enabled as it uses |
@@ -561,6 +566,15 @@ void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) | |||
561 | pm_idle = default_idle; | 566 | pm_idle = default_idle; |
562 | } | 567 | } |
563 | 568 | ||
569 | void __init init_c1e_mask(void) | ||
570 | { | ||
571 | /* If we're using c1e_idle, we need to allocate c1e_mask. */ | ||
572 | if (pm_idle == c1e_idle) { | ||
573 | alloc_cpumask_var(&c1e_mask, GFP_KERNEL); | ||
574 | cpumask_clear(c1e_mask); | ||
575 | } | ||
576 | } | ||
577 | |||
564 | static int __init idle_setup(char *str) | 578 | static int __init idle_setup(char *str) |
565 | { | 579 | { |
566 | if (!str) | 580 | if (!str) |