linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chen Yucong <slaoub@gmail.com>
To: tglx@linutronix.de
Cc: peterz@infradead.org, linux-arch@vger.kernel.org,
	linux-kernel@vger.kernel.org, Chen Yucong <slaoub@gmail.com>
Subject: [PATCH] cpu/hotplug: print warning message in proper places for online or offline cpu
Date: Wed,  4 May 2016 21:51:48 +0800	[thread overview]
Message-ID: <1462369908-17395-1-git-send-email-slaoub@gmail.com> (raw)

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

                 reply	other threads:[~2016-05-04 13:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1462369908-17395-1-git-send-email-slaoub@gmail.com \
    --to=slaoub@gmail.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).