linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpu/hotplug: print warning message in proper places for online or offline cpu
@ 2016-05-04 13:51 Chen Yucong
  0 siblings, 0 replies; only message in thread
From: Chen Yucong @ 2016-05-04 13:51 UTC (permalink / raw)
  To: tglx; +Cc: peterz, linux-arch, linux-kernel, Chen Yucong

When we online or offline a CPU, unexpected errors may occur for
a number of reasons. So if a function called within _cpu_down() or
_cpu_up() returns a error code indicating a failed operation, the
warning message should be printed rather than fallow the failed
__cpu_notify().

Signed-off-by: Chen Yucong <slaoub@gmail.com>
---
 kernel/cpu.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index 3e3f6e4..b8a2d2a 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -317,8 +317,8 @@ static int notify_prepare(unsigned int cpu)
 	ret = __cpu_notify(CPU_UP_PREPARE, cpu, -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);
 		__cpu_notify(CPU_UP_CANCELED, cpu, nr_calls, NULL);
 	}
 	return ret;
@@ -353,6 +353,8 @@ static int bringup_cpu(unsigned int cpu)
 	ret = __cpu_up(cpu, idle);
 	if (ret) {
 		cpu_notify(CPU_UP_CANCELED, cpu);
+		pr_warn("%s: attempt to bring up CPU %u failed\n",
+			__func__, cpu);
 		return ret;
 	}
 	ret = bringup_wait_for_ap(cpu);
@@ -662,7 +664,7 @@ static int notify_down_prepare(unsigned int cpu)
 		nr_calls--;
 		__cpu_notify(CPU_DOWN_FAILED, cpu, nr_calls, NULL);
 		pr_warn("%s: attempt to take down CPU %u failed\n",
-				__func__, cpu);
+			__func__, cpu);
 	}
 	return err;
 }
@@ -737,6 +739,8 @@ static int takedown_cpu(unsigned int cpu)
 		irq_unlock_sparse();
 		/* Unpark the hotplug thread so we can rollback there */
 		kthread_unpark(per_cpu_ptr(&cpuhp_state, cpu)->thread);
+		pr_warn("%s: attempt to take down CPU %u failed\n",
+			__func__, cpu);
 		return err;
 	}
 	BUG_ON(cpu_online(cpu));
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-05-04 13:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-04 13:51 [PATCH] cpu/hotplug: print warning message in proper places for online or offline cpu Chen Yucong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).