From: HuKeping <hukeping@huawei.com>
To: <linux@arm.linux.org.uk>, <will.deacon@arm.com>,
<dave.martin@linaro.org>
Cc: <linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <peifeiyue@huawei.com>,
<sdu.liu@huawei.com>, <wangnan0@huawei.com>
Subject: [PATCH v2] ARM: kexec: Fix validating CPU hotplug support
Date: Mon, 27 Oct 2014 10:09:09 +0800 [thread overview]
Message-ID: <1414375749-42552-1-git-send-email-hukeping@huawei.com> (raw)
v1 -> v2:
-do some source format
Due to commit:2103f6cba61a8b8bea3fc1b63661d830a2125e76, there is
a hotplug checking in machine_kexec_prepare(), but it will lead
a failure when loading the crash-kernel in some cases.
Kexec utility can load the crash kernel by two ways:
1. kexec -l kernel-image --append=command-line-options --initrd=initrd-image
2. kexec -p kernel-image --append=command-line-options --initrd=initrd-image
In case #1, it's ok to do the hotplug checking things, for it will cut off
cpus in _cpu_down() later when command "kexec -e" be sended, function _cpu_down()
needs the support of cpu hotplug.
In case #2, it is no need to do the checking, because we actually do not
shut the cpus down, but just keep them invoking cpu_relax(), the whole routing
has no business with cpu cutting off. That means, even if the CONFIG_HOTPLUG_CPU
was not selected, it can also load and reboot the crash-kernel successfully if
we use "kexec -p ..." and then a crash came to trigger the kexec.
Prior to this patch, if the first kernel is not support the CPU hotplug, we can not
use kexec utility.
Signed-off-by: Hu Keping <hukeping@huawei.com>
---
arch/arm/kernel/machine_kexec.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
index 8cf0996..f5ebccb 100644
--- a/arch/arm/kernel/machine_kexec.c
+++ b/arch/arm/kernel/machine_kexec.c
@@ -41,12 +41,19 @@ int machine_kexec_prepare(struct kimage *image)
int i, err;
/*
- * Validate that if the current HW supports SMP, then the SW supports
- * and implements CPU hotplug for the current HW. If not, we won't be
- * able to kexec reliably, so fail the prepare operation.
+ * When it is a * crash * triggered the kexec, we do not really shut the
+ * cpus down but just let them keep invoking cpu_relax(), so there is no need
+ * to do the hotplug checking things.
*/
- if (num_possible_cpus() > 1 && !platform_can_cpu_hotplug())
- return -EINVAL;
+ if (image->type != KEXEC_TYPE_CRASH) {
+ /*
+ * Validate that if the current HW supports SMP, then the SW supports
+ * and implements CPU hotplug for the current HW. If not, we won't be
+ * able to kexec reliably, so fail the prepare operation.
+ */
+ if (num_possible_cpus() > 1 && !platform_can_cpu_hotplug())
+ return -EINVAL;
+ }
/*
* No segment at default ATAGs address. try to locate
--
1.8.5.5
reply other threads:[~2014-10-27 2:11 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=1414375749-42552-1-git-send-email-hukeping@huawei.com \
--to=hukeping@huawei.com \
--cc=dave.martin@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=peifeiyue@huawei.com \
--cc=sdu.liu@huawei.com \
--cc=wangnan0@huawei.com \
--cc=will.deacon@arm.com \
/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
all inboxes | Powered by JetHome®