amd-iommu: add function to flush tlb for all domains
[safe/jmp/linux-2.6] / arch / x86 / kernel / process.c
index 6638294..ca98915 100644 (file)
@@ -8,7 +8,7 @@
 #include <linux/module.h>
 #include <linux/pm.h>
 #include <linux/clockchips.h>
-#include <linux/ftrace.h>
+#include <trace/power.h>
 #include <asm/system.h>
 #include <asm/apic.h>
 #include <asm/idle.h>
@@ -22,6 +22,9 @@ EXPORT_SYMBOL(idle_nomwait);
 
 struct kmem_cache *task_xstate_cachep;
 
+DEFINE_TRACE(power_start);
+DEFINE_TRACE(power_end);
+
 int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
 {
        *dst = *src;
@@ -65,11 +68,11 @@ void exit_thread(void)
 {
        struct task_struct *me = current;
        struct thread_struct *t = &me->thread;
+       unsigned long *bp = t->io_bitmap_ptr;
 
-       if (me->thread.io_bitmap_ptr) {
+       if (bp) {
                struct tss_struct *tss = &per_cpu(init_tss, get_cpu());
 
-               kfree(t->io_bitmap_ptr);
                t->io_bitmap_ptr = NULL;
                clear_thread_flag(TIF_IO_BITMAP);
                /*
@@ -78,6 +81,7 @@ void exit_thread(void)
                memset(tss->io_bitmap, 0xff, t->io_bitmap_max);
                t->io_bitmap_max = 0;
                put_cpu();
+               kfree(bp);
        }
 
        ds_exit_thread(current);
@@ -479,7 +483,8 @@ static int c1e_detected;
 
 void c1e_remove_cpu(int cpu)
 {
-       cpumask_clear_cpu(cpu, c1e_mask);
+       if (c1e_mask != NULL)
+               cpumask_clear_cpu(cpu, c1e_mask);
 }
 
 /*
@@ -556,13 +561,20 @@ void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
                pm_idle = mwait_idle;
        } else if (check_c1e_idle(c)) {
                printk(KERN_INFO "using C1E aware idle routine\n");
-               alloc_cpumask_var(&c1e_mask, GFP_KERNEL);
-               cpumask_clear(c1e_mask);
                pm_idle = c1e_idle;
        } else
                pm_idle = default_idle;
 }
 
+void __init init_c1e_mask(void)
+{
+       /* If we're using c1e_idle, we need to allocate c1e_mask. */
+       if (pm_idle == c1e_idle) {
+               alloc_cpumask_var(&c1e_mask, GFP_KERNEL);
+               cpumask_clear(c1e_mask);
+       }
+}
+
 static int __init idle_setup(char *str)
 {
        if (!str)