aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/cpu.c')
-rw-r--r--kernel/cpu.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index a9e710eef0e2..a343bde710b1 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -20,6 +20,7 @@
20#include <linux/gfp.h> 20#include <linux/gfp.h>
21#include <linux/suspend.h> 21#include <linux/suspend.h>
22#include <linux/lockdep.h> 22#include <linux/lockdep.h>
23#include <trace/events/power.h>
23 24
24#include "smpboot.h" 25#include "smpboot.h"
25 26
@@ -283,8 +284,7 @@ static inline void check_for_tasks(int cpu)
283 task_cputime(p, &utime, &stime); 284 task_cputime(p, &utime, &stime);
284 if (task_cpu(p) == cpu && p->state == TASK_RUNNING && 285 if (task_cpu(p) == cpu && p->state == TASK_RUNNING &&
285 (utime || stime)) 286 (utime || stime))
286 printk(KERN_WARNING "Task %s (pid = %d) is on cpu %d " 287 pr_warn("Task %s (pid = %d) is on cpu %d (state = %ld, flags = %x)\n",
287 "(state = %ld, flags = %x)\n",
288 p->comm, task_pid_nr(p), cpu, 288 p->comm, task_pid_nr(p), cpu,
289 p->state, p->flags); 289 p->state, p->flags);
290 } 290 }
@@ -336,8 +336,8 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
336 if (err) { 336 if (err) {
337 nr_calls--; 337 nr_calls--;
338 __cpu_notify(CPU_DOWN_FAILED | mod, hcpu, nr_calls, NULL); 338 __cpu_notify(CPU_DOWN_FAILED | mod, hcpu, nr_calls, NULL);
339 printk("%s: attempt to take down CPU %u failed\n", 339 pr_warn("%s: attempt to take down CPU %u failed\n",
340 __func__, cpu); 340 __func__, cpu);
341 goto out_release; 341 goto out_release;
342 } 342 }
343 343
@@ -444,8 +444,8 @@ static int _cpu_up(unsigned int cpu, int tasks_frozen)
444 ret = __cpu_notify(CPU_UP_PREPARE | mod, hcpu, -1, &nr_calls); 444 ret = __cpu_notify(CPU_UP_PREPARE | mod, hcpu, -1, &nr_calls);
445 if (ret) { 445 if (ret) {
446 nr_calls--; 446 nr_calls--;
447 printk(KERN_WARNING "%s: attempt to bring up CPU %u failed\n", 447 pr_warn("%s: attempt to bring up CPU %u failed\n",
448 __func__, cpu); 448 __func__, cpu);
449 goto out_notify; 449 goto out_notify;
450 } 450 }
451 451
@@ -475,11 +475,10 @@ int cpu_up(unsigned int cpu)
475 int err = 0; 475 int err = 0;
476 476
477 if (!cpu_possible(cpu)) { 477 if (!cpu_possible(cpu)) {
478 printk(KERN_ERR "can't online cpu %d because it is not " 478 pr_err("can't online cpu %d because it is not configured as may-hotadd at boot time\n",
479 "configured as may-hotadd at boot time\n", cpu); 479 cpu);
480#if defined(CONFIG_IA64) 480#if defined(CONFIG_IA64)
481 printk(KERN_ERR "please check additional_cpus= boot " 481 pr_err("please check additional_cpus= boot parameter\n");
482 "parameter\n");
483#endif 482#endif
484 return -EINVAL; 483 return -EINVAL;
485 } 484 }
@@ -518,16 +517,17 @@ int disable_nonboot_cpus(void)
518 */ 517 */
519 cpumask_clear(frozen_cpus); 518 cpumask_clear(frozen_cpus);
520 519
521 printk("Disabling non-boot CPUs ...\n"); 520 pr_info("Disabling non-boot CPUs ...\n");
522 for_each_online_cpu(cpu) { 521 for_each_online_cpu(cpu) {
523 if (cpu == first_cpu) 522 if (cpu == first_cpu)
524 continue; 523 continue;
524 trace_suspend_resume(TPS("CPU_OFF"), cpu, true);
525 error = _cpu_down(cpu, 1); 525 error = _cpu_down(cpu, 1);
526 trace_suspend_resume(TPS("CPU_OFF"), cpu, false);
526 if (!error) 527 if (!error)
527 cpumask_set_cpu(cpu, frozen_cpus); 528 cpumask_set_cpu(cpu, frozen_cpus);
528 else { 529 else {
529 printk(KERN_ERR "Error taking CPU%d down: %d\n", 530 pr_err("Error taking CPU%d down: %d\n", cpu, error);
530 cpu, error);
531 break; 531 break;
532 } 532 }
533 } 533 }
@@ -537,7 +537,7 @@ int disable_nonboot_cpus(void)
537 /* Make sure the CPUs won't be enabled by someone else */ 537 /* Make sure the CPUs won't be enabled by someone else */
538 cpu_hotplug_disabled = 1; 538 cpu_hotplug_disabled = 1;
539 } else { 539 } else {
540 printk(KERN_ERR "Non-boot CPUs are not disabled\n"); 540 pr_err("Non-boot CPUs are not disabled\n");
541 } 541 }
542 cpu_maps_update_done(); 542 cpu_maps_update_done();
543 return error; 543 return error;
@@ -561,17 +561,19 @@ void __ref enable_nonboot_cpus(void)
561 if (cpumask_empty(frozen_cpus)) 561 if (cpumask_empty(frozen_cpus))
562 goto out; 562 goto out;
563 563
564 printk(KERN_INFO "Enabling non-boot CPUs ...\n"); 564 pr_info("Enabling non-boot CPUs ...\n");
565 565
566 arch_enable_nonboot_cpus_begin(); 566 arch_enable_nonboot_cpus_begin();
567 567
568 for_each_cpu(cpu, frozen_cpus) { 568 for_each_cpu(cpu, frozen_cpus) {
569 trace_suspend_resume(TPS("CPU_ON"), cpu, true);
569 error = _cpu_up(cpu, 1); 570 error = _cpu_up(cpu, 1);
571 trace_suspend_resume(TPS("CPU_ON"), cpu, false);
570 if (!error) { 572 if (!error) {
571 printk(KERN_INFO "CPU%d is up\n", cpu); 573 pr_info("CPU%d is up\n", cpu);
572 continue; 574 continue;
573 } 575 }
574 printk(KERN_WARNING "Error taking CPU%d up: %d\n", cpu, error); 576 pr_warn("Error taking CPU%d up: %d\n", cpu, error);
575 } 577 }
576 578
577 arch_enable_nonboot_cpus_end(); 579 arch_enable_nonboot_cpus_end();
@@ -726,10 +728,12 @@ void set_cpu_present(unsigned int cpu, bool present)
726 728
727void set_cpu_online(unsigned int cpu, bool online) 729void set_cpu_online(unsigned int cpu, bool online)
728{ 730{
729 if (online) 731 if (online) {
730 cpumask_set_cpu(cpu, to_cpumask(cpu_online_bits)); 732 cpumask_set_cpu(cpu, to_cpumask(cpu_online_bits));
731 else 733 cpumask_set_cpu(cpu, to_cpumask(cpu_active_bits));
734 } else {
732 cpumask_clear_cpu(cpu, to_cpumask(cpu_online_bits)); 735 cpumask_clear_cpu(cpu, to_cpumask(cpu_online_bits));
736 }
733} 737}
734 738
735void set_cpu_active(unsigned int cpu, bool active) 739void set_cpu_active(unsigned int cpu, bool active)