From: James Morse <james.morse@arm.com>
To: Geoff Levand <geoff@infradead.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
marc.zyngier@arm.com, Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
AKASHI Takahiro <takahiro.akashi@linaro.org>,
kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v20 04/14] arm64/kexec: Add core kexec support
Date: Mon, 27 Jun 2016 12:18:42 +0100 [thread overview]
Message-ID: <57710B92.2080603@arm.com> (raw)
In-Reply-To: <018ac873d87fbfc45185cdab91ebc8731f64f94c.1466702804.git.geoff@infradead.org>
Hi Geoff,
On 23/06/16 18:54, Geoff Levand wrote:
> Add three new files, kexec.h, machine_kexec.c and relocate_kernel.S to the
> arm64 architecture that add support for the kexec re-boot mechanism
> (CONFIG_KEXEC) on arm64 platforms.
> diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c
> new file mode 100644
> index 0000000..e2904c4
> --- /dev/null
> +++ b/arch/arm64/kernel/machine_kexec.c
> +/**
> + * machine_kexec_prepare - Prepare for a kexec reboot.
> + *
> + * Called from the core kexec code when a kernel image is loaded.
> + * Forbid loading a kexec kernel if we have no way of hotplugging cpus or cpus
> + * are stuck in the kernel. This avoids a panic once we hit machine_kexec().
> + */
> +int machine_kexec_prepare(struct kimage *kimage)
> +{
> + kimage_start = kimage->start;
> +
> + if (kimage->type != KEXEC_TYPE_CRASH) {
> + if (cpus_are_stuck_in_kernel()) {
> + pr_err("Can't kexec: failed CPUs are stuck in the kernel.\n");
We may want to change the word 'failed' here, the helper function now also
covers systems that boot secondary processors with spin tables that are stuck in
the secondary_holding_pen:
> "Can't kexec: secondary CPUs are stuck in the kernel.\n"
> + return -EBUSY;
> + }
> +
> + if (num_online_cpus() > 1) {
> + if (IS_ENABLED(CONFIG_HOTPLUG_CPU)) {
> + /* any_cpu as we don't mind being preempted */
> + int any_cpu = raw_smp_processor_id();
> +
> + if (cpu_ops[any_cpu]->cpu_die)
> + return 0;
> + }
> +
> + pr_err("Can't kexec: no mechanism to offline secondary CPUs.\n");
> + return -EBUSY;
> + }
This if() {} hunk isn't necessary with the version of cpus_are_stuck_in_kernel()
you have in patch 2. This logic is the '|| smp_spin_tables' part of that helper
function. (hibernate needed it too)
> + }
> +
> + return 0;
> +}
> +
[ ... ]
> +/**
> + * machine_kexec - Do the kexec reboot.
> + *
> + * Called from the core kexec code for a sys_reboot with LINUX_REBOOT_CMD_KEXEC.
> + */
> +void machine_kexec(struct kimage *kimage)
> +{
> + phys_addr_t reboot_code_buffer_phys;
> + void *reboot_code_buffer;
> +
> + /*
> + * New cpus may have become stuck_in_kernel after we loaded the image.
> + */
> + BUG_ON(cpus_are_stuck_in_kernel() && (num_online_cpus() > 1));
BUG_ON(cpus_are_stuck_in_kernel() || (num_online_cpus() > 1));
Thanks,
James
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2016-06-27 11:18 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-23 17:54 [PATCH v20 00/14] arm64 kexec kernel patches Geoff Levand
2016-06-23 17:54 ` [PATCH v20 07/14] arm64: kdump: reserve memory for crash dump kernel Geoff Levand
2016-06-23 17:54 ` [PATCH v20 04/14] arm64/kexec: Add core kexec support Geoff Levand
2016-06-27 11:18 ` James Morse [this message]
2016-06-27 14:39 ` Catalin Marinas
2016-06-27 16:29 ` James Morse
2016-06-27 17:00 ` Geoff Levand
2016-06-23 17:54 ` [PATCH v20 05/14] arm64/kexec: Enable kexec in the arm64 defconfig Geoff Levand
2016-06-23 17:54 ` [PATCH v20 01/14] arm64: hibernate: Don't hibernate on systems with stuck CPUs Geoff Levand
2016-06-27 11:04 ` James Morse
2016-06-27 16:44 ` Geoff Levand
2016-06-23 17:54 ` [PATCH v20 08/14] arm64: limit memory regions based on DT property, usable-memory Geoff Levand
2016-06-23 17:54 ` [PATCH v20 02/14] arm64: smp: Add function to determine if cpus are stuck in the kernel Geoff Levand
2016-06-23 17:54 ` [PATCH v20 11/14] arm64: kdump: add VMCOREINFO's for user-space coredump tools Geoff Levand
2016-06-23 17:54 ` [PATCH v20 03/14] arm64: Add back cpu reset routines Geoff Levand
2016-06-23 17:54 ` [PATCH v20 09/14] arm64: kdump: implement machine_crash_shutdown() Geoff Levand
2016-06-23 17:54 ` [PATCH v20 06/14] arm64/kexec: Add pr_debug output Geoff Levand
2016-06-23 17:54 ` [PATCH v20 10/14] arm64: kdump: add kdump support Geoff Levand
2016-06-23 17:54 ` [PATCH v20 12/14] arm64: kdump: enable kdump in the arm64 defconfig Geoff Levand
2016-06-23 17:54 ` [PATCH v20 14/14] Documentation: dt: usable-memory and elfcorehdr nodes for arm64 kexec Geoff Levand
2016-06-27 18:22 ` Thiago Jung Bauermann
2016-06-28 3:59 ` Michael Ellerman
2016-06-23 17:54 ` [PATCH v20 13/14] arm64: kdump: update a kernel doc Geoff Levand
2016-06-30 9:00 ` Baoquan He
2016-07-01 7:37 ` AKASHI Takahiro
2016-07-01 7:45 ` Baoquan He
2016-07-04 3:04 ` AKASHI Takahiro
2016-06-30 13:00 ` Dave Young
2016-06-27 17:00 ` [PATCH v20 00/14] arm64 kexec kernel patches Catalin Marinas
2016-06-27 17:07 ` Geoff Levand
2016-06-29 0:54 ` AKASHI Takahiro
2016-06-29 9:20 ` Catalin Marinas
2016-06-30 1:46 ` AKASHI Takahiro
2016-07-01 2:39 ` Pratyush Anand
2016-07-04 7:14 ` AKASHI Takahiro
2016-07-04 10:15 ` Pratyush Anand
2016-07-15 4:17 ` Simon Horman
2016-07-15 16:18 ` Geoff Levand
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=57710B92.2080603@arm.com \
--to=james.morse@arm.com \
--cc=catalin.marinas@arm.com \
--cc=geoff@infradead.org \
--cc=kexec@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=marc.zyngier@arm.com \
--cc=mark.rutland@arm.com \
--cc=takahiro.akashi@linaro.org \
--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;
as well as URLs for NNTP newsgroup(s).