Skip to contentSkip to conversation

kexec: Add option to get crash kernel region size

PATCH In review Daniel Kiper 2 participants 35 messages Dec 8, 2015 – Dec 9, 2015

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

cover kexec: Add option to get crash kernel region size

Crash kernel region size is available via sysfs on Linux running on bare metal. However, this does not work when Linux runs as Xen dom0. In this case Xen crash kernel region size should be established using __HYPERVISOR_kexec_op hypercall (Linux kernel kexec functionality does not make a lot of sense in Xen dom0). Sadly hypercalls are not easily accessible using shell scripts or something like that. Potentially we can check "xl dmesg" output for crashkernel option but this is not nice. So, let's add this functionality, for Linux running on bare metal and as Xen dom0, to kexec-tools. This way kdump scripts may establish crash kernel region size in one way regardless of platform. All burden of platform detection lies on kexec-tools.

Figure (and unit) displayed by this new kexec-tools functionality is the same as one taken from /sys/kernel/kexec_crash_size.

First three patches are fixes and cleanups. The rest provides above described functionality for all supported platforms.

Daniel

 kexec/arch/arm/crashdump-arm.c     |   10 ++++++++++
 kexec/arch/cris/kexec-cris.c       |    5 +++++
 kexec/arch/i386/crashdump-x86.c    |   18 +++++++++++++++++-
 kexec/arch/ia64/crashdump-ia64.c   |   10 ++++++++++
 kexec/arch/m68k/kexec-m68k.c       |    5 +++++
 kexec/arch/mips/crashdump-mips.c   |    9 +++++++++
 kexec/arch/ppc/crashdump-powerpc.c |    4 ++++
 kexec/arch/ppc64/crashdump-ppc64.c |    5 +++++
 kexec/arch/s390/kexec-s390.c       |   10 ++++++++++
 kexec/arch/sh/crashdump-sh.c       |   10 ++++++++++
 kexec/crashdump.h                  |    1 -
 kexec/kexec.8                      |    3 +++
 kexec/kexec.c                      |    6 +++++-
 kexec/kexec.h                      |    5 ++++-
 purgatory/Makefile                 |    2 +-
 15 files changed, 98 insertions(+), 5 deletions(-)

Daniel Kiper (14):
purgatory: Add purgatory.map and purgatory.ro.sym to clean recipe
kexec: Remove redundant space from help message
crashdump: Remove stray get_crashkernel_region() declaration crashdump/x86: Add print_crashkernel_region_size() function crashdump/arm: Add print_crashkernel_region_size() function crashdump/cris: Add print_crashkernel_region_size() function crashdump/ia64: Add print_crashkernel_region_size() function crashdump/m68k: Add print_crashkernel_region_size() function crashdump/mips: Add print_crashkernel_region_size() function crashdump/ppc: Add print_crashkernel_region_size() function crashdump/ppc64: Add print_crashkernel_region_size() function crashdump/s390: Add print_crashkernel_region_size() function crashdump/sh: Add print_crashkernel_region_size() function
kexec: Add option to get crash kernel region size

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

#1 lore raw

PATCH 1/14 purgatory: Add purgatory.map and purgatory.ro.sym to clean recipe

---
 purgatory/Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
purgatory/Makefile +1 -1
index 2b5c061..caea7ea 100644
@@ -33,7 +33,7 @@ PURGATORY_SRCS+=$($(ARCH)_PURGATORY_SRCS)
 PURGATORY_OBJS = $(call objify, $(PURGATORY_SRCS)) purgatory/sha256.o
 PURGATORY_DEPS = $(call depify, $(PURGATORY_OBJS))
 
-clean += $(PURGATORY_OBJS) $(PURGATORY_DEPS) $(PURGATORY)
+clean += $(PURGATORY_OBJS) $(PURGATORY_DEPS) $(PURGATORY) $(PURGATORY_MAP) $(PURGATORY).sym
 
 -include $(PURGATORY_DEPS)
 
Signature · 7 lines
1.7.10.4


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

PATCH 1/14 purgatory: Add purgatory.map and purgatory.ro.sym to clean recipe

In reply to Daniel Kiper
---
 purgatory/Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
purgatory/Makefile +1 -1
index 2b5c061..caea7ea 100644
@@ -33,7 +33,7 @@ PURGATORY_SRCS+=$($(ARCH)_PURGATORY_SRCS)
 PURGATORY_OBJS = $(call objify, $(PURGATORY_SRCS)) purgatory/sha256.o
 PURGATORY_DEPS = $(call depify, $(PURGATORY_OBJS))
 
-clean += $(PURGATORY_OBJS) $(PURGATORY_DEPS) $(PURGATORY)
+clean += $(PURGATORY_OBJS) $(PURGATORY_DEPS) $(PURGATORY) $(PURGATORY_MAP) $(PURGATORY).sym
 
 -include $(PURGATORY_DEPS)
 
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH 2/14 kexec: Remove redundant space from help message

In reply to Daniel Kiper
---
 kexec/kexec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kexec/kexec.c +1 -1
index f0bd527..20dd93d 100644
@@ -969,7 +969,7 @@ void usage(void)
 	       "                      preserve context)\n"
 	       "                      to original kernel.\n"
 	       " -s, --kexec-file-syscall Use file based syscall for kexec operation\n"
-	       " -d, --debug           Enable debugging to help spot a failure.\n"
+	       " -d, --debug          Enable debugging to help spot a failure.\n"
 	       "\n"
 	       "Supported kernel file types and options: \n");
 	for (i = 0; i < file_types; i++) {
Signature · 7 lines
1.7.10.4


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

PATCH 2/14 kexec: Remove redundant space from help message

In reply to Daniel Kiper
---
 kexec/kexec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kexec/kexec.c +1 -1
index f0bd527..20dd93d 100644
@@ -969,7 +969,7 @@ void usage(void)
 	       "                      preserve context)\n"
 	       "                      to original kernel.\n"
 	       " -s, --kexec-file-syscall Use file based syscall for kexec operation\n"
-	       " -d, --debug           Enable debugging to help spot a failure.\n"
+	       " -d, --debug          Enable debugging to help spot a failure.\n"
 	       "\n"
 	       "Supported kernel file types and options: \n");
 	for (i = 0; i < file_types; i++) {
Signature · 1 line
1.7.10.4
#5 lore raw

PATCH 3/14 crashdump: Remove stray get_crashkernel_region() declaration

In reply to Daniel Kiper
---
 kexec/crashdump.h |    1 -
 1 file changed, 1 deletion(-)
kexec/crashdump.h +0 -1
index 95f1f0c..320767b 100644
@@ -1,7 +1,6 @@
 #ifndef CRASHDUMP_H
 #define CRASHDUMP_H
 
-int get_crashkernel_region(uint64_t *start, uint64_t *end);
 extern int get_crash_notes_per_cpu(int cpu, uint64_t *addr, uint64_t *len);
 extern int get_kernel_vmcoreinfo(uint64_t *addr, uint64_t *len);
 extern int get_xen_vmcoreinfo(uint64_t *addr, uint64_t *len);
Signature · 7 lines
1.7.10.4


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

PATCH 3/14 crashdump: Remove stray get_crashkernel_region() declaration

In reply to Daniel Kiper
---
 kexec/crashdump.h |    1 -
 1 file changed, 1 deletion(-)
kexec/crashdump.h +0 -1
index 95f1f0c..320767b 100644
@@ -1,7 +1,6 @@
 #ifndef CRASHDUMP_H
 #define CRASHDUMP_H
 
-int get_crashkernel_region(uint64_t *start, uint64_t *end);
 extern int get_crash_notes_per_cpu(int cpu, uint64_t *addr, uint64_t *len);
 extern int get_kernel_vmcoreinfo(uint64_t *addr, uint64_t *len);
 extern int get_xen_vmcoreinfo(uint64_t *addr, uint64_t *len);
Signature · 1 line
1.7.10.4
#7 lore raw

PATCH 4/14 crashdump/x86: Add print_crashkernel_region_size() function

In reply to Daniel Kiper

Crash kernel region size is available via sysfs on Linux running on bare metal. However, this does not work when Linux runs as Xen dom0. In this case Xen crash kernel region size should be established using __HYPERVISOR_kexec_op hypercall (Linux kernel kexec functionality does not make a lot of sense in Xen dom0). Sadly hypercalls are not easily accessible using shell scripts or something like that. Potentially we can check "xl dmesg" output for crashkernel option but this is not nice. So, let's add this functionality, for Linux running on bare metal and as Xen dom0, to kexec-tools. This way kdump scripts may establish crash kernel region size in one way regardless of platform. All burden of platform detection lies on kexec-tools.

Figure (and unit) displayed by this new kexec-tools functionality is the same as one taken from /sys/kernel/kexec_crash_size.

This patch just adds print_crashkernel_region_size() function, which prints crash kernel region size, for x86 arch. Next patches will add same named function for other archs supported by kexec-tools. Last patch of this series will export this functionality to the userspace via separate kexec utility option.

---
 kexec/arch/i386/crashdump-x86.c |   18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
kexec/arch/i386/crashdump-x86.c +17 -1
index bbc0f35..10a56a8 100644
@@ -1056,7 +1056,7 @@ static int crashkernel_mem_callback(void *UNUSED(data), int nr,
 	return 0;
 }
 
-int is_crashkernel_mem_reserved(void)
+static int get_crashkernel_region(void)
 {
 	int ret;
 
@@ -1079,3 +1079,19 @@ int is_crashkernel_mem_reserved(void)
 
 	return !!crash_reserved_mem_nr;
 }
+
+int is_crashkernel_mem_reserved(void)
+{
+	return get_crashkernel_region();
+}
+
+void print_crashkernel_region_size(void)
+{
+	uint64_t start, end;
+
+	if (get_crashkernel_region()) {
+		get_crash_kernel_load_range(&start, &end);
+		printf("%lu\n", end - start + 1);
+	} else
+		printf("0\n");
+}
Signature · 7 lines
1.7.10.4


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

PATCH 4/14 crashdump/x86: Add print_crashkernel_region_size() function

In reply to Daniel Kiper

Crash kernel region size is available via sysfs on Linux running on bare metal. However, this does not work when Linux runs as Xen dom0. In this case Xen crash kernel region size should be established using __HYPERVISOR_kexec_op hypercall (Linux kernel kexec functionality does not make a lot of sense in Xen dom0). Sadly hypercalls are not easily accessible using shell scripts or something like that. Potentially we can check "xl dmesg" output for crashkernel option but this is not nice. So, let's add this functionality, for Linux running on bare metal and as Xen dom0, to kexec-tools. This way kdump scripts may establish crash kernel region size in one way regardless of platform. All burden of platform detection lies on kexec-tools.

Figure (and unit) displayed by this new kexec-tools functionality is the same as one taken from /sys/kernel/kexec_crash_size.

This patch just adds print_crashkernel_region_size() function, which prints crash kernel region size, for x86 arch. Next patches will add same named function for other archs supported by kexec-tools. Last patch of this series will export this functionality to the userspace via separate kexec utility option.

---
 kexec/arch/i386/crashdump-x86.c |   18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
kexec/arch/i386/crashdump-x86.c +17 -1
index bbc0f35..10a56a8 100644
@@ -1056,7 +1056,7 @@ static int crashkernel_mem_callback(void *UNUSED(data), int nr,
 	return 0;
 }
 
-int is_crashkernel_mem_reserved(void)
+static int get_crashkernel_region(void)
 {
 	int ret;
 
@@ -1079,3 +1079,19 @@ int is_crashkernel_mem_reserved(void)
 
 	return !!crash_reserved_mem_nr;
 }
+
+int is_crashkernel_mem_reserved(void)
+{
+	return get_crashkernel_region();
+}
+
+void print_crashkernel_region_size(void)
+{
+	uint64_t start, end;
+
+	if (get_crashkernel_region()) {
+		get_crash_kernel_load_range(&start, &end);
+		printf("%lu\n", end - start + 1);
+	} else
+		printf("0\n");
+}
Signature · 1 line
1.7.10.4
#9 lore raw

PATCH 5/14 crashdump/arm: Add print_crashkernel_region_size() function

In reply to Daniel Kiper

Follow similar x86 patch.

---
 kexec/arch/arm/crashdump-arm.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
kexec/arch/arm/crashdump-arm.c +10 -0
index b523e5f..b3e93ad 100644
@@ -414,3 +414,13 @@ int is_crashkernel_mem_reserved(void)
 
 	return 0;
 }
+
+void print_crashkernel_region_size(void)
+{
+	uint64_t start, end;
+
+	if (!parse_iomem_single("Crash kernel\n", &start, &end) && start != end)
+		printf("%lu\n", end - start + 1);
+	else
+		printf("0\n");
+}
Signature · 7 lines
1.7.10.4


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

PATCH 5/14 crashdump/arm: Add print_crashkernel_region_size() function

In reply to Daniel Kiper

Follow similar x86 patch.

---
 kexec/arch/arm/crashdump-arm.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
kexec/arch/arm/crashdump-arm.c +10 -0
index b523e5f..b3e93ad 100644
@@ -414,3 +414,13 @@ int is_crashkernel_mem_reserved(void)
 
 	return 0;
 }
+
+void print_crashkernel_region_size(void)
+{
+	uint64_t start, end;
+
+	if (!parse_iomem_single("Crash kernel\n", &start, &end) && start != end)
+		printf("%lu\n", end - start + 1);
+	else
+		printf("0\n");
+}
Signature · 1 line
1.7.10.4
#11 lore raw

PATCH 6/14 crashdump/cris: Add print_crashkernel_region_size() function

In reply to Daniel Kiper

Provide just print_crashkernel_region_size() stub. This way we can properly build kexec utility on cris arch even if the functionality is not available on it.

---
 kexec/arch/cris/kexec-cris.c |    5 +++++
 1 file changed, 5 insertions(+)
kexec/arch/cris/kexec-cris.c +5 -0
index 4ac2f89..8c62191 100644
@@ -77,6 +77,11 @@ int is_crashkernel_mem_reserved(void)
 	return 0;
 }
 
+void print_crashkernel_region_size(void)
+{
+	printf("-1\n");
+}
+
 unsigned long virt_to_phys(unsigned long addr)
 {
 	return (addr) & 0x7fffffff;
Signature · 7 lines
1.7.10.4


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

Re: [PATCH 06/14] crashdump/cris: Add print_crashkernel_region_size() function

Quoted 14 lines · Daniel Kiper

Provide just print_crashkernel_region_size() stub. This way we can properly build kexec utility on cris arch even if the functionality is not available on it.

---
 kexec/arch/cris/kexec-cris.c |    5 +++++
 1 file changed, 5 insertions(+)
kexec/arch/cris/kexec-cris.c +0 -0
index 4ac2f89..8c62191 100644

kexec/arch/cris/kexec-cris.c int is_crashkernel_mem_reserved(void) · line 82

Quoted 6 lines
kexec/arch/cris/kexec-cris.c +3 -0
@@ -77,6 +77,11 @@ int is_crashkernel_mem_reserved(void)
 	return 0;
 }
 
+void print_crashkernel_region_size(void)
+{
+	printf("-1\n");

"-1" is meaningless to end user, how about instead telling that there's no such functionality for the arch.

Quoted 15 lines
kexec/arch/cris/kexec-cris.c +2 -0
+}
+
 unsigned long virt_to_phys(unsigned long addr)
 {
 	return (addr) & 0x7fffffff;
Signature · 7 lines
1.7.10.4


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

Re: [PATCH 06/14] crashdump/cris: Add print_crashkernel_region_size() function

In reply to Daniel Kiper
Quoted 14 lines · Daniel Kiper

Provide just print_crashkernel_region_size() stub. This way we can properly build kexec utility on cris arch even if the functionality is not available on it.

---
 kexec/arch/cris/kexec-cris.c |    5 +++++
 1 file changed, 5 insertions(+)
kexec/arch/cris/kexec-cris.c +0 -0
index 4ac2f89..8c62191 100644

kexec/arch/cris/kexec-cris.c int is_crashkernel_mem_reserved(void) · line 82

Quoted 6 lines
kexec/arch/cris/kexec-cris.c +3 -0
@@ -77,6 +77,11 @@ int is_crashkernel_mem_reserved(void)
 	return 0;
 }
 
+void print_crashkernel_region_size(void)
+{
+	printf("-1\n");

"-1" is meaningless to end user, how about instead telling that there's no such functionality for the arch.

Quoted 15 lines
kexec/arch/cris/kexec-cris.c +2 -0
+}
+
 unsigned long virt_to_phys(unsigned long addr)
 {
 	return (addr) & 0x7fffffff;
Signature · 7 lines
1.7.10.4


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

PATCH 6/14 crashdump/cris: Add print_crashkernel_region_size() function

In reply to Daniel Kiper

Provide just print_crashkernel_region_size() stub. This way we can properly build kexec utility on cris arch even if the functionality is not available on it.

---
 kexec/arch/cris/kexec-cris.c |    5 +++++
 1 file changed, 5 insertions(+)
kexec/arch/cris/kexec-cris.c +5 -0
index 4ac2f89..8c62191 100644
@@ -77,6 +77,11 @@ int is_crashkernel_mem_reserved(void)
 	return 0;
 }
 
+void print_crashkernel_region_size(void)
+{
+	printf("-1\n");
+}
+
 unsigned long virt_to_phys(unsigned long addr)
 {
 	return (addr) & 0x7fffffff;
Signature · 1 line
1.7.10.4
#15 lore raw

PATCH 7/14 crashdump/ia64: Add print_crashkernel_region_size() function

In reply to Daniel Kiper

Follow similar x86 patch.

---
 kexec/arch/ia64/crashdump-ia64.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
kexec/arch/ia64/crashdump-ia64.c +10 -0
index 726c9f4..07de42a 100644
@@ -286,3 +286,13 @@ int is_crashkernel_mem_reserved(void)
 	return parse_iomem_single("Crash kernel\n", &start,
 				  &end) == 0 ?  (start != end) : 0;
 }
+
+void print_crashkernel_region_size(void)
+{
+	uint64_t start, end;
+
+	if (!parse_iomem_single("Crash kernel\n", &start, &end) && start != end)
+		printf("%lu\n", end - start + 1);
+	else
+		printf("0\n");
+}
Signature · 7 lines
1.7.10.4


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

PATCH 7/14 crashdump/ia64: Add print_crashkernel_region_size() function

In reply to Daniel Kiper

Follow similar x86 patch.

---
 kexec/arch/ia64/crashdump-ia64.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
kexec/arch/ia64/crashdump-ia64.c +10 -0
index 726c9f4..07de42a 100644
@@ -286,3 +286,13 @@ int is_crashkernel_mem_reserved(void)
 	return parse_iomem_single("Crash kernel\n", &start,
 				  &end) == 0 ?  (start != end) : 0;
 }
+
+void print_crashkernel_region_size(void)
+{
+	uint64_t start, end;
+
+	if (!parse_iomem_single("Crash kernel\n", &start, &end) && start != end)
+		printf("%lu\n", end - start + 1);
+	else
+		printf("0\n");
+}
Signature · 1 line
1.7.10.4
#17 lore raw

PATCH 8/14 crashdump/m68k: Add print_crashkernel_region_size() function

In reply to Daniel Kiper

Provide just print_crashkernel_region_size() stub. This way we can properly build kexec utility on m68k arch even if the functionality is not available on it.

---
 kexec/arch/m68k/kexec-m68k.c |    5 +++++
 1 file changed, 5 insertions(+)
kexec/arch/m68k/kexec-m68k.c +5 -0
index 372aa37..a9915a0 100644
@@ -89,6 +89,11 @@ int is_crashkernel_mem_reserved(void)
 	return 0;
 }
 
+void print_crashkernel_region_size(void)
+{
+	printf("-1\n");
+}
+
 unsigned long virt_to_phys(unsigned long addr)
 {
 	return addr + m68k_memoffset;
Signature · 7 lines
1.7.10.4


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

PATCH 8/14 crashdump/m68k: Add print_crashkernel_region_size() function

In reply to Daniel Kiper

Provide just print_crashkernel_region_size() stub. This way we can properly build kexec utility on m68k arch even if the functionality is not available on it.

---
 kexec/arch/m68k/kexec-m68k.c |    5 +++++
 1 file changed, 5 insertions(+)
kexec/arch/m68k/kexec-m68k.c +5 -0
index 372aa37..a9915a0 100644
@@ -89,6 +89,11 @@ int is_crashkernel_mem_reserved(void)
 	return 0;
 }
 
+void print_crashkernel_region_size(void)
+{
+	printf("-1\n");
+}
+
 unsigned long virt_to_phys(unsigned long addr)
 {
 	return addr + m68k_memoffset;
Signature · 1 line
1.7.10.4
#19 lore raw

PATCH 9/14 crashdump/mips: Add print_crashkernel_region_size() function

In reply to Daniel Kiper

Follow similar x86 patch.

---
 kexec/arch/mips/crashdump-mips.c |    9 +++++++++
 1 file changed, 9 insertions(+)
kexec/arch/mips/crashdump-mips.c +9 -0
index dc68cb4..450fa13 100644
@@ -377,3 +377,12 @@ int is_crashkernel_mem_reserved(void)
 		(start != end) : 0;
 }
 
+void print_crashkernel_region_size(void)
+{
+	uint64_t start, end;
+
+	if (!parse_iomem_single("Crash kernel\n", &start, &end) && start != end)
+		printf("%lu\n", end - start + 1);
+	else
+		printf("0\n");
+}
Signature · 7 lines
1.7.10.4


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

PATCH 9/14 crashdump/mips: Add print_crashkernel_region_size() function

In reply to Daniel Kiper

Follow similar x86 patch.

---
 kexec/arch/mips/crashdump-mips.c |    9 +++++++++
 1 file changed, 9 insertions(+)
kexec/arch/mips/crashdump-mips.c +9 -0
index dc68cb4..450fa13 100644
@@ -377,3 +377,12 @@ int is_crashkernel_mem_reserved(void)
 		(start != end) : 0;
 }
 
+void print_crashkernel_region_size(void)
+{
+	uint64_t start, end;
+
+	if (!parse_iomem_single("Crash kernel\n", &start, &end) && start != end)
+		printf("%lu\n", end - start + 1);
+	else
+		printf("0\n");
+}
Signature · 1 line
1.7.10.4
#21 lore raw

PATCH 10/14 crashdump/ppc: Add print_crashkernel_region_size() function

In reply to Daniel Kiper

Provide just print_crashkernel_region_size() stub. This way we can properly build kexec utility on ppc arch even if the functionality is not available on it.

---
 kexec/arch/ppc/crashdump-powerpc.c |    4 ++++
 1 file changed, 4 insertions(+)
kexec/arch/ppc/crashdump-powerpc.c +4 -0
index 3dc35eb..19c4a61 100644
@@ -408,3 +408,7 @@ int is_crashkernel_mem_reserved(void)
 	return 1;
 }
 
+void print_crashkernel_region_size(void)
+{
+	printf("-1\n");
+}
Signature · 7 lines
1.7.10.4


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

Re: [PATCH 10/14] crashdump/ppc: Add print_crashkernel_region_size() function

Quoted 3 lines · Daniel Kiper

Provide just print_crashkernel_region_size() stub. This way we can properly build kexec utility on ppc arch even if the functionality is not available on it.

The functionality is available by reading device tree nodes in procfs..

Quoted 28 lines
---
 kexec/arch/ppc/crashdump-powerpc.c |    4 ++++
 1 file changed, 4 insertions(+)
kexec/arch/ppc/crashdump-powerpc.c +4 -0
index 3dc35eb..19c4a61 100644
@@ -408,3 +408,7 @@ int is_crashkernel_mem_reserved(void)
 	return 1;
 }
 
+void print_crashkernel_region_size(void)
+{
+	printf("-1\n");
+}
Signature · 7 lines
1.7.10.4


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

Re: [PATCH 10/14] crashdump/ppc: Add print_crashkernel_region_size() function

In reply to Daniel Kiper
Quoted 3 lines · Daniel Kiper

Provide just print_crashkernel_region_size() stub. This way we can properly build kexec utility on ppc arch even if the functionality is not available on it.

The functionality is available by reading device tree nodes in procfs..

Quoted 28 lines
---
 kexec/arch/ppc/crashdump-powerpc.c |    4 ++++
 1 file changed, 4 insertions(+)
kexec/arch/ppc/crashdump-powerpc.c +4 -0
index 3dc35eb..19c4a61 100644
@@ -408,3 +408,7 @@ int is_crashkernel_mem_reserved(void)
 	return 1;
 }
 
+void print_crashkernel_region_size(void)
+{
+	printf("-1\n");
+}
Signature · 7 lines
1.7.10.4


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

PATCH 10/14 crashdump/ppc: Add print_crashkernel_region_size() function

In reply to Daniel Kiper

Provide just print_crashkernel_region_size() stub. This way we can properly build kexec utility on ppc arch even if the functionality is not available on it.

---
 kexec/arch/ppc/crashdump-powerpc.c |    4 ++++
 1 file changed, 4 insertions(+)
kexec/arch/ppc/crashdump-powerpc.c +4 -0
index 3dc35eb..19c4a61 100644
@@ -408,3 +408,7 @@ int is_crashkernel_mem_reserved(void)
 	return 1;
 }
 
+void print_crashkernel_region_size(void)
+{
+	printf("-1\n");
+}
Signature · 1 line
1.7.10.4
#25 lore raw

PATCH 11/14 crashdump/ppc64: Add print_crashkernel_region_size() function

In reply to Daniel Kiper

Provide just print_crashkernel_region_size() stub. This way we can properly build kexec utility on ppc64 arch even if the functionality is not available on it.

---
 kexec/arch/ppc64/crashdump-ppc64.c |    5 +++++
 1 file changed, 5 insertions(+)
kexec/arch/ppc64/crashdump-ppc64.c +5 -0
index b3c8928..49af7a6 100644
@@ -527,6 +527,11 @@ int is_crashkernel_mem_reserved(void)
 	return 1;
 }
 
+void print_crashkernel_region_size(void)
+{
+	printf("-1\n");
+}
+
 #if 0
 static int sort_regions(mem_rgns_t *rgn)
 {
Signature · 7 lines
1.7.10.4


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

Re: [PATCH 11/14] crashdump/ppc64: Add print_crashkernel_region_size() function

Quoted 3 lines · Daniel Kiper

Provide just print_crashkernel_region_size() stub. This way we can properly build kexec utility on ppc64 arch even if the functionality is not available on it.

Ditto as ppc, you can read procfs file to get the values..

Quoted 32 lines
---
 kexec/arch/ppc64/crashdump-ppc64.c |    5 +++++
 1 file changed, 5 insertions(+)
kexec/arch/ppc64/crashdump-ppc64.c +5 -0
index b3c8928..49af7a6 100644
@@ -527,6 +527,11 @@ int is_crashkernel_mem_reserved(void)
 	return 1;
 }
 
+void print_crashkernel_region_size(void)
+{
+	printf("-1\n");
+}
+
 #if 0
 static int sort_regions(mem_rgns_t *rgn)
 {
Signature · 7 lines
1.7.10.4


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

Re: [PATCH 11/14] crashdump/ppc64: Add print_crashkernel_region_size() function

In reply to Daniel Kiper
Quoted 3 lines · Daniel Kiper

Provide just print_crashkernel_region_size() stub. This way we can properly build kexec utility on ppc64 arch even if the functionality is not available on it.

Ditto as ppc, you can read procfs file to get the values..

Quoted 32 lines
---
 kexec/arch/ppc64/crashdump-ppc64.c |    5 +++++
 1 file changed, 5 insertions(+)
kexec/arch/ppc64/crashdump-ppc64.c +5 -0
index b3c8928..49af7a6 100644
@@ -527,6 +527,11 @@ int is_crashkernel_mem_reserved(void)
 	return 1;
 }
 
+void print_crashkernel_region_size(void)
+{
+	printf("-1\n");
+}
+
 #if 0
 static int sort_regions(mem_rgns_t *rgn)
 {
Signature · 7 lines
1.7.10.4


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

PATCH 11/14 crashdump/ppc64: Add print_crashkernel_region_size() function

In reply to Daniel Kiper

Provide just print_crashkernel_region_size() stub. This way we can properly build kexec utility on ppc64 arch even if the functionality is not available on it.

---
 kexec/arch/ppc64/crashdump-ppc64.c |    5 +++++
 1 file changed, 5 insertions(+)
kexec/arch/ppc64/crashdump-ppc64.c +5 -0
index b3c8928..49af7a6 100644
@@ -527,6 +527,11 @@ int is_crashkernel_mem_reserved(void)
 	return 1;
 }
 
+void print_crashkernel_region_size(void)
+{
+	printf("-1\n");
+}
+
 #if 0
 static int sort_regions(mem_rgns_t *rgn)
 {
Signature · 1 line
1.7.10.4
#29 lore raw

PATCH 12/14 crashdump/s390: Add print_crashkernel_region_size() function

In reply to Daniel Kiper

Follow similar x86 patch.

---
 kexec/arch/s390/kexec-s390.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
kexec/arch/s390/kexec-s390.c +10 -0
index 074575e..212a64f 100644
@@ -262,3 +262,13 @@ int is_crashkernel_mem_reserved(void)
 	return parse_iomem_single("Crash kernel\n", &start, &end) == 0 ?
 		(start != end) : 0;
 }
+
+void print_crashkernel_region_size(void)
+{
+	uint64_t start, end;
+
+	if (!parse_iomem_single("Crash kernel\n", &start, &end) && start != end)
+		printf("%lu\n", end - start + 1);
+	else
+		printf("0\n");
+}
Signature · 7 lines
1.7.10.4


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

PATCH 12/14 crashdump/s390: Add print_crashkernel_region_size() function

In reply to Daniel Kiper

Follow similar x86 patch.

---
 kexec/arch/s390/kexec-s390.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
kexec/arch/s390/kexec-s390.c +10 -0
index 074575e..212a64f 100644
@@ -262,3 +262,13 @@ int is_crashkernel_mem_reserved(void)
 	return parse_iomem_single("Crash kernel\n", &start, &end) == 0 ?
 		(start != end) : 0;
 }
+
+void print_crashkernel_region_size(void)
+{
+	uint64_t start, end;
+
+	if (!parse_iomem_single("Crash kernel\n", &start, &end) && start != end)
+		printf("%lu\n", end - start + 1);
+	else
+		printf("0\n");
+}
Signature · 1 line
1.7.10.4
#31 lore raw

PATCH 13/14 crashdump/sh: Add print_crashkernel_region_size() function

In reply to Daniel Kiper

Follow similar x86 patch.

---
 kexec/arch/sh/crashdump-sh.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
kexec/arch/sh/crashdump-sh.c +10 -0
index 9e6af6b..6556eb1 100644
@@ -178,3 +178,13 @@ int is_crashkernel_mem_reserved(void)
 	return parse_iomem_single("Crash kernel\n", &start, &end) == 0 ?
 	  (start != end) : 0;
 }
+
+void print_crashkernel_region_size(void)
+{
+	uint64_t start, end;
+
+	if (!parse_iomem_single("Crash kernel\n", &start, &end) && start != end)
+		printf("%lu\n", end - start + 1);
+	else
+		printf("0\n");
+}
Signature · 7 lines
1.7.10.4


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

PATCH 13/14 crashdump/sh: Add print_crashkernel_region_size() function

In reply to Daniel Kiper

Follow similar x86 patch.

---
 kexec/arch/sh/crashdump-sh.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
kexec/arch/sh/crashdump-sh.c +10 -0
index 9e6af6b..6556eb1 100644
@@ -178,3 +178,13 @@ int is_crashkernel_mem_reserved(void)
 	return parse_iomem_single("Crash kernel\n", &start, &end) == 0 ?
 	  (start != end) : 0;
 }
+
+void print_crashkernel_region_size(void)
+{
+	uint64_t start, end;
+
+	if (!parse_iomem_single("Crash kernel\n", &start, &end) && start != end)
+		printf("%lu\n", end - start + 1);
+	else
+		printf("0\n");
+}
Signature · 1 line
1.7.10.4
#33 lore raw

PATCH 14/14 kexec: Add option to get crash kernel region size

In reply to Daniel Kiper

Here print_crashkernel_region_size() function is available on all archs (even if the functionality is not implemented on some). So, we can safely use it in arch independent code and export the functionality to the user space.

---
 kexec/kexec.8 |    3 +++
 kexec/kexec.c |    4 ++++
 kexec/kexec.h |    5 ++++-
 3 files changed, 11 insertions(+), 1 deletion(-)
kexec/kexec.8 +3 -0
index 4d0c1d1..e65345e 100644
@@ -173,6 +173,9 @@ Load a helper image to jump back to original kernel.
 .TP
 .BI \-\-reuseinitrd
 Reuse initrd from first boot.
+.TP
+.BI \-\-print-ckr-size
+Print crash kernel region size. -1 means that this functionality is not implemented.
 
 
 .SH SUPPORTED KERNEL FILE TYPES AND OPTIONS
kexec/kexec.c +4 -0
index 20dd93d..a27f596 100644
@@ -960,6 +960,7 @@ void usage(void)
 	       "     --mem-max=<addr> Specify the highest memory address to\n"
 	       "                      load code into.\n"
 	       "     --reuseinitrd    Reuse initrd from first boot.\n"
+	       "     --print-ckr-size Print crash kernel region size.\n"
 	       "     --load-preserve-context Load the new kernel and preserve\n"
 	       "                      context of current kernel during kexec.\n"
 	       "     --load-jump-back-helper Load a helper image to jump back\n"
@@ -1345,6 +1346,9 @@ int main(int argc, char *argv[])
 		case OPT_KEXEC_FILE_SYSCALL:
 			/* We already parsed it. Nothing to do. */
 			break;
+		case OPT_PRINT_CKR_SIZE:
+			print_crashkernel_region_size();
+			return 0;
 		default:
 			break;
 		}
kexec/kexec.h +4 -1
index c02ac8f..42a602d 100644
@@ -224,7 +224,8 @@ extern int file_types;
 #define OPT_LOAD_PRESERVE_CONTEXT 259
 #define OPT_LOAD_JUMP_BACK_HELPER 260
 #define OPT_ENTRY		261
-#define OPT_MAX			262
+#define OPT_PRINT_CKR_SIZE	262
+#define OPT_MAX			263
 #define KEXEC_OPTIONS \
 	{ "help",		0, 0, OPT_HELP }, \
 	{ "version",		0, 0, OPT_VERSION }, \
@@ -244,6 +245,7 @@ extern int file_types;
 	{ "reuseinitrd",	0, 0, OPT_REUSE_INITRD }, \
 	{ "kexec-file-syscall",	0, 0, OPT_KEXEC_FILE_SYSCALL }, \
 	{ "debug",		0, 0, OPT_DEBUG }, \
+	{ "print-ckr-size",	0, 0, OPT_PRINT_CKR_SIZE }, \
 
 #define KEXEC_OPT_STR "h?vdfxyluet:ps"
 
@@ -290,6 +292,7 @@ int arch_compat_trampoline(struct kexec_info *info);
 void arch_update_purgatory(struct kexec_info *info);
 int is_crashkernel_mem_reserved(void);
 int get_crash_kernel_load_range(uint64_t *start, uint64_t *end);
+void print_crashkernel_region_size(void);
 char *get_command_line(void);
 
 int kexec_iomem_for_each_line(char *match,
Signature · 7 lines
1.7.10.4


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

PATCH 14/14 kexec: Add option to get crash kernel region size

In reply to Daniel Kiper

Here print_crashkernel_region_size() function is available on all archs (even if the functionality is not implemented on some). So, we can safely use it in arch independent code and export the functionality to the user space.

---
 kexec/kexec.8 |    3 +++
 kexec/kexec.c |    4 ++++
 kexec/kexec.h |    5 ++++-
 3 files changed, 11 insertions(+), 1 deletion(-)
kexec/kexec.8 +3 -0
index 4d0c1d1..e65345e 100644
@@ -173,6 +173,9 @@ Load a helper image to jump back to original kernel.
 .TP
 .BI \-\-reuseinitrd
 Reuse initrd from first boot.
+.TP
+.BI \-\-print-ckr-size
+Print crash kernel region size. -1 means that this functionality is not implemented.
 
 
 .SH SUPPORTED KERNEL FILE TYPES AND OPTIONS
kexec/kexec.c +4 -0
index 20dd93d..a27f596 100644
@@ -960,6 +960,7 @@ void usage(void)
 	       "     --mem-max=<addr> Specify the highest memory address to\n"
 	       "                      load code into.\n"
 	       "     --reuseinitrd    Reuse initrd from first boot.\n"
+	       "     --print-ckr-size Print crash kernel region size.\n"
 	       "     --load-preserve-context Load the new kernel and preserve\n"
 	       "                      context of current kernel during kexec.\n"
 	       "     --load-jump-back-helper Load a helper image to jump back\n"
@@ -1345,6 +1346,9 @@ int main(int argc, char *argv[])
 		case OPT_KEXEC_FILE_SYSCALL:
 			/* We already parsed it. Nothing to do. */
 			break;
+		case OPT_PRINT_CKR_SIZE:
+			print_crashkernel_region_size();
+			return 0;
 		default:
 			break;
 		}
kexec/kexec.h +4 -1
index c02ac8f..42a602d 100644
@@ -224,7 +224,8 @@ extern int file_types;
 #define OPT_LOAD_PRESERVE_CONTEXT 259
 #define OPT_LOAD_JUMP_BACK_HELPER 260
 #define OPT_ENTRY		261
-#define OPT_MAX			262
+#define OPT_PRINT_CKR_SIZE	262
+#define OPT_MAX			263
 #define KEXEC_OPTIONS \
 	{ "help",		0, 0, OPT_HELP }, \
 	{ "version",		0, 0, OPT_VERSION }, \
@@ -244,6 +245,7 @@ extern int file_types;
 	{ "reuseinitrd",	0, 0, OPT_REUSE_INITRD }, \
 	{ "kexec-file-syscall",	0, 0, OPT_KEXEC_FILE_SYSCALL }, \
 	{ "debug",		0, 0, OPT_DEBUG }, \
+	{ "print-ckr-size",	0, 0, OPT_PRINT_CKR_SIZE }, \
 
 #define KEXEC_OPT_STR "h?vdfxyluet:ps"
 
@@ -290,6 +292,7 @@ int arch_compat_trampoline(struct kexec_info *info);
 void arch_update_purgatory(struct kexec_info *info);
 int is_crashkernel_mem_reserved(void);
 int get_crash_kernel_load_range(uint64_t *start, uint64_t *end);
+void print_crashkernel_region_size(void);
 char *get_command_line(void);
 
 int kexec_iomem_for_each_line(char *match,
Signature · 1 line
1.7.10.4