Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/14] kexec: Add option to get crash kernel region size
@ 2015-12-08 21:57 Daniel Kiper
  2015-12-08 21:57 ` [PATCH 01/14] purgatory: Add purgatory.map and purgatory.ro.sym to clean recipe Daniel Kiper
                   ` (13 more replies)
  0 siblings, 14 replies; 18+ messages in thread
From: Daniel Kiper @ 2015-12-08 21:57 UTC (permalink / raw)
  To: kexec, linux-kernel, xen-devel
  Cc: andrew.cooper3, horms, keir, david.vrabel, konrad.wilk

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
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 01/14] purgatory: Add purgatory.map and purgatory.ro.sym to clean recipe
  2015-12-08 21:57 [PATCH 00/14] kexec: Add option to get crash kernel region size Daniel Kiper
@ 2015-12-08 21:57 ` Daniel Kiper
  2015-12-08 21:57 ` [PATCH 02/14] kexec: Remove redundant space from help message Daniel Kiper
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Daniel Kiper @ 2015-12-08 21:57 UTC (permalink / raw)
  To: kexec, linux-kernel, xen-devel
  Cc: andrew.cooper3, horms, keir, david.vrabel, konrad.wilk

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
 purgatory/Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/purgatory/Makefile b/purgatory/Makefile
index 2b5c061..caea7ea 100644
--- a/purgatory/Makefile
+++ b/purgatory/Makefile
@@ -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)
 
-- 
1.7.10.4


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 02/14] kexec: Remove redundant space from help message
  2015-12-08 21:57 [PATCH 00/14] kexec: Add option to get crash kernel region size Daniel Kiper
  2015-12-08 21:57 ` [PATCH 01/14] purgatory: Add purgatory.map and purgatory.ro.sym to clean recipe Daniel Kiper
@ 2015-12-08 21:57 ` Daniel Kiper
  2015-12-08 21:57 ` [PATCH 03/14] crashdump: Remove stray get_crashkernel_region() declaration Daniel Kiper
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Daniel Kiper @ 2015-12-08 21:57 UTC (permalink / raw)
  To: kexec, linux-kernel, xen-devel
  Cc: andrew.cooper3, horms, keir, david.vrabel, konrad.wilk

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
 kexec/kexec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kexec/kexec.c b/kexec/kexec.c
index f0bd527..20dd93d 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -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++) {
-- 
1.7.10.4


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 03/14] crashdump: Remove stray get_crashkernel_region() declaration
  2015-12-08 21:57 [PATCH 00/14] kexec: Add option to get crash kernel region size Daniel Kiper
  2015-12-08 21:57 ` [PATCH 01/14] purgatory: Add purgatory.map and purgatory.ro.sym to clean recipe Daniel Kiper
  2015-12-08 21:57 ` [PATCH 02/14] kexec: Remove redundant space from help message Daniel Kiper
@ 2015-12-08 21:57 ` Daniel Kiper
  2015-12-08 21:57 ` [PATCH 04/14] crashdump/x86: Add print_crashkernel_region_size() function Daniel Kiper
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Daniel Kiper @ 2015-12-08 21:57 UTC (permalink / raw)
  To: kexec, linux-kernel, xen-devel
  Cc: andrew.cooper3, horms, keir, david.vrabel, konrad.wilk

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
 kexec/crashdump.h |    1 -
 1 file changed, 1 deletion(-)

diff --git a/kexec/crashdump.h b/kexec/crashdump.h
index 95f1f0c..320767b 100644
--- a/kexec/crashdump.h
+++ b/kexec/crashdump.h
@@ -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);
-- 
1.7.10.4


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 04/14] crashdump/x86: Add print_crashkernel_region_size() function
  2015-12-08 21:57 [PATCH 00/14] kexec: Add option to get crash kernel region size Daniel Kiper
                   ` (2 preceding siblings ...)
  2015-12-08 21:57 ` [PATCH 03/14] crashdump: Remove stray get_crashkernel_region() declaration Daniel Kiper
@ 2015-12-08 21:57 ` Daniel Kiper
  2015-12-08 21:57 ` [PATCH 05/14] crashdump/arm: " Daniel Kiper
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Daniel Kiper @ 2015-12-08 21:57 UTC (permalink / raw)
  To: kexec, linux-kernel, xen-devel
  Cc: andrew.cooper3, horms, keir, david.vrabel, konrad.wilk

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.

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
 kexec/arch/i386/crashdump-x86.c |   18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
index bbc0f35..10a56a8 100644
--- a/kexec/arch/i386/crashdump-x86.c
+++ b/kexec/arch/i386/crashdump-x86.c
@@ -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");
+}
-- 
1.7.10.4


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 05/14] crashdump/arm: Add print_crashkernel_region_size() function
  2015-12-08 21:57 [PATCH 00/14] kexec: Add option to get crash kernel region size Daniel Kiper
                   ` (3 preceding siblings ...)
  2015-12-08 21:57 ` [PATCH 04/14] crashdump/x86: Add print_crashkernel_region_size() function Daniel Kiper
@ 2015-12-08 21:57 ` Daniel Kiper
  2015-12-08 21:57 ` [PATCH 06/14] crashdump/cris: " Daniel Kiper
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Daniel Kiper @ 2015-12-08 21:57 UTC (permalink / raw)
  To: kexec, linux-kernel, xen-devel
  Cc: andrew.cooper3, horms, keir, david.vrabel, konrad.wilk

Follow similar x86 patch.

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
 kexec/arch/arm/crashdump-arm.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/kexec/arch/arm/crashdump-arm.c b/kexec/arch/arm/crashdump-arm.c
index b523e5f..b3e93ad 100644
--- a/kexec/arch/arm/crashdump-arm.c
+++ b/kexec/arch/arm/crashdump-arm.c
@@ -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");
+}
-- 
1.7.10.4


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 06/14] crashdump/cris: Add print_crashkernel_region_size() function
  2015-12-08 21:57 [PATCH 00/14] kexec: Add option to get crash kernel region size Daniel Kiper
                   ` (4 preceding siblings ...)
  2015-12-08 21:57 ` [PATCH 05/14] crashdump/arm: " Daniel Kiper
@ 2015-12-08 21:57 ` Daniel Kiper
  2015-12-09  2:55   ` Dave Young
  2015-12-08 21:57 ` [PATCH 07/14] crashdump/ia64: " Daniel Kiper
                   ` (7 subsequent siblings)
  13 siblings, 1 reply; 18+ messages in thread
From: Daniel Kiper @ 2015-12-08 21:57 UTC (permalink / raw)
  To: kexec, linux-kernel, xen-devel
  Cc: andrew.cooper3, horms, keir, david.vrabel, konrad.wilk

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.

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
 kexec/arch/cris/kexec-cris.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/kexec/arch/cris/kexec-cris.c b/kexec/arch/cris/kexec-cris.c
index 4ac2f89..8c62191 100644
--- a/kexec/arch/cris/kexec-cris.c
+++ b/kexec/arch/cris/kexec-cris.c
@@ -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;
-- 
1.7.10.4


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 07/14] crashdump/ia64: Add print_crashkernel_region_size() function
  2015-12-08 21:57 [PATCH 00/14] kexec: Add option to get crash kernel region size Daniel Kiper
                   ` (5 preceding siblings ...)
  2015-12-08 21:57 ` [PATCH 06/14] crashdump/cris: " Daniel Kiper
@ 2015-12-08 21:57 ` Daniel Kiper
  2015-12-08 21:57 ` [PATCH 08/14] crashdump/m68k: " Daniel Kiper
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Daniel Kiper @ 2015-12-08 21:57 UTC (permalink / raw)
  To: kexec, linux-kernel, xen-devel
  Cc: andrew.cooper3, horms, keir, david.vrabel, konrad.wilk

Follow similar x86 patch.

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
 kexec/arch/ia64/crashdump-ia64.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/kexec/arch/ia64/crashdump-ia64.c b/kexec/arch/ia64/crashdump-ia64.c
index 726c9f4..07de42a 100644
--- a/kexec/arch/ia64/crashdump-ia64.c
+++ b/kexec/arch/ia64/crashdump-ia64.c
@@ -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");
+}
-- 
1.7.10.4


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 08/14] crashdump/m68k: Add print_crashkernel_region_size() function
  2015-12-08 21:57 [PATCH 00/14] kexec: Add option to get crash kernel region size Daniel Kiper
                   ` (6 preceding siblings ...)
  2015-12-08 21:57 ` [PATCH 07/14] crashdump/ia64: " Daniel Kiper
@ 2015-12-08 21:57 ` Daniel Kiper
  2015-12-08 21:57 ` [PATCH 09/14] crashdump/mips: " Daniel Kiper
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Daniel Kiper @ 2015-12-08 21:57 UTC (permalink / raw)
  To: kexec, linux-kernel, xen-devel
  Cc: andrew.cooper3, horms, keir, david.vrabel, konrad.wilk

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.

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
 kexec/arch/m68k/kexec-m68k.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/kexec/arch/m68k/kexec-m68k.c b/kexec/arch/m68k/kexec-m68k.c
index 372aa37..a9915a0 100644
--- a/kexec/arch/m68k/kexec-m68k.c
+++ b/kexec/arch/m68k/kexec-m68k.c
@@ -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;
-- 
1.7.10.4


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 09/14] crashdump/mips: Add print_crashkernel_region_size() function
  2015-12-08 21:57 [PATCH 00/14] kexec: Add option to get crash kernel region size Daniel Kiper
                   ` (7 preceding siblings ...)
  2015-12-08 21:57 ` [PATCH 08/14] crashdump/m68k: " Daniel Kiper
@ 2015-12-08 21:57 ` Daniel Kiper
  2015-12-08 21:57 ` [PATCH 10/14] crashdump/ppc: " Daniel Kiper
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Daniel Kiper @ 2015-12-08 21:57 UTC (permalink / raw)
  To: kexec, linux-kernel, xen-devel
  Cc: andrew.cooper3, horms, keir, david.vrabel, konrad.wilk

Follow similar x86 patch.

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
 kexec/arch/mips/crashdump-mips.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/kexec/arch/mips/crashdump-mips.c b/kexec/arch/mips/crashdump-mips.c
index dc68cb4..450fa13 100644
--- a/kexec/arch/mips/crashdump-mips.c
+++ b/kexec/arch/mips/crashdump-mips.c
@@ -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");
+}
-- 
1.7.10.4


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 10/14] crashdump/ppc: Add print_crashkernel_region_size() function
  2015-12-08 21:57 [PATCH 00/14] kexec: Add option to get crash kernel region size Daniel Kiper
                   ` (8 preceding siblings ...)
  2015-12-08 21:57 ` [PATCH 09/14] crashdump/mips: " Daniel Kiper
@ 2015-12-08 21:57 ` Daniel Kiper
  2015-12-09  2:51   ` Dave Young
  2015-12-08 21:57 ` [PATCH 11/14] crashdump/ppc64: " Daniel Kiper
                   ` (3 subsequent siblings)
  13 siblings, 1 reply; 18+ messages in thread
From: Daniel Kiper @ 2015-12-08 21:57 UTC (permalink / raw)
  To: kexec, linux-kernel, xen-devel
  Cc: andrew.cooper3, horms, keir, david.vrabel, konrad.wilk

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.

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
 kexec/arch/ppc/crashdump-powerpc.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kexec/arch/ppc/crashdump-powerpc.c b/kexec/arch/ppc/crashdump-powerpc.c
index 3dc35eb..19c4a61 100644
--- a/kexec/arch/ppc/crashdump-powerpc.c
+++ b/kexec/arch/ppc/crashdump-powerpc.c
@@ -408,3 +408,7 @@ int is_crashkernel_mem_reserved(void)
 	return 1;
 }
 
+void print_crashkernel_region_size(void)
+{
+	printf("-1\n");
+}
-- 
1.7.10.4


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 11/14] crashdump/ppc64: Add print_crashkernel_region_size() function
  2015-12-08 21:57 [PATCH 00/14] kexec: Add option to get crash kernel region size Daniel Kiper
                   ` (9 preceding siblings ...)
  2015-12-08 21:57 ` [PATCH 10/14] crashdump/ppc: " Daniel Kiper
@ 2015-12-08 21:57 ` Daniel Kiper
  2015-12-09  2:52   ` Dave Young
  2015-12-08 21:57 ` [PATCH 12/14] crashdump/s390: " Daniel Kiper
                   ` (2 subsequent siblings)
  13 siblings, 1 reply; 18+ messages in thread
From: Daniel Kiper @ 2015-12-08 21:57 UTC (permalink / raw)
  To: kexec, linux-kernel, xen-devel
  Cc: andrew.cooper3, horms, keir, david.vrabel, konrad.wilk

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.

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
 kexec/arch/ppc64/crashdump-ppc64.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/kexec/arch/ppc64/crashdump-ppc64.c b/kexec/arch/ppc64/crashdump-ppc64.c
index b3c8928..49af7a6 100644
--- a/kexec/arch/ppc64/crashdump-ppc64.c
+++ b/kexec/arch/ppc64/crashdump-ppc64.c
@@ -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)
 {
-- 
1.7.10.4


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 12/14] crashdump/s390: Add print_crashkernel_region_size() function
  2015-12-08 21:57 [PATCH 00/14] kexec: Add option to get crash kernel region size Daniel Kiper
                   ` (10 preceding siblings ...)
  2015-12-08 21:57 ` [PATCH 11/14] crashdump/ppc64: " Daniel Kiper
@ 2015-12-08 21:57 ` Daniel Kiper
  2015-12-08 21:57 ` [PATCH 13/14] crashdump/sh: " Daniel Kiper
  2015-12-08 21:57 ` [PATCH 14/14] kexec: Add option to get crash kernel region size Daniel Kiper
  13 siblings, 0 replies; 18+ messages in thread
From: Daniel Kiper @ 2015-12-08 21:57 UTC (permalink / raw)
  To: kexec, linux-kernel, xen-devel
  Cc: andrew.cooper3, horms, keir, david.vrabel, konrad.wilk

Follow similar x86 patch.

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
 kexec/arch/s390/kexec-s390.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/kexec/arch/s390/kexec-s390.c b/kexec/arch/s390/kexec-s390.c
index 074575e..212a64f 100644
--- a/kexec/arch/s390/kexec-s390.c
+++ b/kexec/arch/s390/kexec-s390.c
@@ -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");
+}
-- 
1.7.10.4


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 13/14] crashdump/sh: Add print_crashkernel_region_size() function
  2015-12-08 21:57 [PATCH 00/14] kexec: Add option to get crash kernel region size Daniel Kiper
                   ` (11 preceding siblings ...)
  2015-12-08 21:57 ` [PATCH 12/14] crashdump/s390: " Daniel Kiper
@ 2015-12-08 21:57 ` Daniel Kiper
  2015-12-08 21:57 ` [PATCH 14/14] kexec: Add option to get crash kernel region size Daniel Kiper
  13 siblings, 0 replies; 18+ messages in thread
From: Daniel Kiper @ 2015-12-08 21:57 UTC (permalink / raw)
  To: kexec, linux-kernel, xen-devel
  Cc: andrew.cooper3, horms, keir, david.vrabel, konrad.wilk

Follow similar x86 patch.

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
 kexec/arch/sh/crashdump-sh.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/kexec/arch/sh/crashdump-sh.c b/kexec/arch/sh/crashdump-sh.c
index 9e6af6b..6556eb1 100644
--- a/kexec/arch/sh/crashdump-sh.c
+++ b/kexec/arch/sh/crashdump-sh.c
@@ -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");
+}
-- 
1.7.10.4


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 14/14] kexec: Add option to get crash kernel region size
  2015-12-08 21:57 [PATCH 00/14] kexec: Add option to get crash kernel region size Daniel Kiper
                   ` (12 preceding siblings ...)
  2015-12-08 21:57 ` [PATCH 13/14] crashdump/sh: " Daniel Kiper
@ 2015-12-08 21:57 ` Daniel Kiper
  13 siblings, 0 replies; 18+ messages in thread
From: Daniel Kiper @ 2015-12-08 21:57 UTC (permalink / raw)
  To: kexec, linux-kernel, xen-devel
  Cc: andrew.cooper3, horms, keir, david.vrabel, konrad.wilk

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.

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
 kexec/kexec.8 |    3 +++
 kexec/kexec.c |    4 ++++
 kexec/kexec.h |    5 ++++-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/kexec/kexec.8 b/kexec/kexec.8
index 4d0c1d1..e65345e 100644
--- a/kexec/kexec.8
+++ b/kexec/kexec.8
@@ -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
diff --git a/kexec/kexec.c b/kexec/kexec.c
index 20dd93d..a27f596 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -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;
 		}
diff --git a/kexec/kexec.h b/kexec/kexec.h
index c02ac8f..42a602d 100644
--- a/kexec/kexec.h
+++ b/kexec/kexec.h
@@ -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,
-- 
1.7.10.4


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 10/14] crashdump/ppc: Add print_crashkernel_region_size() function
  2015-12-08 21:57 ` [PATCH 10/14] crashdump/ppc: " Daniel Kiper
@ 2015-12-09  2:51   ` Dave Young
  0 siblings, 0 replies; 18+ messages in thread
From: Dave Young @ 2015-12-09  2:51 UTC (permalink / raw)
  To: Daniel Kiper
  Cc: keir, konrad.wilk, andrew.cooper3, kexec, linux-kernel, horms,
	david.vrabel, xen-devel

On 12/08/15 at 10:57pm, Daniel Kiper wrote:
> 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..

> 
> Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
> ---
>  kexec/arch/ppc/crashdump-powerpc.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/kexec/arch/ppc/crashdump-powerpc.c b/kexec/arch/ppc/crashdump-powerpc.c
> index 3dc35eb..19c4a61 100644
> --- a/kexec/arch/ppc/crashdump-powerpc.c
> +++ b/kexec/arch/ppc/crashdump-powerpc.c
> @@ -408,3 +408,7 @@ int is_crashkernel_mem_reserved(void)
>  	return 1;
>  }
>  
> +void print_crashkernel_region_size(void)
> +{
> +	printf("-1\n");
> +}
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
> 
> 

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 11/14] crashdump/ppc64: Add print_crashkernel_region_size() function
  2015-12-08 21:57 ` [PATCH 11/14] crashdump/ppc64: " Daniel Kiper
@ 2015-12-09  2:52   ` Dave Young
  0 siblings, 0 replies; 18+ messages in thread
From: Dave Young @ 2015-12-09  2:52 UTC (permalink / raw)
  To: Daniel Kiper
  Cc: keir, konrad.wilk, andrew.cooper3, kexec, linux-kernel, horms,
	david.vrabel, xen-devel

On 12/08/15 at 10:57pm, Daniel Kiper wrote:
> 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..

> 
> Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
> ---
>  kexec/arch/ppc64/crashdump-ppc64.c |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/kexec/arch/ppc64/crashdump-ppc64.c b/kexec/arch/ppc64/crashdump-ppc64.c
> index b3c8928..49af7a6 100644
> --- a/kexec/arch/ppc64/crashdump-ppc64.c
> +++ b/kexec/arch/ppc64/crashdump-ppc64.c
> @@ -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)
>  {
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
> 
> 

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 06/14] crashdump/cris: Add print_crashkernel_region_size() function
  2015-12-08 21:57 ` [PATCH 06/14] crashdump/cris: " Daniel Kiper
@ 2015-12-09  2:55   ` Dave Young
  0 siblings, 0 replies; 18+ messages in thread
From: Dave Young @ 2015-12-09  2:55 UTC (permalink / raw)
  To: Daniel Kiper
  Cc: keir, konrad.wilk, andrew.cooper3, kexec, linux-kernel, horms,
	david.vrabel, xen-devel

On 12/08/15 at 10:57pm, Daniel Kiper wrote:
> 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.
> 
> Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
> ---
>  kexec/arch/cris/kexec-cris.c |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/kexec/arch/cris/kexec-cris.c b/kexec/arch/cris/kexec-cris.c
> index 4ac2f89..8c62191 100644
> --- a/kexec/arch/cris/kexec-cris.c
> +++ b/kexec/arch/cris/kexec-cris.c
> @@ -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.


> +}
> +
>  unsigned long virt_to_phys(unsigned long addr)
>  {
>  	return (addr) & 0x7fffffff;
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
> 
> 

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2015-12-09  2:56 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-08 21:57 [PATCH 00/14] kexec: Add option to get crash kernel region size Daniel Kiper
2015-12-08 21:57 ` [PATCH 01/14] purgatory: Add purgatory.map and purgatory.ro.sym to clean recipe Daniel Kiper
2015-12-08 21:57 ` [PATCH 02/14] kexec: Remove redundant space from help message Daniel Kiper
2015-12-08 21:57 ` [PATCH 03/14] crashdump: Remove stray get_crashkernel_region() declaration Daniel Kiper
2015-12-08 21:57 ` [PATCH 04/14] crashdump/x86: Add print_crashkernel_region_size() function Daniel Kiper
2015-12-08 21:57 ` [PATCH 05/14] crashdump/arm: " Daniel Kiper
2015-12-08 21:57 ` [PATCH 06/14] crashdump/cris: " Daniel Kiper
2015-12-09  2:55   ` Dave Young
2015-12-08 21:57 ` [PATCH 07/14] crashdump/ia64: " Daniel Kiper
2015-12-08 21:57 ` [PATCH 08/14] crashdump/m68k: " Daniel Kiper
2015-12-08 21:57 ` [PATCH 09/14] crashdump/mips: " Daniel Kiper
2015-12-08 21:57 ` [PATCH 10/14] crashdump/ppc: " Daniel Kiper
2015-12-09  2:51   ` Dave Young
2015-12-08 21:57 ` [PATCH 11/14] crashdump/ppc64: " Daniel Kiper
2015-12-09  2:52   ` Dave Young
2015-12-08 21:57 ` [PATCH 12/14] crashdump/s390: " Daniel Kiper
2015-12-08 21:57 ` [PATCH 13/14] crashdump/sh: " Daniel Kiper
2015-12-08 21:57 ` [PATCH 14/14] kexec: Add option to get crash kernel region size Daniel Kiper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox