Merge tag 'v3.16' into p/abusse/merge_upgrade
[projects/modsched/linux.git] / kernel / cpu.c
index e175737..4037f7c 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/gfp.h>
 #include <linux/suspend.h>
 #include <linux/lockdep.h>
+#include <trace/events/power.h>
 
 #ifdef CONFIG_MOD_SCHED
     #include <fw_comm.h>
@@ -287,8 +288,7 @@ static inline void check_for_tasks(int cpu)
                task_cputime(p, &utime, &stime);
                if (task_cpu(p) == cpu && p->state == TASK_RUNNING &&
                    (utime || stime))
-                       printk(KERN_WARNING "Task %s (pid = %d) is on cpu %d "
-                               "(state = %ld, flags = %x)\n",
+                       pr_warn("Task %s (pid = %d) is on cpu %d (state = %ld, flags = %x)\n",
                                p->comm, task_pid_nr(p), cpu,
                                p->state, p->flags);
        }
@@ -340,8 +340,8 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
        if (err) {
                nr_calls--;
                __cpu_notify(CPU_DOWN_FAILED | mod, hcpu, nr_calls, NULL);
-               printk("%s: attempt to take down CPU %u failed\n",
-                               __func__, cpu);
+               pr_warn("%s: attempt to take down CPU %u failed\n",
+                       __func__, cpu);
                goto out_release;
        }
 
@@ -448,8 +448,8 @@ static int _cpu_up(unsigned int cpu, int tasks_frozen)
        ret = __cpu_notify(CPU_UP_PREPARE | mod, hcpu, -1, &nr_calls);
        if (ret) {
                nr_calls--;
-               printk(KERN_WARNING "%s: attempt to bring up CPU %u failed\n",
-                               __func__, cpu);
+               pr_warn("%s: attempt to bring up CPU %u failed\n",
+                       __func__, cpu);
                goto out_notify;
        }
 
@@ -479,11 +479,10 @@ int cpu_up(unsigned int cpu)
        int err = 0;
 
        if (!cpu_possible(cpu)) {
-               printk(KERN_ERR "can't online cpu %d because it is not "
-                       "configured as may-hotadd at boot time\n", cpu);
+               pr_err("can't online cpu %d because it is not configured as may-hotadd at boot time\n",
+                      cpu);
 #if defined(CONFIG_IA64)
-               printk(KERN_ERR "please check additional_cpus= boot "
-                               "parameter\n");
+               pr_err("please check additional_cpus= boot parameter\n");
 #endif
                return -EINVAL;
        }
@@ -527,16 +526,17 @@ int disable_nonboot_cpus(void)
         */
        cpumask_clear(frozen_cpus);
 
-       printk("Disabling non-boot CPUs ...\n");
+       pr_info("Disabling non-boot CPUs ...\n");
        for_each_online_cpu(cpu) {
                if (cpu == first_cpu)
                        continue;
+               trace_suspend_resume(TPS("CPU_OFF"), cpu, true);
                error = _cpu_down(cpu, 1);
+               trace_suspend_resume(TPS("CPU_OFF"), cpu, false);
                if (!error)
                        cpumask_set_cpu(cpu, frozen_cpus);
                else {
-                       printk(KERN_ERR "Error taking CPU%d down: %d\n",
-                               cpu, error);
+                       pr_err("Error taking CPU%d down: %d\n", cpu, error);
                        break;
                }
        }
@@ -546,7 +546,7 @@ int disable_nonboot_cpus(void)
                /* Make sure the CPUs won't be enabled by someone else */
                cpu_hotplug_disabled = 1;
        } else {
-               printk(KERN_ERR "Non-boot CPUs are not disabled\n");
+               pr_err("Non-boot CPUs are not disabled\n");
        }
        cpu_maps_update_done();
        return error;
@@ -570,17 +570,19 @@ void __ref enable_nonboot_cpus(void)
        if (cpumask_empty(frozen_cpus))
                goto out;
 
-       printk(KERN_INFO "Enabling non-boot CPUs ...\n");
+       pr_info("Enabling non-boot CPUs ...\n");
 
        arch_enable_nonboot_cpus_begin();
 
        for_each_cpu(cpu, frozen_cpus) {
+               trace_suspend_resume(TPS("CPU_ON"), cpu, true);
                error = _cpu_up(cpu, 1);
+               trace_suspend_resume(TPS("CPU_ON"), cpu, false);
                if (!error) {
-                       printk(KERN_INFO "CPU%d is up\n", cpu);
+                       pr_info("CPU%d is up\n", cpu);
                        continue;
                }
-               printk(KERN_WARNING "Error taking CPU%d up: %d\n", cpu, error);
+               pr_warn("Error taking CPU%d up: %d\n", cpu, error);
        }
 
        arch_enable_nonboot_cpus_end();