Skip to contentSkip to conversation

arm64 kexec kernel patches

PATCH In review Geoff Levand 10 participants 38 messages Jun 23, 2016 – Jul 15, 2016

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

v20 cover arm64 kexec kernel patches

This series adds the core support for kexec re-boot and kdump on ARM64. This version of the series combines Takahiro's kdump patches with my kexec patches. Please consider all patches for inclusion.

Takahiro has done some extensive testing for this version with various configurations af endian, image format, memory options and layouts, etc.

To load a second stage kernel and execute a kexec re-boot or to work with kdump on ARM64 systems a series of patches to kexec-tools [2], which have not yet been merged upstream, are needed. Please update to the latest if you have been using an older version.

To examine vmcore (/proc/vmcore), you should use
- gdb v7.7 or later (only useful for non-KASLR kernel)
- crash utility master branch (coming v7.1.6 or later) For crash KASLR/CONFIG_RANDOMIZE_BASE support see [3].

[1]  https://git.kernel.org/cgit/linux/kernel/git/geoff/linux-kexec.git
[2]  https://git.kernel.org/cgit/linux/kernel/git/geoff/kexec-tools.git
[3]  https://www.redhat.com/archives/crash-utility/2016-May/msg00078.html

Changes for v20 (June 23, 2016, 25m):

o Rebase to Linux-4.7-rc4.
o Add missing break statement in kexec_list_flush.
o Add a check for a return value of parse_crashkernel().
o Fix a wrong check against misalignment of allocated crash kernel region.

Changes for v19 (June 16, 2016, 25m):

o Rebase to Linux-4.7-rc3.
o Added more VMCOREINFO's (VA_BITS, PHYS_OFFSET).
o Remove some unneeded included files.
o Remove kmap() usage.
o Remove kexec_is_dtb() routine.
o Change #ifdef to IS_ENABLED(CONFIG_HOTPLUG_CPU).
o Fix kexec_list_flush() to flush all list entries.
o Use ENTRY(arm64_relocate_new_kernel).
o Remove unused segment start in arm64_relocate_new_kernel.

Changes for v18 (June 9, 2016, 25m):

o Rebase to Linux-4.7-rc2.
o Change ret to br in __cpu_soft_restart().
o Add cpu_install_idmap() call and hyp checks to cpu_soft_restart().
o Don't return from HVC_SOFT_RESTART.

Changes for v17 (June 9, 2016, 25m):

o Rebase to Linux-4.7-rc2.
o Change ret to br in __cpu_soft_restart().
o Add cpu_install_idmap() call to cpu_soft_restart().

Changes for v17 (June 3, 2016, 25m):

o Rebase to Linux-4.7-rc1.
o Added one VMCOREINFO parameter to vmcore for crash utility.
o Added a check for CPUs stuck in kernel.
o Re-implemented cpu_soft_restart() to be executed only in hyp-stub.
o Added some kernel documentation about added device tree properties.
o Fixed a returned value of pstate in crash_setup_regs(). Now return a faked pstate since we have no way to get the current pstate.

Changes for v16 (Apr 14, 2016, 23m):

o Rebase to Linux-4.6-rc3.
o Don't try to explicitly enter EL2 at machine_kexec() when VHE in use
o Add unreachable() in case of ipi_cpu_crash_stop()
o Add more "#ifdef" to eliminate code unused when !CONFIG_KEXEC_CORE
o Fix a build error around ipi_cpu_crash_stop() when !CONFIG_HOTPLUG_CPU
o Revert "arm64: Add new hcall HVC_CALL_FUNC"
o Revert "Convert hcalls to use HVC immediate value"
(replaced by James' "hyp/kvm: Extend hyp-stub API to allow function calls
at EL2")

Modified by James:
o Add missing icache maintenance + isb to __kvm_hyp_reset()
o Rework kvm cpu hotplug for VHE

Added by James:
o arm64: head.S: el2_setup() to accept sctlr_el1 as an argument
o arm64: hyp/kvm: Extend hyp-stub API to allow function calls at EL2
o arm64: kvm: Move lr save/restore from do_el2_call into EL1
o arm64: kvm: Move the do_el2_call macro to a header file

Changes for v15 (Mar 14, 2016, 22m):

o Rebase to Linux-4.5.
o Remove DEBUG conditional in 'Add pr_debug output'.

Changes for v14 (Mar 4, 2016, 22m):

o Rebase to Linux-4.5-rc6.
o Rename setup_mm_for_reboot to cpu_install_idmap.
o kdump: leave non-boot cpus online at crash dump
As we don't have to make non-boot (crashed) cpus offline at crash dump, this patch adds a variant of smp_send_stop().
o kdump: use a new device-tree property, "linux,elfcorehdr", instead of traditional "elfcorehdr=" kernel parameter
o limit memory regions based on DT property, "usable-memory", instead of "mem=" kernel parameter
o kdump: fix a build error when !CONFIG_KEXEC_CORE
o kvm: use generic kvm_call_hyp() interface instead of kvm_cpu_reset()
o kvm: initialize only a primary cpu at init_hyp_mode()

Changes for v13 (Jan 15, 2016, 20m):

o Rebase to Linux-4.4.
o Remove align directive from cpu_reset.c.
o Use inline C wrapper for cpu_soft_restart.
o Revert the new image d-cache flush changes of v10.
o Add SCTLR cleanup patch.
o Change pr_devel to pr_debug.
o Call flush_icache_range() for reboot_code_buffer.
o Add .ltorg directive to arm64_relocate_new_kernel.
o Make new asm macro copy_page.
o Change cache maintenence from inner-shareable to non-shareable.
o Rename KEXEC_ARCH_ARM64 to KEXEC_ARCH_AARCH64.

o arm64: kvm: allows kvm cpu hotplug
- remove some garbage code from kvm_host.h
o arm64: kdump: reserve memory for crash dump kernel
- change CONFIG_KEXEC to CONFIG_KEXEC_CORE
- don't panic on crash kernel alloc failure
(thanks to Mark Salter, RH)
o arm64: kdump: implement machine_crash_shutdown()
- change "boot/non-boot cpu" to "crashing/non-crashing cpu"
- introduce is_in_crash_kexec() for readability
- re-introduce machine_kexec_mask_interrupts(), as arch/arm has, to discard unexpected interrupts
- call crash_save_cpu() before making cpus offline to avoid a possible race (thanks to Pratyush Anand/Mark Salter, RH)
o arm64: kdump: update a kernel doc
- clarify that we support "Image" format as well as vmlinux in kdump.txt
o arm64: kdump: relax BUG_ON() if more than one cpus are still active
- change a warning message at the failure of shooting down non-crahsing cpus

Changes for v12 (Nov 24, 2015, 18m):

o No changes, rebase to Linux-4.4-rc2.

Changes for v11 (Nov 6, 2015, 18m):

o Rebase to Linux-4.3.
o Move the new image d-cache flush from arm64_relocate_new_kernel to machine_kexec.
o Pass values to arm64_relocate_new_kernel in registers, not in global variables.
o Fixups to setting the sctlr_el1 and sctlr_el2 flags.

Changes for v10 (Oct 18, 2015, 17m):

o Rebase to Linux-4.3-rc6.
o Move tcr_set_idmap_t0sz to assembler.h.
o Add back simplified cpu_reset routines.
o Combine kexec + kdump patches.

Changes for v9 (Apr 7, 2015, 11m):

o Use new upstream flag IND_FLAGS.

Changes for v8 (Mar 19, 2015, 10m):

o Rebase to Linux-4.0-rc4.
o Re-boot using purgatory only.

Changes for v7 (Jan 16, 2015, 8m):

o Rebase to Linux-3.19-rc4.
o Change from ESR_EL2_ to ESR_ELx_.
o Remove work-arounds for EFI systems.

Changes for v6 (Dec 2, 2014, 7m):

o Rebase to Linux-3.18-rc2

Changes for v5 (Nov 16, 2014, 6m):

Changes for v4 (Oct 3, 2014, 5m):

Changes for v3 (Sept 23, 2014, 4m):

Changes for v2 (Sep 9, 2014, 4m):

o Rebase to Linux-3.17-rc4.
o Move macros from proc-macros.S to assembler.h.
o Convert hcalls to use ISS field.
o Add new hcall HVC_CALL_FUNC.
o Add EL2 switch to soft_restart.

First submission v1 (May 13, 2014):

o Based on Linux-3.15-rc4.

-Geoff

The following changes since commit 33688abb2802ff3a230bd2441f765477b94cc89e:

Linux 4.7-rc4 (2016-06-19 21:30:02 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/geoff/linux-kexec.git kexec-v20

for you to fetch changes up to e212cd53fdf9d09923408eb906fe0228d22432a9:

Documentation: dt: usable-memory and elfcorehdr nodes for arm64 kexec (2016-06-23 10:01:38 -0700)

----------------------------------------------------------------
AKASHI Takahiro (7):
arm64: kdump: reserve memory for crash dump kernel
arm64: limit memory regions based on DT property, usable-memory
arm64: kdump: implement machine_crash_shutdown()
arm64: kdump: add kdump support
arm64: kdump: add VMCOREINFO's for user-space coredump tools
arm64: kdump: enable kdump in the arm64 defconfig
arm64: kdump: update a kernel doc

Geoff Levand (4):
arm64: Add back cpu reset routines arm64/kexec: Add core kexec support arm64/kexec: Enable kexec in the arm64 defconfig arm64/kexec: Add pr_debug output

James Morse (3):
arm64: hibernate: Don't hibernate on systems with stuck CPUs
arm64: smp: Add function to determine if cpus are stuck in the kernel
Documentation: dt: usable-memory and elfcorehdr nodes for arm64 kexec

 Documentation/devicetree/bindings/chosen.txt |  28 +++
 Documentation/kdump/kdump.txt                |  15 +-
 arch/arm64/Kconfig                           |  21 ++
 arch/arm64/configs/defconfig                 |   2 +
 arch/arm64/include/asm/hardirq.h             |   2 +-
 arch/arm64/include/asm/kexec.h               |  87 ++++++++
 arch/arm64/include/asm/smp.h                 |  16 ++
 arch/arm64/include/asm/virt.h                |   5 +
 arch/arm64/kernel/Makefile                   |   3 +
 arch/arm64/kernel/cpu-reset.S                |  54 +++++
 arch/arm64/kernel/cpu-reset.h                |  34 ++++
 arch/arm64/kernel/crash_dump.c               |  71 +++++++
 arch/arm64/kernel/hibernate.c                |   6 +
 arch/arm64/kernel/hyp-stub.S                 |  10 +-
 arch/arm64/kernel/machine_kexec.c            | 288 +++++++++++++++++++++++++++
 arch/arm64/kernel/relocate_kernel.S          | 130 ++++++++++++
 arch/arm64/kernel/setup.c                    |   7 +-
 arch/arm64/kernel/smp.c                      |  79 ++++++++
 arch/arm64/mm/init.c                         | 154 ++++++++++++++
 include/uapi/linux/kexec.h                   |   1 +
 20 files changed, 1009 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm64/include/asm/kexec.h
 create mode 100644 arch/arm64/kernel/cpu-reset.S
 create mode 100644 arch/arm64/kernel/cpu-reset.h
 create mode 100644 arch/arm64/kernel/crash_dump.c
 create mode 100644 arch/arm64/kernel/machine_kexec.c
 create mode 100644 arch/arm64/kernel/relocate_kernel.S
Signature · 7 lines
2.5.0


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#1 lore raw

PATCH v20 1/14 arm64: hibernate: Don't hibernate on systems with stuck CPUs

From: James Morse <[email protected]>

Hibernate relies on cpu hotplug to prevent secondary cores executing the kernel text while it is being restored.

Add a call to cpus_are_stuck_in_kernel() to determine if there are CPUs not counted by 'num_online_cpus()', and prevent hibernate in this case.

Fixes 82869ac57b5 ("arm64: kernel: Add support for hibernate/suspend-to-disk")
---
 arch/arm64/kernel/hibernate.c | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm64/kernel/hibernate.c +6 -0
index f8df75d..21ab5df 100644
@@ -33,6 +33,7 @@
 #include <asm/pgtable.h>
 #include <asm/pgtable-hwdef.h>
 #include <asm/sections.h>
+#include <asm/smp.h>
 #include <asm/suspend.h>
 #include <asm/virt.h>
 
@@ -236,6 +237,11 @@ int swsusp_arch_suspend(void)
 	unsigned long flags;
 	struct sleep_stack_data state;
 
+	if (cpus_are_stuck_in_kernel()) {
+		pr_err("Can't hibernate: no mechanism to offline secondary CPUs.\n");
+		return -EBUSY;
+	}
+
 	local_dbg_save(flags);
 
 	if (__cpu_suspend_enter(&state)) {
Signature · 8 lines
2.5.0



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#2 lore raw

Re: [PATCH v20 01/14] arm64: hibernate: Don't hibernate on systems with stuck CPUs

Hi

Quoted 9 lines · Geoff Levand

From: James Morse <[email protected]>

Hibernate relies on cpu hotplug to prevent secondary cores executing the kernel text while it is being restored.

Add a call to cpus_are_stuck_in_kernel() to determine if there are CPUs not counted by 'num_online_cpus()', and prevent hibernate in this case.

Quoted 5 lines
Fixes 82869ac57b5 ("arm64: kernel: Add support for hibernate/suspend-to-disk")
---
 arch/arm64/kernel/hibernate.c | 6 ++++++
 1 file changed, 6 insertions(+)

... this patch isn't necessary for kexec, it wired up the helper function you have in patch 2 for hibernate.

Please drop this in any future posting!

Thanks,

James

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#3 lore raw

Re: [PATCH v20 01/14] arm64: hibernate: Don't hibernate on systems with stuck CPUs

Hi,

Quoted 5 lines · James Morse

... this patch isn't necessary for kexec, it wired up the helper function you
have in patch 2 for hibernate.

Please drop this in any future posting!

It seems both your patches I had went in for -rc5, so they're gone now from my master.

-Geoff

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#4 lore raw

PATCH v20 2/14 arm64: smp: Add function to determine if cpus are stuck in the kernel

In reply to Geoff Levand

From: James Morse <[email protected]>

kernel/smp.c has a fancy counter that keeps track of the number of CPUs it marked as not-present and left in cpu_park_loop(). If there are any CPUs spinning in here, features like kexec or hibernate may release them by overwriting this memory.

This problem also occurs on machines using spin-tables to release secondary cores.
After commit 44dbcc93ab67 ("arm64: Fix behavior of maxcpus=N") we bring all known cpus into the secondary holding pen, meaning this memory can't be re-used by kexec or hibernate.

Add a function cpus_are_stuck_in_kernel() to determine if either of these cases have occurred.

---
 arch/arm64/include/asm/smp.h | 12 ++++++++++++
 arch/arm64/kernel/smp.c      | 18 ++++++++++++++++++
 2 files changed, 30 insertions(+)
arch/arm64/include/asm/smp.h +12 -0
index 433e504..0226447 100644
@@ -124,6 +124,18 @@ static inline void cpu_panic_kernel(void)
 	cpu_park_loop();
 }
 
+/*
+ * If a secondary CPU enters the kernel but fails to come online,
+ * (e.g. due to mismatched features), and cannot exit the kernel,
+ * we increment cpus_stuck_in_kernel and leave the CPU in a
+ * quiesecent loop within the kernel text. The memory containing
+ * this loop must not be re-used for anything else as the 'stuck'
+ * core is executing it.
+ *
+ * This function is used to inhibit features like kexec and hibernate.
+ */
+bool cpus_are_stuck_in_kernel(void);
+
 #endif /* ifndef __ASSEMBLY__ */
 
 #endif /* ifndef __ASM_SMP_H */
arch/arm64/kernel/smp.c +18 -0
index 678e084..62ff3c0 100644
@@ -909,3 +909,21 @@ int setup_profiling_timer(unsigned int multiplier)
 {
 	return -EINVAL;
 }
+
+static bool have_cpu_die(void)
+{
+#ifdef CONFIG_HOTPLUG_CPU
+	int any_cpu = raw_smp_processor_id();
+
+	if (cpu_ops[any_cpu]->cpu_die)
+		return true;
+#endif
+	return false;
+}
+
+bool cpus_are_stuck_in_kernel(void)
+{
+	bool smp_spin_tables = (num_possible_cpus() > 1 && !have_cpu_die());
+
+	return !!cpus_stuck_in_kernel || smp_spin_tables;
+}
Signature · 8 lines
2.5.0



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#5 lore raw

PATCH v20 3/14 arm64: Add back cpu reset routines

In reply to Geoff Levand

Commit 68234df4ea79 ("arm64: kill flush_cache_all()") removed the global arm64 routines cpu_reset() and cpu_soft_restart() needed by the arm64 kexec and kdump support. Add back a simplified version of cpu_soft_restart() with some changes needed for kexec in the new files cpu_reset.S, and cpu_reset.h.

When a CPU is reset it needs to be put into the exception level it had when it entered the kernel. Update cpu_soft_restart() to accept an argument which signals if the reset address should be entered at EL1 or EL2, and add a new hypercall HVC_SOFT_RESTART which is used for the EL2 switch.

---
 arch/arm64/include/asm/virt.h |  5 ++++
 arch/arm64/kernel/cpu-reset.S | 54 +++++++++++++++++++++++++++++++++++++++++++
 arch/arm64/kernel/cpu-reset.h | 34 +++++++++++++++++++++++++++
 arch/arm64/kernel/hyp-stub.S  | 10 +++++++-
 4 files changed, 102 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm64/kernel/cpu-reset.S
 create mode 100644 arch/arm64/kernel/cpu-reset.h
arch/arm64/include/asm/virt.h +5 -0
index dcbcf8d..bbc6a8c 100644
@@ -34,6 +34,11 @@
  */
 #define HVC_SET_VECTORS 1
 
+/*
+ * HVC_SOFT_RESTART - CPU soft reset, used by the cpu_soft_restart routine.
+ */
+#define HVC_SOFT_RESTART 2
+
 #define BOOT_CPU_MODE_EL1	(0xe11)
 #define BOOT_CPU_MODE_EL2	(0xe12)
 
arch/arm64/kernel/cpu-reset.S new file +54 -0

54 lines not on this page · raw message

arch/arm64/kernel/cpu-reset.h new file +34 -0
new file mode 100644
index 0000000..d4e9ecb
@@ -0,0 +1,34 @@
+/*
+ * CPU reset routines
+ *
+ * Copyright (C) 2015 Huawei Futurewei Technologies.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ARM64_CPU_RESET_H
+#define _ARM64_CPU_RESET_H
+
+#include <asm/virt.h>
+
+void __cpu_soft_restart(unsigned long el2_switch, unsigned long entry,
+	unsigned long arg0, unsigned long arg1, unsigned long arg2);
+
+static inline void __noreturn cpu_soft_restart(unsigned long el2_switch,
+	unsigned long entry, unsigned long arg0, unsigned long arg1,
+	unsigned long arg2)
+{
+	typeof(__cpu_soft_restart) *restart;
+
+	el2_switch = el2_switch && !is_kernel_in_hyp_mode() &&
+		is_hyp_mode_available();
+	restart = (void *)virt_to_phys(__cpu_soft_restart);
+
+	cpu_install_idmap();
+	restart(el2_switch, entry, arg0, arg1, arg2);
+	unreachable();
+}
+
+#endif
arch/arm64/kernel/hyp-stub.S +9 -1
index 8727f44..d3b5f75 100644
@@ -71,8 +71,16 @@ el1_sync:
 	msr	vbar_el2, x1
 	b	9f
 
+2:	cmp	x0, #HVC_SOFT_RESTART
+	b.ne	3f
+	mov	x0, x2
+	mov	x2, x4
+	mov	x4, x1
+	mov	x1, x3
+	br	x4				// no return
+
 	/* Someone called kvm_call_hyp() against the hyp-stub... */
-2:	mov     x0, #ARM_EXCEPTION_HYP_GONE
+3:	mov	x0, #ARM_EXCEPTION_HYP_GONE
 
 9:	eret
 ENDPROC(el1_sync)
Signature · 8 lines
2.5.0



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#6 lore raw

PATCH v20 4/14 arm64/kexec: Add core kexec support

In reply to Geoff Levand

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.

---
 arch/arm64/Kconfig                  |  10 ++
 arch/arm64/include/asm/kexec.h      |  48 ++++++++++
 arch/arm64/kernel/Makefile          |   2 +
 arch/arm64/kernel/machine_kexec.c   | 185 ++++++++++++++++++++++++++++++++++++
 arch/arm64/kernel/relocate_kernel.S | 130 +++++++++++++++++++++++++
 include/uapi/linux/kexec.h          |   1 +
 6 files changed, 376 insertions(+)
 create mode 100644 arch/arm64/include/asm/kexec.h
 create mode 100644 arch/arm64/kernel/machine_kexec.c
 create mode 100644 arch/arm64/kernel/relocate_kernel.S
arch/arm64/Kconfig +10 -0
index 5a0a691..330786d 100644
@@ -664,6 +664,16 @@ config PARAVIRT_TIME_ACCOUNTING
 
 	  If in doubt, say N here.
 
+config KEXEC
+	depends on PM_SLEEP_SMP
+	select KEXEC_CORE
+	bool "kexec system call"
+	---help---
+	  kexec is a system call that implements the ability to shutdown your
+	  current kernel, and to start another kernel.  It is like a reboot
+	  but it is independent of the system firmware.   And like a reboot
+	  you can start any kernel with it, not just Linux.
+
 config XEN_DOM0
 	def_bool y
 	depends on XEN
arch/arm64/include/asm/kexec.h new file +48 -0

48 lines not on this page · raw message

arch/arm64/kernel/Makefile +2 -0
index 2173149..7700c0c 100644
@@ -46,6 +46,8 @@ arm64-obj-$(CONFIG_ARM64_ACPI_PARKING_PROTOCOL)	+= acpi_parking_protocol.o
 arm64-obj-$(CONFIG_PARAVIRT)		+= paravirt.o
 arm64-obj-$(CONFIG_RANDOMIZE_BASE)	+= kaslr.o
 arm64-obj-$(CONFIG_HIBERNATION)		+= hibernate.o hibernate-asm.o
+arm64-obj-$(CONFIG_KEXEC)		+= machine_kexec.o relocate_kernel.o	\
+					   cpu-reset.o
 
 obj-y					+= $(arm64-obj-y) vdso/
 obj-m					+= $(arm64-obj-m)
arch/arm64/kernel/machine_kexec.c new file +185 -0

185 lines not on this page · raw message

arch/arm64/kernel/relocate_kernel.S new file +130 -0

130 lines not on this page · raw message

include/uapi/linux/kexec.h +1 -0
index 99048e5..aae5ebf 100644
@@ -39,6 +39,7 @@
 #define KEXEC_ARCH_SH      (42 << 16)
 #define KEXEC_ARCH_MIPS_LE (10 << 16)
 #define KEXEC_ARCH_MIPS    ( 8 << 16)
+#define KEXEC_ARCH_AARCH64 (183 << 16)
 
 /* The artificial cap on the number of segments passed to kexec_load. */
 #define KEXEC_SEGMENT_MAX 16
Signature · 8 lines
2.5.0



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#7 lore raw

Re: [PATCH v20 04/14] arm64/kexec: Add core kexec support

Hi Geoff,

Quoted 13 lines · Geoff Levand

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.

arch/arm64/kernel/machine_kexec.c new file +4 -0
new file mode 100644
index 0000000..e2904c4
+/**
+ * machine_kexec_prepare - Prepare for a kexec reboot.
+ *
+ * Called from the core kexec code when a kernel image is loaded.

arch/arm64/kernel/machine_kexec.c line 45

Quoted 10 lines
arch/arm64/kernel/machine_kexec.c new file +10 -0
+ * 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:

Quoted 11 lines

"Can't kexec: secondary CPUs are stuck in the kernel.\n"

arch/arm64/kernel/machine_kexec.c new file +5 -0
+			return -EBUSY;
+		}
+
 
 
 
+		if (num_online_cpus() > 1) {
+			if (IS_ENABLED(CONFIG_HOTPLUG_CPU)) {

arch/arm64/kernel/machine_kexec.c line 60

Quoted 10 lines
arch/arm64/kernel/machine_kexec.c new file +10 -0
+				/* 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)

Quoted 5 lines
arch/arm64/kernel/machine_kexec.c new file +5 -0
+	}
+
+	return 0;
+}
+

[ ... ]

Quoted 4 lines
arch/arm64/kernel/machine_kexec.c new file +4 -0
+/**
+ * machine_kexec - Do the kexec reboot.
+ *
+ * Called from the core kexec code for a sys_reboot with LINUX_REBOOT_CMD_KEXEC.

arch/arm64/kernel/machine_kexec.c line 138

Quoted 10 lines
arch/arm64/kernel/machine_kexec.c new file +10 -0
+ */
+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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

maintainer
#8 lore raw

Re: [PATCH v20 04/14] arm64/kexec: Add core kexec support

Quoted 7 lines · James Morse
Quoted 5 lines · Geoff Levand

"Can't kexec: secondary CPUs are stuck in the kernel.\n"

(quoted diff) +3 -0
+			return -EBUSY;
+		}
+
Quoted 16 lines

Review

Quoted 12 lines
(quoted diff) +12 -0
+		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)

I can make the changes locally but just to be clear I understand what you meant, here's the diff on top of Geoff's patch:

----8<-------------------------

arch/arm64/kernel/machine_kexec.c +4 -19
index 945ce326654c..bc96c8a7fc79 100644
@@ -68,24 +68,9 @@ int machine_kexec_prepare(struct kimage *kimage)
 
 	kexec_image_info(kimage);
 
-	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");
-			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;
-		}
+	if (kimage->type != KEXEC_TYPE_CRASH && cpus_are_stuck_in_kernel()) {
+		pr_err("Can't kexec: CPUs are stuck in the kernel.\n");
+		return -EBUSY;
 	}
 
 	return 0;
@@ -163,7 +148,7 @@ void machine_kexec(struct kimage *kimage)
 	/*
 	 * 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));
 
 	reboot_code_buffer_phys = page_to_phys(kimage->control_code_page);
 	reboot_code_buffer = phys_to_virt(reboot_code_buffer_phys);

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#9 lore raw

Re: [PATCH v20 04/14] arm64/kexec: Add core kexec support

Hi Catalin,

Quoted 7 lines · Catalin Marinas
Quoted 3 lines · James Morse

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)

I can make the changes locally but just to be clear I understand what you meant, here's the diff on top of Geoff's patch:

Ah, I see my 'if() {}' comment is ambiguous as there are two ...

Quoted 37 lines

----8<-------------------------

arch/arm64/kernel/machine_kexec.c +3 -18
index 945ce326654c..bc96c8a7fc79 100644
@@ -68,24 +68,9 @@ int machine_kexec_prepare(struct kimage *kimage)
 
 	kexec_image_info(kimage);
 
-	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");
-			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;
-		}
+	if (kimage->type != KEXEC_TYPE_CRASH && cpus_are_stuck_in_kernel()) {
+		pr_err("Can't kexec: CPUs are stuck in the kernel.\n");
+		return -EBUSY;
 	}
 
 	return 0;

arch/arm64/kernel/machine_kexec.c void machine_kexec(struct kimage *kimage) · line 154

Quoted 8 lines
arch/arm64/kernel/machine_kexec.c +1 -1
@@ -163,7 +148,7 @@ void machine_kexec(struct kimage *kimage)
 	/*
 	 * 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));
 
 	reboot_code_buffer_phys = page_to_phys(kimage->control_code_page);
 	reboot_code_buffer = phys_to_virt(reboot_code_buffer_phys);

Yes, that's what I meant, thanks Catalin.

The 'num_online_cpus() > 1' is still needed as disable_nonboot_cpus() called via machine_shutdown() may have failed and this is where we check. (we can't return an error from either path).

Geoff, I assume you agree?

Thanks,

James

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#10 lore raw

Re: [PATCH v20 04/14] arm64/kexec: Add core kexec support

Hi,

Quoted 14 lines · James Morse

Review void machine_kexec(struct kimage *kimage) · line 154

Quoted 10 lines · Catalin Marinas
(quoted diff) +1 -1
@@ -163,7 +148,7 @@ void machine_kexec(struct kimage *kimage)
 > > 	> > /*
 > > 	> >  * 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));
 
 > > 	> > reboot_code_buffer_phys = page_to_phys(kimage->control_code_page);
 > > 	> > reboot_code_buffer = phys_to_virt(reboot_code_buffer_phys);

Yes, that's what I meant, thanks Catalin.

Quoted 5 lines

The 'num_online_cpus() > 1' is still needed as disable_nonboot_cpus() called via machine_shutdown() may have failed and this is where we check. (we can't return an error from either path).

Geoff, I assume you agree?

Yes, we should do a final check, and abort the reboot if if we have more than a single cpu running.

-Geoff

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#11 lore raw

PATCH v20 5/14 arm64/kexec: Enable kexec in the arm64 defconfig

In reply to Geoff Levand
---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
index fd2d74d..4ed4756 100644
@@ -70,6 +70,7 @@ CONFIG_KSM=y
 CONFIG_TRANSPARENT_HUGEPAGE=y
 CONFIG_CMA=y
 CONFIG_XEN=y
+CONFIG_KEXEC=y
 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
 CONFIG_COMPAT=y
 CONFIG_CPU_IDLE=y
Signature · 8 lines
2.5.0



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#12 lore raw

PATCH v20 6/14 arm64/kexec: Add pr_debug output

In reply to Geoff Levand

To aid in debugging kexec problems or when adding new functionality to kexec add a new routine kexec_image_info() and several inline pr_debug statements.

---
 arch/arm64/kernel/machine_kexec.c | 42 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
arch/arm64/kernel/machine_kexec.c +42 -0
index e2904c4..945ce32 100644
@@ -24,6 +24,32 @@ extern const unsigned long arm64_relocate_new_kernel_size;
 
 static unsigned long kimage_start;
 
+/**
+ * kexec_image_info - For debugging output.
+ */
+#define kexec_image_info(_i) _kexec_image_info(__func__, __LINE__, _i)
+static void _kexec_image_info(const char *func, int line,
+	const struct kimage *kimage)
+{
+	unsigned long i;
+
+	pr_debug("%s:%d:\n", func, line);
+	pr_debug("  kexec kimage info:\n");
+	pr_debug("    type:        %d\n", kimage->type);
+	pr_debug("    start:       %lx\n", kimage->start);
+	pr_debug("    head:        %lx\n", kimage->head);
+	pr_debug("    nr_segments: %lu\n", kimage->nr_segments);
+
+	for (i = 0; i < kimage->nr_segments; i++) {
+		pr_debug("      segment[%lu]: %016lx - %016lx, 0x%lx bytes, %lu pages\n",
+			i,
+			kimage->segment[i].mem,
+			kimage->segment[i].mem + kimage->segment[i].memsz,
+			kimage->segment[i].memsz,
+			kimage->segment[i].memsz /  PAGE_SIZE);
+	}
+}
+
 void machine_kexec_cleanup(struct kimage *kimage)
 {
 	/* Empty routine needed to avoid build errors. */
@@ -40,6 +66,8 @@ int machine_kexec_prepare(struct kimage *kimage)
 {
 	kimage_start = kimage->start;
 
+	kexec_image_info(kimage);
+
 	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");
@@ -140,6 +168,20 @@ void machine_kexec(struct kimage *kimage)
 	reboot_code_buffer_phys = page_to_phys(kimage->control_code_page);
 	reboot_code_buffer = phys_to_virt(reboot_code_buffer_phys);
 
+	kexec_image_info(kimage);
+
+	pr_debug("%s:%d: control_code_page:        %p\n", __func__, __LINE__,
+		kimage->control_code_page);
+	pr_debug("%s:%d: reboot_code_buffer_phys:  %pa\n", __func__, __LINE__,
+		&reboot_code_buffer_phys);
+	pr_debug("%s:%d: reboot_code_buffer:       %p\n", __func__, __LINE__,
+		reboot_code_buffer);
+	pr_debug("%s:%d: relocate_new_kernel:      %p\n", __func__, __LINE__,
+		arm64_relocate_new_kernel);
+	pr_debug("%s:%d: relocate_new_kernel_size: 0x%lx(%lu) bytes\n",
+		__func__, __LINE__, arm64_relocate_new_kernel_size,
+		arm64_relocate_new_kernel_size);
+
 	/*
 	 * Copy arm64_relocate_new_kernel to the reboot_code_buffer for use
 	 * after the kernel is shut down.
Signature · 8 lines
2.5.0



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#13 lore raw

PATCH v20 7/14 arm64: kdump: reserve memory for crash dump kernel

In reply to Geoff Levand

From: AKASHI Takahiro <[email protected]>

On the startup of primary kernel, the memory region used by crash dump kernel must be specified by "crashkernel=" kernel parameter. reserve_crashkernel() will allocate and reserve the region for later use.

User space tools, like kexec-tools, will be able to find that region marked as "Crash kernel" in /proc/iomem.

---
 arch/arm64/kernel/setup.c |  7 +++++-
 arch/arm64/mm/init.c      | 62 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+), 1 deletion(-)
arch/arm64/kernel/setup.c +6 -1
index 3279def..e411957 100644
@@ -31,7 +31,6 @@
 #include <linux/screen_info.h>
 #include <linux/init.h>
 #include <linux/kexec.h>
-#include <linux/crash_dump.h>
 #include <linux/root_dev.h>
 #include <linux/cpu.h>
 #include <linux/interrupt.h>
@@ -222,6 +221,12 @@ static void __init request_standard_resources(void)
 		    kernel_data.end <= res->end)
 			request_resource(res, &kernel_data);
 	}
+
+#ifdef CONFIG_KEXEC_CORE
+	/* User space tools will find "Crash kernel" region in /proc/iomem. */
+	if (crashk_res.end)
+		insert_resource(&iomem_resource, &crashk_res);
+#endif
 }
 
 u64 __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = INVALID_HWID };
arch/arm64/mm/init.c +62 -0

80 lines not on this page · raw message

Signature · 8 lines
2.5.0



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#14 lore raw

PATCH v20 8/14 arm64: limit memory regions based on DT property, usable-memory

In reply to Geoff Levand

From: AKASHI Takahiro <[email protected]>

Crash dump kernel will be run with a limited range of memory as System RAM.

On arm64, we will use a device-tree property under /chosen,
linux,usable-memory = <BASE SIZE>
in order for primary kernel either on uefi or non-uefi (device tree only) system to hand over the information about usable memory region to crash dump kernel. This property will supercede entries in uefi memory map table and "memory" nodes in a device tree.

---
 arch/arm64/mm/init.c | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
arch/arm64/mm/init.c +38 -0
index c948292..22e7bcf 100644
@@ -249,10 +249,48 @@ static int __init early_mem(char *p)
 }
 early_param("mem", early_mem);
 
+static int __init early_init_dt_scan_usablemem(unsigned long node,
+		const char *uname, int depth, void *data)
+{
+	struct memblock_region *usablemem = (struct memblock_region *)data;
+	const __be32 *reg;
+	int len;
+
+	usablemem->size = 0;
+
+	if (depth != 1 || strcmp(uname, "chosen") != 0)
+		return 0;
+
+	reg = of_get_flat_dt_prop(node, "linux,usable-memory", &len);
+	if (!reg || (len < (dt_root_addr_cells + dt_root_size_cells)))
+		return 1;
+
+	usablemem->base = dt_mem_next_cell(dt_root_addr_cells, &reg);
+	usablemem->size = dt_mem_next_cell(dt_root_size_cells, &reg);
+
+	return 1;
+}
+
+static void __init fdt_enforce_memory_region(void)
+{
+	struct memblock_region reg;
+
+	of_scan_flat_dt(early_init_dt_scan_usablemem, &reg);
+
+	if (reg.size) {
+		memblock_remove(0, PAGE_ALIGN(reg.base));
+		memblock_remove(round_down(reg.base + reg.size, PAGE_SIZE),
+				ULLONG_MAX);
+	}
+}
+
 void __init arm64_memblock_init(void)
 {
 	const s64 linear_region_size = -(s64)PAGE_OFFSET;
 
+	/* Handle linux,usable-memory property */
+	fdt_enforce_memory_region();
+
 	/*
 	 * Ensure that the linear region takes up exactly half of the kernel
 	 * virtual address space. This way, we can distinguish a linear address
Signature · 8 lines
2.5.0



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#15 lore raw

PATCH v20 9/14 arm64: kdump: implement machine_crash_shutdown()

In reply to Geoff Levand

From: AKASHI Takahiro <[email protected]>

Primary kernel calls machine_crash_shutdown() to shut down non-boot cpus and save registers' status in per-cpu ELF notes before starting crash dump kernel. See kernel_kexec().
Even if not all secondary cpus have shut down, we do kdump anyway.

As we don't have to make non-boot(crashed) cpus offline (to preserve correct status of cpus at crash dump) before shutting down, this patch also adds a variant of smp_send_stop().

---
 arch/arm64/include/asm/hardirq.h  |  2 +-
 arch/arm64/include/asm/kexec.h    | 41 +++++++++++++++++++++++++-
 arch/arm64/include/asm/smp.h      |  4 +++
 arch/arm64/kernel/machine_kexec.c | 56 +++++++++++++++++++++++++++++++++--
 arch/arm64/kernel/smp.c           | 61 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 159 insertions(+), 5 deletions(-)
arch/arm64/include/asm/hardirq.h +1 -1
index 8740297..1473fc2 100644
@@ -20,7 +20,7 @@
 #include <linux/threads.h>
 #include <asm/irq.h>
 
-#define NR_IPI	6
+#define NR_IPI	7
 
 typedef struct {
 	unsigned int __softirq_pending;
arch/arm64/include/asm/kexec.h +40 -1

47 lines not on this page · raw message

arch/arm64/include/asm/smp.h +4 -0
index 0226447..6af76f59 100644
@@ -136,6 +136,10 @@ static inline void cpu_panic_kernel(void)
  */
 bool cpus_are_stuck_in_kernel(void);
 
+#ifdef CONFIG_KEXEC_CORE
+extern void smp_send_crash_stop(void);
+#endif
+
 #endif /* ifndef __ASSEMBLY__ */
 
 #endif /* ifndef __ASM_SMP_H */
arch/arm64/kernel/machine_kexec.c +53 -3

85 lines not on this page · raw message

arch/arm64/kernel/smp.c +61 -0

97 lines not on this page · raw message

Signature · 8 lines
2.5.0



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#16 lore raw

PATCH v20 10/14 arm64: kdump: add kdump support

In reply to Geoff Levand

From: AKASHI Takahiro <[email protected]>

On crash dump kernel, all the information about primary kernel's system memory (core image) is available in elf core header.
The primary kernel will set aside this header with reserve_elfcorehdr() at boot time and inform crash dump kernel of its location via a new device-tree property, "linux,elfcorehdr".

Please note that all other architectures use traditional "elfcorehdr=" kernel parameter for this purpose.

Then crash dump kernel will access the primary kernel's memory with copy_oldmem_page(), which reads one page by ioremap'ing it since it does not reside in linear mapping on crash dump kernel.

We also need our own elfcorehdr_read() here since the header is placed within crash dump kernel's usable memory.

---
 arch/arm64/Kconfig             | 11 +++++++
 arch/arm64/kernel/Makefile     |  1 +
 arch/arm64/kernel/crash_dump.c | 71 ++++++++++++++++++++++++++++++++++++++++++
 arch/arm64/mm/init.c           | 54 ++++++++++++++++++++++++++++++++
 4 files changed, 137 insertions(+)
 create mode 100644 arch/arm64/kernel/crash_dump.c
arch/arm64/Kconfig +11 -0
index 330786d..b5e0eb4 100644
@@ -674,6 +674,17 @@ config KEXEC
 	  but it is independent of the system firmware.   And like a reboot
 	  you can start any kernel with it, not just Linux.
 
+config CRASH_DUMP
+	bool "Build kdump crash kernel"
+	help
+	  Generate crash dump after being started by kexec. This should
+	  be normally only set in special crash dump kernels which are
+	  loaded in the main kernel with kexec-tools into a specially
+	  reserved region and then later executed after a crash by
+	  kdump/kexec.
+
+	  For more details see Documentation/kdump/kdump.txt
+
 config XEN_DOM0
 	def_bool y
 	depends on XEN
arch/arm64/kernel/Makefile +1 -0
index 7700c0c..c13d3eb 100644
@@ -48,6 +48,7 @@ arm64-obj-$(CONFIG_RANDOMIZE_BASE)	+= kaslr.o
 arm64-obj-$(CONFIG_HIBERNATION)		+= hibernate.o hibernate-asm.o
 arm64-obj-$(CONFIG_KEXEC)		+= machine_kexec.o relocate_kernel.o	\
 					   cpu-reset.o
+arm64-obj-$(CONFIG_CRASH_DUMP)		+= crash_dump.o
 
 obj-y					+= $(arm64-obj-y) vdso/
 obj-m					+= $(arm64-obj-m)
arch/arm64/kernel/crash_dump.c new file +71 -0

71 lines not on this page · raw message

arch/arm64/mm/init.c +54 -0

72 lines not on this page · raw message

Signature · 8 lines
2.5.0



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#17 lore raw

PATCH v20 11/14 arm64: kdump: add VMCOREINFO's for user-space coredump tools

In reply to Geoff Levand

From: AKASHI Takahiro <[email protected]>

For the current crash utility, we need to know, at least,
- kimage_voffset
- PHYS_OFFSET
to handle the contents of core dump file (/proc/vmcore) correctly due to the introduction of KASLR (CONFIG_RANDOMIZE_BASE) in v4.6. This patch puts them as VMCOREINFO's into the file.

- VA_BITS
is also added for makedumpfile command.
More VMCOREINFO's may be added later.

---
 arch/arm64/kernel/machine_kexec.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm64/kernel/machine_kexec.c +11 -0
index 1f75187..413fb14 100644
@@ -17,6 +17,7 @@
 
 #include <asm/cacheflush.h>
 #include <asm/cpu_ops.h>
+#include <asm/memory.h>
 #include <asm/mmu_context.h>
 
 #include "cpu-reset.h"
@@ -275,3 +276,13 @@ void machine_crash_shutdown(struct pt_regs *regs)
 
 	pr_info("Starting crashdump kernel...\n");
 }
+
+void arch_crash_save_vmcoreinfo(void)
+{
+	VMCOREINFO_NUMBER(VA_BITS);
+	/* Please note VMCOREINFO_NUMBER() uses "%d", not "%x" */
+	vmcoreinfo_append_str("NUMBER(kimage_voffset)=0x%llx\n",
+						kimage_voffset);
+	vmcoreinfo_append_str("NUMBER(PHYS_OFFSET)=0x%llx\n",
+						PHYS_OFFSET);
+}
Signature · 8 lines
2.5.0



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#18 lore raw

PATCH v20 12/14 arm64: kdump: enable kdump in the arm64 defconfig

In reply to Geoff Levand

From: AKASHI Takahiro <[email protected]>

---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
index 4ed4756..aa3e1dd 100644
@@ -71,6 +71,7 @@ CONFIG_TRANSPARENT_HUGEPAGE=y
 CONFIG_CMA=y
 CONFIG_XEN=y
 CONFIG_KEXEC=y
+CONFIG_CRASH_DUMP=y
 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
 CONFIG_COMPAT=y
 CONFIG_CPU_IDLE=y
Signature · 8 lines
2.5.0



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#19 lore raw

PATCH v20 13/14 arm64: kdump: update a kernel doc

In reply to Geoff Levand

From: AKASHI Takahiro <[email protected]>

This patch adds arch specific descriptions about kdump usage on arm64 to kdump.txt.

---
 Documentation/kdump/kdump.txt | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
Documentation/kdump/kdump.txt +14 -1
index 88ff63d..5d6da09 100644
@@ -18,7 +18,7 @@ memory image to a dump file on the local disk, or across the network to
 a remote system.
 
 Kdump and kexec are currently supported on the x86, x86_64, ppc64, ia64,
-s390x and arm architectures.
+s390x, arm and arm64 architectures.
 
 When the system kernel boots, it reserves a small section of memory for
 the dump-capture kernel. This ensures that ongoing Direct Memory Access
@@ -249,6 +249,12 @@ Dump-capture kernel config options (Arch Dependent, arm)
 
     AUTO_ZRELADDR=y
 
+Dump-capture kernel config options (Arch Dependent, arm64)
+----------------------------------------------------------
+
+1) Currently, kvm will not be enabled on the dump-capture kernel even
+   if it is configured.
+
 Extended crashkernel syntax
 ===========================
 
@@ -305,6 +311,8 @@ Boot into System Kernel
    kernel will automatically locate the crash kernel image within the
    first 512MB of RAM if X is not given.
 
+   On arm64, use "crashkernel=Y[@X]".  Note that the start address of
+   the kernel, X if explicitly specified, must be aligned to 2MiB (0x200000).
 
 Load the Dump-capture Kernel
 ============================
@@ -327,6 +335,8 @@ For s390x:
 	- Use image or bzImage
 For arm:
 	- Use zImage
+For arm64:
+	- Use vmlinux or Image
 
 If you are using a uncompressed vmlinux image then use following command
 to load dump-capture kernel.
@@ -370,6 +380,9 @@ For s390x:
 For arm:
 	"1 maxcpus=1 reset_devices"
 
+For arm64:
+	"1 maxcpus=1 reset_devices"
+
 Notes on loading the dump-capture kernel:
 
 * By default, the ELF headers are stored in ELF64 format to support
Signature · 8 lines
2.5.0



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#20 lore raw

Re: [PATCH v20 13/14] arm64: kdump: update a kernel doc

Quoted 37 lines · Geoff Levand

From: AKASHI Takahiro <[email protected]>

This patch adds arch specific descriptions about kdump usage on arm64 to kdump.txt.

---
 Documentation/kdump/kdump.txt | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
Documentation/kdump/kdump.txt +7 -1
index 88ff63d..5d6da09 100644
@@ -18,7 +18,7 @@ memory image to a dump file on the local disk, or across the network to
 a remote system.
 
 Kdump and kexec are currently supported on the x86, x86_64, ppc64, ia64,
-s390x and arm architectures.
+s390x, arm and arm64 architectures.
 
 When the system kernel boots, it reserves a small section of memory for
 the dump-capture kernel. This ensures that ongoing Direct Memory Access
@@ -249,6 +249,12 @@ Dump-capture kernel config options (Arch Dependent, arm)
 
     AUTO_ZRELADDR=y
 
+Dump-capture kernel config options (Arch Dependent, arm64)
+----------------------------------------------------------
+
+1) Currently, kvm will not be enabled on the dump-capture kernel even
+   if it is configured.
+
 Extended crashkernel syntax
 ===========================
 

Documentation/kdump/kdump.txt Boot into System Kernel · line 314

Quoted 4 lines
Documentation/kdump/kdump.txt +1 -0
@@ -305,6 +311,8 @@ Boot into System Kernel
    kernel will automatically locate the crash kernel image within the
    first 512MB of RAM if X is not given.
 
+   On arm64, use "crashkernel=Y[@X]".  Note that the start address of

~ Why square brackets here, is it
different than other arch?

Except for this, it looks good to me.

Thanks
Baoquan

Quoted 32 lines
Documentation/kdump/kdump.txt +6 -0
+   the kernel, X if explicitly specified, must be aligned to 2MiB (0x200000).
 
 Load the Dump-capture Kernel
 ============================
@@ -327,6 +335,8 @@ For s390x:
 	- Use image or bzImage
 For arm:
 	- Use zImage
+For arm64:
+	- Use vmlinux or Image
 
 If you are using a uncompressed vmlinux image then use following command
 to load dump-capture kernel.
@@ -370,6 +380,9 @@ For s390x:
 For arm:
 	"1 maxcpus=1 reset_devices"
 
+For arm64:
+	"1 maxcpus=1 reset_devices"
+
 Notes on loading the dump-capture kernel:
 
 * By default, the ELF headers are stored in ELF64 format to support
Signature · 8 lines
2.5.0



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#21 lore raw

Re: [PATCH v20 13/14] arm64: kdump: update a kernel doc

Dave, Boaquan,

Thank you for your reviewing.

Quoted 37 lines · Baoquan He
Quoted 36 lines · Geoff Levand

From: AKASHI Takahiro <[email protected]>

This patch adds arch specific descriptions about kdump usage on arm64 to kdump.txt.

---
 Documentation/kdump/kdump.txt | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
Documentation/kdump/kdump.txt +7 -1
index 88ff63d..5d6da09 100644
@@ -18,7 +18,7 @@ memory image to a dump file on the local disk, or across the network to
 a remote system.
 
 Kdump and kexec are currently supported on the x86, x86_64, ppc64, ia64,
-s390x and arm architectures.
+s390x, arm and arm64 architectures.
 
 When the system kernel boots, it reserves a small section of memory for
 the dump-capture kernel. This ensures that ongoing Direct Memory Access
@@ -249,6 +249,12 @@ Dump-capture kernel config options (Arch Dependent, arm)
 
     AUTO_ZRELADDR=y
 
+Dump-capture kernel config options (Arch Dependent, arm64)
+----------------------------------------------------------
+
+1) Currently, kvm will not be enabled on the dump-capture kernel even
+   if it is configured.
+
 Extended crashkernel syntax
 ===========================
 
Quoted 7 lines

Documentation/kdump/kdump.txt Boot into System Kernel · line 314

Quoted 5 lines
Documentation/kdump/kdump.txt +1 -0
@@ -305,6 +311,8 @@ Boot into System Kernel
    kernel will automatically locate the crash kernel image within the
    first 512MB of RAM if X is not given.
 
+   On arm64, use "crashkernel=Y[@X]".  Note that the start address of

~ Why square brackets here, is it
different than other arch?

I want to clearly indicate that "@X" is optional, and that, when you explicitly specify it, X must be properly aligned.
I think that "[..]" notation is quite common.

Thanks,
-Takahiro AKASHI

Quoted 34 lines

Except for this, it looks good to me.

Thanks
Baoquan

Quoted 28 lines
Documentation/kdump/kdump.txt +6 -0
+   the kernel, X if explicitly specified, must be aligned to 2MiB (0x200000).
 
 Load the Dump-capture Kernel
 ============================
@@ -327,6 +335,8 @@ For s390x:
 	- Use image or bzImage
 For arm:
 	- Use zImage
+For arm64:
+	- Use vmlinux or Image
 
 If you are using a uncompressed vmlinux image then use following command
 to load dump-capture kernel.
@@ -370,6 +380,9 @@ For s390x:
 For arm:
 	"1 maxcpus=1 reset_devices"
 
+For arm64:
+	"1 maxcpus=1 reset_devices"
+
 Notes on loading the dump-capture kernel:
 
 * By default, the ELF headers are stored in ELF64 format to support
Signature · 1 line
2.5.0
Quoted 4 lines
Quoted 4 lines

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#22 lore raw

Re: [PATCH v20 13/14] arm64: kdump: update a kernel doc

Quoted 31 lines · AKASHI Takahiro

Dave, Boaquan,

Thank you for your reviewing.

Quoted 26 lines · Baoquan He
Quoted 25 lines · Geoff Levand

From: AKASHI Takahiro <[email protected]>

This patch adds arch specific descriptions about kdump usage on arm64 to kdump.txt.

---
 Documentation/kdump/kdump.txt | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
Documentation/kdump/kdump.txt +1 -1
index 88ff63d..5d6da09 100644
@@ -18,7 +18,7 @@ memory image to a dump file on the local disk, or across the network to
 a remote system.
 
 Kdump and kexec are currently supported on the x86, x86_64, ppc64, ia64,
-s390x and arm architectures.
+s390x, arm and arm64 architectures.
 
 When the system kernel boots, it reserves a small section of memory for
 the dump-capture kernel. This ensures that ongoing Direct Memory Access
@@ -249,6 +249,12 @@ Dump-capture kernel config options (Arch Dependent, arm)
 
Quoted 7 lines
Quoted 7 lines

Documentation/kdump/kdump.txt Dump-capture kernel config options (Arch Dependent, arm) · line 256

Quoted 7 lines
Documentation/kdump/kdump.txt +5 -0
     AUTO_ZRELADDR=y
 
+Dump-capture kernel config options (Arch Dependent, arm64)
+----------------------------------------------------------
+
+1) Currently, kvm will not be enabled on the dump-capture kernel even
+   if it is configured.

And here, could you say more about it?

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Documentation/kdump/kdump.txt +1 -0
+
 Extended crashkernel syntax
 ===========================
 
@@ -305,6 +311,8 @@ Boot into System Kernel
    kernel will automatically locate the crash kernel image within the
    first 512MB of RAM if X is not given.
 
Quoted 7 lines
Quoted 3 lines

Documentation/kdump/kdump.txt Boot into System Kernel · line 314

Quoted 1 line
Documentation/kdump/kdump.txt +1 -0
+   On arm64, use "crashkernel=Y[@X]".  Note that the start address of

~ Why square brackets here, is it
different than other arch?

I want to clearly indicate that "@X" is optional, and that, when you explicitly specify it, X must be properly aligned.
I think that "[..]" notation is quite common.

Yes, I see that. Just that has been noted in "Extended crashkernel syntax" section, and adding "[]" is not consistent with other places where "crashkernel=Y@X" is referred to in this section. Just feel it's a little redundent. Anyway it's not very critical, and Dave has acked it, I am fine if you want to keep it.

Thanks
Baoquan

Quoted 38 lines

Thanks,
-Takahiro AKASHI

Quoted 34 lines

Except for this, it looks good to me.

Thanks
Baoquan

Quoted 28 lines
Documentation/kdump/kdump.txt +6 -0
+   the kernel, X if explicitly specified, must be aligned to 2MiB (0x200000).
 
 Load the Dump-capture Kernel
 ============================
@@ -327,6 +335,8 @@ For s390x:
 	- Use image or bzImage
 For arm:
 	- Use zImage
+For arm64:
+	- Use vmlinux or Image
 
 If you are using a uncompressed vmlinux image then use following command
 to load dump-capture kernel.
@@ -370,6 +380,9 @@ For s390x:
 For arm:
 	"1 maxcpus=1 reset_devices"
 
+For arm64:
+	"1 maxcpus=1 reset_devices"
+
 Notes on loading the dump-capture kernel:
 
 * By default, the ELF headers are stored in ELF64 format to support
Signature · 1 line
2.5.0
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#23 lore raw

Re: [PATCH v20 13/14] arm64: kdump: update a kernel doc

Baoquan,

Quoted 34 lines · Baoquan He
Quoted 33 lines · AKASHI Takahiro

Dave, Boaquan,

Thank you for your reviewing.

Quoted 28 lines · Baoquan He
Quoted 27 lines · Geoff Levand

From: AKASHI Takahiro <[email protected]>

This patch adds arch specific descriptions about kdump usage on arm64 to kdump.txt.

---
 Documentation/kdump/kdump.txt | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
Documentation/kdump/kdump.txt +1 -1
index 88ff63d..5d6da09 100644
@@ -18,7 +18,7 @@ memory image to a dump file on the local disk, or across the network to
 a remote system.
 
 Kdump and kexec are currently supported on the x86, x86_64, ppc64, ia64,
-s390x and arm architectures.
+s390x, arm and arm64 architectures.
 
 When the system kernel boots, it reserves a small section of memory for
 the dump-capture kernel. This ensures that ongoing Direct Memory Access
@@ -249,6 +249,12 @@ Dump-capture kernel config options (Arch Dependent, arm)
 
     AUTO_ZRELADDR=y
 
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines

Documentation/kdump/kdump.txt Dump-capture kernel config options (Arch Dependent, arm) · line 256

Quoted 5 lines
Documentation/kdump/kdump.txt +5 -0
+Dump-capture kernel config options (Arch Dependent, arm64)
+----------------------------------------------------------
+
+1) Currently, kvm will not be enabled on the dump-capture kernel even
+   if it is configured.

And here, could you say more about it?

On non-VHE (Virtualization Host Environment) system, the kernel, which normally runs in EL1 mode, must be started in EL2 mode to enable kvm, but the current code uses cpu pm notifier to reset CPU state to EL2 and we have no chance to do that on panic.

I will clarify this in kdump.txt.

Quoted 16 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Documentation/kdump/kdump.txt +1 -0
+
 Extended crashkernel syntax
 ===========================
 
@@ -305,6 +311,8 @@ Boot into System Kernel
    kernel will automatically locate the crash kernel image within the
    first 512MB of RAM if X is not given.
 
Quoted 7 lines
Quoted 3 lines

Documentation/kdump/kdump.txt Boot into System Kernel · line 314

Quoted 1 line
Documentation/kdump/kdump.txt +1 -0
+   On arm64, use "crashkernel=Y[@X]".  Note that the start address of

~ Why square brackets here, is it
different than other arch?

I want to clearly indicate that "@X" is optional, and that, when you explicitly specify it, X must be properly aligned.
I think that "[..]" notation is quite common.

Quoted 5 lines

Yes, I see that. Just that has been noted in "Extended crashkernel syntax" section, and adding "[]" is not consistent with other places where "crashkernel=Y@X" is referred to in this section. Just feel it's a little redundent. Anyway it's not very critical, and Dave has acked it, I am fine if you want to keep it.

Thanks,
-Takahiro AKASHI

Quoted 41 lines

Thanks
Baoquan

Quoted 38 lines

Thanks,
-Takahiro AKASHI

Quoted 34 lines

Except for this, it looks good to me.

Thanks
Baoquan

Quoted 28 lines
Documentation/kdump/kdump.txt +6 -0
+   the kernel, X if explicitly specified, must be aligned to 2MiB (0x200000).
 
 Load the Dump-capture Kernel
 ============================
@@ -327,6 +335,8 @@ For s390x:
 	- Use image or bzImage
 For arm:
 	- Use zImage
+For arm64:
+	- Use vmlinux or Image
 
 If you are using a uncompressed vmlinux image then use following command
 to load dump-capture kernel.
@@ -370,6 +380,9 @@ For s390x:
 For arm:
 	"1 maxcpus=1 reset_devices"
 
+For arm64:
+	"1 maxcpus=1 reset_devices"
+
 Notes on loading the dump-capture kernel:
 
 * By default, the ELF headers are stored in ELF64 format to support
Signature · 1 line
2.5.0
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Acked-by on v20 13/14
#24 lore raw

Re: [PATCH v20 13/14] arm64: kdump: update a kernel doc

In reply to Geoff Levand
Quoted 55 lines · Geoff Levand

From: AKASHI Takahiro <[email protected]>

This patch adds arch specific descriptions about kdump usage on arm64 to kdump.txt.

---
 Documentation/kdump/kdump.txt | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
Documentation/kdump/kdump.txt +11 -1
index 88ff63d..5d6da09 100644
@@ -18,7 +18,7 @@ memory image to a dump file on the local disk, or across the network to
 a remote system.
 
 Kdump and kexec are currently supported on the x86, x86_64, ppc64, ia64,
-s390x and arm architectures.
+s390x, arm and arm64 architectures.
 
 When the system kernel boots, it reserves a small section of memory for
 the dump-capture kernel. This ensures that ongoing Direct Memory Access
@@ -249,6 +249,12 @@ Dump-capture kernel config options (Arch Dependent, arm)
 
     AUTO_ZRELADDR=y
 
+Dump-capture kernel config options (Arch Dependent, arm64)
+----------------------------------------------------------
+
+1) Currently, kvm will not be enabled on the dump-capture kernel even
+   if it is configured.
+
 Extended crashkernel syntax
 ===========================
 
@@ -305,6 +311,8 @@ Boot into System Kernel
    kernel will automatically locate the crash kernel image within the
    first 512MB of RAM if X is not given.
 
+   On arm64, use "crashkernel=Y[@X]".  Note that the start address of
+   the kernel, X if explicitly specified, must be aligned to 2MiB (0x200000).
 
 Load the Dump-capture Kernel
 ============================
@@ -327,6 +335,8 @@ For s390x:
 	- Use image or bzImage
 For arm:
 	- Use zImage
+For arm64:
+	- Use vmlinux or Image
 
 If you are using a uncompressed vmlinux image then use following command
 to load dump-capture kernel.

Documentation/kdump/kdump.txt For s390x: · line 388

Quoted 9 lines
Documentation/kdump/kdump.txt +3 -0
@@ -370,6 +380,9 @@ For s390x:
 For arm:
 	"1 maxcpus=1 reset_devices"
 
+For arm64:
+	"1 maxcpus=1 reset_devices"
+
 Notes on loading the dump-capture kernel:
 
 * By default, the ELF headers are stored in ELF64 format to support

Looks good to me.

Thanks
Dave

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#25 lore raw

PATCH v20 14/14 Documentation: dt: usable-memory and elfcorehdr nodes for arm64 kexec

In reply to Geoff Levand

From: James Morse <[email protected]>

Add documentation for linux,usable-memory and linux,elfcorehdr chosen nodes used by arm64 kexec to decribe the kdump reserved area, and the elfcorehdr's location within it.

---
 Documentation/devicetree/bindings/chosen.txt | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
Documentation/devicetree/bindings/chosen.txt +28 -0
index 6ae9d82..443f88b 100644
@@ -52,3 +52,31 @@ This property is set (currently only on PowerPC, and only needed on
 book3e) by some versions of kexec-tools to tell the new kernel that it
 is being booted by kexec, as the booting environment may differ (e.g.
 a different secondary CPU release mechanism)
+
+linux,usable-memory
+-------------------
+
+This property is set on PowerPC and arm64 by kexec-tools during kdump
+to tell the crash kernel the base address of its reserved area of memory, and
+the size. e.g.
+
+/ {
+	chosen {
+		linux,usable-memory = <0x9 0xf0000000 0x0 0x10000000>;
+	};
+};
+
+linux,elfcorehdr
+----------------
+
+This property is set (currently only on arm64) by kexec-tools during kdump
+to tell the crash kernel the address and size of the elfcorehdr that describes
+the old kernel's memory as an elf file. This memory must reside within the area
+described by 'linux,usable-memory'. e.g.
+
+/ {
+	chosen {
+		linux,usable-memory = <0x9 0xf0000000 0x0 0x10000000>;
+		linux,elfcorehdr = <0x9 0xfffff000 0x0 0x800>;
+	};
+};
Signature · 7 lines
2.5.0


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#26 lore raw

Re: [PATCH v20 14/14] Documentation: dt: usable-memory and elfcorehdr nodes for arm64 kexec

Hello,

Am Donnerstag, 23 Juni 2016, 17:54:49 schrieb Geoff Levand:

Documentation/devicetree/bindings/chosen.txt This property is set (currently only on PowerPC, and only needed on · line 67

Quoted 12 lines
Documentation/devicetree/bindings/chosen.txt +5 -0
+linux,usable-memory
+-------------------
+
+This property is set on PowerPC and arm64 by kexec-tools during kdump
+to tell the crash kernel the base address of its reserved area of memory,

and +the size. e.g.

Documentation/devicetree/bindings/chosen.txt +6 -0
+
+/ {
+	chosen {
+		linux,usable-memory = <0x9 0xf0000000 0x0 0x10000000>;
+	};
+};

On powerpc, linux,usable-memory isn't in /chosen. It is put by kexec-tools in each /memory node and has the same format as the reg property. During early boot, the kernel goes through the /memory nodes to find usable memory and for each node, if there's a linux,usable-memory property it will use it instead of the reg property to find the ranges of memory it can use (see early_init_dt_scan_memory in drivers/of/fdt.c).

[]'s
Thiago Jung Bauermann
IBM Linux Technology Center

#27 lore raw

Re: [PATCH v20 14/14] Documentation: dt: usable-memory and elfcorehdr nodes for arm64 kexec

Quoted 12 lines · Thiago Jung Bauermann

Am Donnerstag, 23 Juni 2016, 17:54:49 schrieb Geoff Levand:

Quoted 11 lines
Documentation/devicetree/bindings/chosen.txt +5 -0
+linux,usable-memory
+-------------------
+
+This property is set on PowerPC and arm64 by kexec-tools during kdump
+to tell the crash kernel the base address of its reserved area of memory,

and +the size. e.g.

Documentation/devicetree/bindings/chosen.txt +5 -0
+
+/ {
+	chosen {
+		linux,usable-memory = <0x9 0xf0000000 0x0 0x10000000>;
+	};
Quoted 8 lines
Quoted 1 line

+};

On powerpc, linux,usable-memory isn't in /chosen. It is put by kexec-tools in each /memory node and has the same format as the reg property. During early boot, the kernel goes through the /memory nodes to find usable memory and for each node, if there's a linux,usable-memory property it will use it instead of the reg property to find the ranges of memory it can use (see early_init_dt_scan_memory in drivers/of/fdt.c).

Yep that sounds right to me.

Added in:

ba7594852f4e ("[PATCH] powerpc: Add support for "linux,usable-memory" on memory nodes")

cheers

maintainer
#28 lore raw
In reply to Geoff Levand

Hi Geoff,

Quoted 15 lines · Geoff Levand

AKASHI Takahiro (7):
arm64: kdump: reserve memory for crash dump kernel
arm64: limit memory regions based on DT property, usable-memory
arm64: kdump: implement machine_crash_shutdown()
arm64: kdump: add kdump support
arm64: kdump: add VMCOREINFO's for user-space coredump tools
arm64: kdump: enable kdump in the arm64 defconfig
arm64: kdump: update a kernel doc

Geoff Levand (4):
arm64: Add back cpu reset routines arm64/kexec: Add core kexec support arm64/kexec: Enable kexec in the arm64 defconfig arm64/kexec: Add pr_debug output

Quoted 4 lines

James Morse (3):
arm64: hibernate: Don't hibernate on systems with stuck CPUs
arm64: smp: Add function to determine if cpus are stuck in the kernel
Documentation: dt: usable-memory and elfcorehdr nodes for arm64 kexec

I dropped patch 1 (hibernate), cherry-picked patch 2 from mainline ("cpus stuck in the kernel", already pushed by Will to 4.7-rc5) and merged patches 3-6, with the amendments that James mentioned.

The kdump patches, including the "Documentation" one from James require more review, testing and acks by the corresponding maintainers (kdump, DT). You also don't seem to have added a s-o-b for those patches (since you are submitting them; unless you plan to let Akashi-san submit them in the future).

Thanks.

Signature · 6 lines
Catalin

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#29 lore raw

Hi Catalin,

Quoted 25 lines · Catalin Marinas
Quoted 15 lines · Geoff Levand

AKASHI Takahiro (7):
arm64: kdump: reserve memory for crash dump kernel
arm64: limit memory regions based on DT property, usable-memory
arm64: kdump: implement machine_crash_shutdown()
arm64: kdump: add kdump support
arm64: kdump: add VMCOREINFO's for user-space coredump tools
arm64: kdump: enable kdump in the arm64 defconfig
arm64: kdump: update a kernel doc

Geoff Levand (4):
arm64: Add back cpu reset routines arm64/kexec: Add core kexec support arm64/kexec: Enable kexec in the arm64 defconfig arm64/kexec: Add pr_debug output

Quoted 4 lines

James Morse (3):
arm64: hibernate: Don't hibernate on systems with stuck CPUs
arm64: smp: Add function to determine if cpus are stuck in the kernel
Documentation: dt: usable-memory and elfcorehdr nodes for arm64 kexec

I dropped patch 1 (hibernate), cherry-picked patch 2 from mainline ("cpus stuck in the kernel", already pushed by Will to 4.7-rc5) and merged patches 3-6, with the amendments that James mentioned.

Quoted 5 lines

The kdump patches, including the "Documentation" one from James require more review, testing and acks by the corresponding maintainers (kdump, DT). You also don't seem to have added a s-o-b for those patches (since you are submitting them; unless you plan to let Akashi-san submit them in the future).

I'll workout the merge plan for the rest of the patches with Takahiro. If they come through me I'll add an SOB.

Thanks for the review.

-Geoff

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#30 lore raw
In reply to Catalin Marinas

Hi Catalin,

Quoted 23 lines · Catalin Marinas

Hi Geoff,

Quoted 15 lines · Geoff Levand

AKASHI Takahiro (7):
arm64: kdump: reserve memory for crash dump kernel
arm64: limit memory regions based on DT property, usable-memory
arm64: kdump: implement machine_crash_shutdown()
arm64: kdump: add kdump support
arm64: kdump: add VMCOREINFO's for user-space coredump tools
arm64: kdump: enable kdump in the arm64 defconfig
arm64: kdump: update a kernel doc

Geoff Levand (4):
arm64: Add back cpu reset routines arm64/kexec: Add core kexec support arm64/kexec: Enable kexec in the arm64 defconfig arm64/kexec: Add pr_debug output

Quoted 4 lines

James Morse (3):
arm64: hibernate: Don't hibernate on systems with stuck CPUs
arm64: smp: Add function to determine if cpus are stuck in the kernel
Documentation: dt: usable-memory and elfcorehdr nodes for arm64 kexec

Quoted 7 lines

I dropped patch 1 (hibernate), cherry-picked patch 2 from mainline ("cpus stuck in the kernel", already pushed by Will to 4.7-rc5) and merged patches 3-6, with the amendments that James mentioned.

The kdump patches, including the "Documentation" one from James require more review, testing and acks by the corresponding maintainers (kdump, DT).

I see what you mean, but even for Geoff's kexec part, the maintainer (Eric) have not given his ack.

Quoted 3 lines

You also don't seem to have added a s-o-b for those patches (since you are submitting them; unless you plan to let Akashi-san submit them in the future).

Basically Geoff has not reviewed nor tested kdump part, and so I'm not sure that adding his s-o-b is appropriate. Anyhow, I will post my future version of kdump by myself as kexec has been queued in for-next/core.

Thanks,
-Takahiro AKASHI

Quoted 4 lines

Thanks.

Signature · 1 line
Catalin

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

maintainer
#31 lore raw
Quoted 26 lines · AKASHI Takahiro
Quoted 25 lines · Catalin Marinas
Quoted 15 lines · Geoff Levand

AKASHI Takahiro (7):
arm64: kdump: reserve memory for crash dump kernel
arm64: limit memory regions based on DT property, usable-memory
arm64: kdump: implement machine_crash_shutdown()
arm64: kdump: add kdump support
arm64: kdump: add VMCOREINFO's for user-space coredump tools
arm64: kdump: enable kdump in the arm64 defconfig
arm64: kdump: update a kernel doc

Geoff Levand (4):
arm64: Add back cpu reset routines arm64/kexec: Add core kexec support arm64/kexec: Enable kexec in the arm64 defconfig arm64/kexec: Add pr_debug output

Quoted 4 lines

James Morse (3):
arm64: hibernate: Don't hibernate on systems with stuck CPUs
arm64: smp: Add function to determine if cpus are stuck in the kernel
Documentation: dt: usable-memory and elfcorehdr nodes for arm64 kexec

I dropped patch 1 (hibernate), cherry-picked patch 2 from mainline ("cpus stuck in the kernel", already pushed by Will to 4.7-rc5) and merged patches 3-6, with the amendments that James mentioned.

Quoted 6 lines
Quoted 3 lines

The kdump patches, including the "Documentation" one from James require more review, testing and acks by the corresponding maintainers (kdump, DT).

I see what you mean, but even for Geoff's kexec part, the maintainer (Eric) have not given his ack.

I just assumed he won't object ;). The only generic change is the KEXEC_ARCH_AARCH64 in the uapi/linux/kexec.h file and the value chosen matches EM_AARCH64.

The kdump patches make such changes to Documentation and I would like those acked by the kdump and DT maintainers.

Pratyush Anand also had comments on the kdump patches in v19, so it's fair to wait for him to complete the reviewing of the latest series.

Quoted 6 lines
Quoted 3 lines

You also don't seem to have added a s-o-b for those patches (since you are submitting them; unless you plan to let Akashi-san submit them in the future).

Basically Geoff has not reviewed nor tested kdump part, and so I'm not sure that adding his s-o-b is appropriate.

It is appropriate. See the "Developer's Certificate of Origin" in Documentation/SubmittingPatches. A s-o-b from Geoff doesn't necessarily mean that he reviewed the patches but that he has the right to pass them on under the open source license indicated in the file (and AFAICT it is legally binding but IANAL).

Quoted 2 lines

Anyhow, I will post my future version of kdump by myself as kexec has been queued in for-next/core.

Thanks.

Signature · 6 lines
Catalin

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#32 lore raw
Quoted 34 lines · Catalin Marinas
Quoted 26 lines · AKASHI Takahiro
Quoted 25 lines · Catalin Marinas
Quoted 15 lines · Geoff Levand

AKASHI Takahiro (7):
arm64: kdump: reserve memory for crash dump kernel
arm64: limit memory regions based on DT property, usable-memory
arm64: kdump: implement machine_crash_shutdown()
arm64: kdump: add kdump support
arm64: kdump: add VMCOREINFO's for user-space coredump tools
arm64: kdump: enable kdump in the arm64 defconfig
arm64: kdump: update a kernel doc

Geoff Levand (4):
arm64: Add back cpu reset routines arm64/kexec: Add core kexec support arm64/kexec: Enable kexec in the arm64 defconfig arm64/kexec: Add pr_debug output

Quoted 4 lines

James Morse (3):
arm64: hibernate: Don't hibernate on systems with stuck CPUs
arm64: smp: Add function to determine if cpus are stuck in the kernel
Documentation: dt: usable-memory and elfcorehdr nodes for arm64 kexec

I dropped patch 1 (hibernate), cherry-picked patch 2 from mainline ("cpus stuck in the kernel", already pushed by Will to 4.7-rc5) and merged patches 3-6, with the amendments that James mentioned.

Quoted 6 lines
Quoted 3 lines

The kdump patches, including the "Documentation" one from James require more review, testing and acks by the corresponding maintainers (kdump, DT).

I see what you mean, but even for Geoff's kexec part, the maintainer (Eric) have not given his ack.

Quoted 6 lines

I just assumed he won't object ;). The only generic change is the KEXEC_ARCH_AARCH64 in the uapi/linux/kexec.h file and the value chosen matches EM_AARCH64.

The kdump patches make such changes to Documentation and I would like those acked by the kdump and DT maintainers.

OK, I asked the corresponding maintainers to review them.

Quoted 2 lines

Pratyush Anand also had comments on the kdump patches in v19, so it's fair to wait for him to complete the reviewing of the latest series.

I think that it was my mistake that I referred to makedumpfile-related VMCOREINFO's in my patch.
Since I'm not a user nor author of makedumpfile command for arm64, my changes should have been minimized, exluding any non-mandatory symbols. (Patch#13/14 is necessary for me to verify generated vmcore files with crash utility.)
So I asked Pratyush to post his kernel patch based on his own requirements as he wants.
I believe it's fair enough.

Quoted 13 lines
Quoted 6 lines
Quoted 3 lines

You also don't seem to have added a s-o-b for those patches (since you are submitting them; unless you plan to let Akashi-san submit them in the future).

Basically Geoff has not reviewed nor tested kdump part, and so I'm not sure that adding his s-o-b is appropriate.

It is appropriate. See the "Developer's Certificate of Origin" in Documentation/SubmittingPatches. A s-o-b from Geoff doesn't necessarily mean that he reviewed the patches but that he has the right to pass them on under the open source license indicated in the file (and AFAICT it is legally binding but IANAL).

Quoted 4 lines
Quoted 2 lines

Anyhow, I will post my future version of kdump by myself as kexec has been queued in for-next/core.

Thanks.

Since I've got no comments on kdump patches and had no updates so far, I don't plan to post v21 this week (at this point). (I will add "reviewed-by James" to patch#7/14 in future releases.)

Thanks,
-Takahiro AKASHI

Quoted 2 lines
Signature · 1 line
Catalin

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Tested-by
#33 lore raw

Hi Takahiro,

Quoted 47 lines · AKASHI Takahiro
Quoted 34 lines · Catalin Marinas
Quoted 26 lines · AKASHI Takahiro
Quoted 25 lines · Catalin Marinas
Quoted 15 lines · Geoff Levand

AKASHI Takahiro (7):
arm64: kdump: reserve memory for crash dump kernel
arm64: limit memory regions based on DT property, usable-memory
arm64: kdump: implement machine_crash_shutdown()
arm64: kdump: add kdump support
arm64: kdump: add VMCOREINFO's for user-space coredump tools
arm64: kdump: enable kdump in the arm64 defconfig
arm64: kdump: update a kernel doc

Geoff Levand (4):
arm64: Add back cpu reset routines arm64/kexec: Add core kexec support arm64/kexec: Enable kexec in the arm64 defconfig arm64/kexec: Add pr_debug output

Quoted 4 lines

James Morse (3):
arm64: hibernate: Don't hibernate on systems with stuck CPUs
arm64: smp: Add function to determine if cpus are stuck in the kernel
Documentation: dt: usable-memory and elfcorehdr nodes for arm64 kexec

I dropped patch 1 (hibernate), cherry-picked patch 2 from mainline ("cpus stuck in the kernel", already pushed by Will to 4.7-rc5) and merged patches 3-6, with the amendments that James mentioned.

Quoted 6 lines
Quoted 3 lines

The kdump patches, including the "Documentation" one from James require more review, testing and acks by the corresponding maintainers (kdump, DT).

I see what you mean, but even for Geoff's kexec part, the maintainer (Eric) have not given his ack.

Quoted 6 lines

I just assumed he won't object ;). The only generic change is the KEXEC_ARCH_AARCH64 in the uapi/linux/kexec.h file and the value chosen matches EM_AARCH64.

The kdump patches make such changes to Documentation and I would like those acked by the kdump and DT maintainers.

OK, I asked the corresponding maintainers to review them.

Quoted 2 lines

Pratyush Anand also had comments on the kdump patches in v19, so it's fair to wait for him to complete the reviewing of the latest series.

Quoted 9 lines

I think that it was my mistake that I referred to makedumpfile-related VMCOREINFO's in my patch.
Since I'm not a user nor author of makedumpfile command for arm64, my changes should have been minimized, exluding any non-mandatory symbols. (Patch#13/14 is necessary for me to verify generated vmcore files with crash utility.)
So I asked Pratyush to post his kernel patch based on his own requirements as he wants.
I believe it's fair enough.

Sorry for delayed response.
I am agreeing to this patchset. makedumpfile would also be able to work by directly reading page table entries for all virtual addresses.

I have tested this patchset with Mustang and both kexec and kdump works. So, you can add

Thanks for all the work on kexec/kdump.

~Pratyush

Quoted 33 lines
Quoted 14 lines
Quoted 7 lines
Quoted 4 lines

You also don't seem to have added a s-o-b for those patches (since you are submitting them; unless you plan to let Akashi-san submit them in the future).

Basically Geoff has not reviewed nor tested kdump part, and so I'm not sure that adding his s-o-b is appropriate.

It is appropriate. See the "Developer's Certificate of Origin" in Documentation/SubmittingPatches. A s-o-b from Geoff doesn't necessarily mean that he reviewed the patches but that he has the right to pass them on under the open source license indicated in the file (and AFAICT it is legally binding but IANAL).

Quoted 4 lines
Quoted 2 lines

Anyhow, I will post my future version of kdump by myself as kexec has been queued in for-next/core.

Thanks.

Since I've got no comments on kdump patches and had no updates so far, I don't plan to post v21 this week (at this point). (I will add "reviewed-by James" to patch#7/14 in future releases.)

Thanks,
-Takahiro AKASHI

Quoted 2 lines
Signature · 1 line
Catalin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#34 lore raw
Quoted 60 lines · Pratyush Anand

Hi Takahiro,

Quoted 47 lines · AKASHI Takahiro
Quoted 34 lines · Catalin Marinas
Quoted 26 lines · AKASHI Takahiro
Quoted 25 lines · Catalin Marinas
Quoted 15 lines · Geoff Levand

AKASHI Takahiro (7):
arm64: kdump: reserve memory for crash dump kernel
arm64: limit memory regions based on DT property, usable-memory
arm64: kdump: implement machine_crash_shutdown()
arm64: kdump: add kdump support
arm64: kdump: add VMCOREINFO's for user-space coredump tools
arm64: kdump: enable kdump in the arm64 defconfig
arm64: kdump: update a kernel doc

Geoff Levand (4):
arm64: Add back cpu reset routines arm64/kexec: Add core kexec support arm64/kexec: Enable kexec in the arm64 defconfig arm64/kexec: Add pr_debug output

Quoted 4 lines

James Morse (3):
arm64: hibernate: Don't hibernate on systems with stuck CPUs
arm64: smp: Add function to determine if cpus are stuck in the kernel
Documentation: dt: usable-memory and elfcorehdr nodes for arm64 kexec

I dropped patch 1 (hibernate), cherry-picked patch 2 from mainline ("cpus stuck in the kernel", already pushed by Will to 4.7-rc5) and merged patches 3-6, with the amendments that James mentioned.

Quoted 6 lines
Quoted 3 lines

The kdump patches, including the "Documentation" one from James require more review, testing and acks by the corresponding maintainers (kdump, DT).

I see what you mean, but even for Geoff's kexec part, the maintainer (Eric) have not given his ack.

Quoted 6 lines

I just assumed he won't object ;). The only generic change is the KEXEC_ARCH_AARCH64 in the uapi/linux/kexec.h file and the value chosen matches EM_AARCH64.

The kdump patches make such changes to Documentation and I would like those acked by the kdump and DT maintainers.

OK, I asked the corresponding maintainers to review them.

Quoted 2 lines

Pratyush Anand also had comments on the kdump patches in v19, so it's fair to wait for him to complete the reviewing of the latest series.

Quoted 9 lines

I think that it was my mistake that I referred to makedumpfile-related VMCOREINFO's in my patch.
Since I'm not a user nor author of makedumpfile command for arm64, my changes should have been minimized, exluding any non-mandatory symbols. (Patch#13/14 is necessary for me to verify generated vmcore files with crash utility.)
So I asked Pratyush to post his kernel patch based on his own requirements as he wants.
I believe it's fair enough.

Quoted 3 lines

Sorry for delayed response.
I am agreeing to this patchset. makedumpfile would also be able to work by directly reading page table entries for all virtual addresses.

So are you going to add a physical address of swapper_pg_dir? Do you see any visible speed down of makedumpfile?

Quoted 3 lines

I have tested this patchset with Mustang and both kexec and kdump works. So, you can add

Thanks,
-Takahiro AKASHI

Quoted 37 lines

Thanks for all the work on kexec/kdump.

~Pratyush

Quoted 33 lines
Quoted 14 lines
Quoted 7 lines
Quoted 4 lines

You also don't seem to have added a s-o-b for those patches (since you are submitting them; unless you plan to let Akashi-san submit them in the future).

Basically Geoff has not reviewed nor tested kdump part, and so I'm not sure that adding his s-o-b is appropriate.

It is appropriate. See the "Developer's Certificate of Origin" in Documentation/SubmittingPatches. A s-o-b from Geoff doesn't necessarily mean that he reviewed the patches but that he has the right to pass them on under the open source license indicated in the file (and AFAICT it is legally binding but IANAL).

Quoted 4 lines
Quoted 2 lines

Anyhow, I will post my future version of kdump by myself as kexec has been queued in for-next/core.

Thanks.

Since I've got no comments on kdump patches and had no updates so far, I don't plan to post v21 this week (at this point). (I will add "reviewed-by James" to patch#7/14 in future releases.)

Thanks,
-Takahiro AKASHI

Quoted 2 lines
Signature · 1 line
Catalin

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#35 lore raw
Quoted 61 lines · AKASHI Takahiro
Quoted 60 lines · Pratyush Anand

Hi Takahiro,

Quoted 56 lines · AKASHI Takahiro
Quoted 34 lines · Catalin Marinas
Quoted 26 lines · AKASHI Takahiro
Quoted 25 lines · Catalin Marinas
Quoted 15 lines · Geoff Levand

AKASHI Takahiro (7):
arm64: kdump: reserve memory for crash dump kernel
arm64: limit memory regions based on DT property, usable-memory
arm64: kdump: implement machine_crash_shutdown()
arm64: kdump: add kdump support
arm64: kdump: add VMCOREINFO's for user-space coredump tools
arm64: kdump: enable kdump in the arm64 defconfig
arm64: kdump: update a kernel doc

Geoff Levand (4):
arm64: Add back cpu reset routines arm64/kexec: Add core kexec support arm64/kexec: Enable kexec in the arm64 defconfig arm64/kexec: Add pr_debug output

Quoted 4 lines

James Morse (3):
arm64: hibernate: Don't hibernate on systems with stuck CPUs
arm64: smp: Add function to determine if cpus are stuck in the kernel
Documentation: dt: usable-memory and elfcorehdr nodes for arm64 kexec

I dropped patch 1 (hibernate), cherry-picked patch 2 from mainline ("cpus stuck in the kernel", already pushed by Will to 4.7-rc5) and merged patches 3-6, with the amendments that James mentioned.

Quoted 6 lines
Quoted 3 lines

The kdump patches, including the "Documentation" one from James require more review, testing and acks by the corresponding maintainers (kdump, DT).

I see what you mean, but even for Geoff's kexec part, the maintainer (Eric) have not given his ack.

Quoted 6 lines

I just assumed he won't object ;). The only generic change is the KEXEC_ARCH_AARCH64 in the uapi/linux/kexec.h file and the value chosen matches EM_AARCH64.

The kdump patches make such changes to Documentation and I would like those acked by the kdump and DT maintainers.

OK, I asked the corresponding maintainers to review them.

Quoted 2 lines

Pratyush Anand also had comments on the kdump patches in v19, so it's fair to wait for him to complete the reviewing of the latest series.

I think that it was my mistake that I referred to makedumpfile-related VMCOREINFO's in my patch.
Since I'm not a user nor author of makedumpfile command for arm64, my changes should have been minimized, exluding any non-mandatory symbols. (Patch#13/14 is necessary for me to verify generated vmcore files with crash utility.)
So I asked Pratyush to post his kernel patch based on his own requirements as he wants.
I believe it's fair enough.

Quoted 5 lines
Quoted 3 lines

Sorry for delayed response.
I am agreeing to this patchset. makedumpfile would also be able to work by directly reading page table entries for all virtual addresses.

So are you going to add a physical address of swapper_pg_dir?

NO, I think, I can take it for-granted that swapper_pg_dir will always lie in identity mapped region. So, I will use __pa() macro only to translate swapper_pg_dir. Rest all virtual addresses will be translated using page table entries.

Quoted 1 line

Do you see any visible speed down of makedumpfile?

I will take back my comment here. Its almost negligible. About 2 Sec slower when whole dump process took around 2m 44 S.

~Pratyush

#37 lore raw

Hi Simon,

Quoted 3 lines · Simon Horman

I am wondering if you could comment on the kexec-tools patches for kexec on arm64 and if you think it would be appropriate to merge them at this time.

I'm working to clean up my kexec-tools patches now, and should be posting a series that add arm64 reboot within the next few days.

-Geoff

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec