kexec: Add option to get crash kernel region size
Subsystems (2)
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
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
@@ -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
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
@@ -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
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
@@ -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
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
@@ -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
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
@@ -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
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
@@ -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
PATCH 4/14 crashdump/x86: Add print_crashkernel_region_size() function
In reply to Daniel KiperCrash 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
@@ -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
PATCH 4/14 crashdump/x86: Add print_crashkernel_region_size() function
In reply to Daniel KiperCrash 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
@@ -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
PATCH 5/14 crashdump/arm: Add print_crashkernel_region_size() function
In reply to Daniel KiperFollow similar x86 patch.
--- kexec/arch/arm/crashdump-arm.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
kexec/arch/arm/crashdump-arm.c +10 -0
@@ -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
PATCH 5/14 crashdump/arm: Add print_crashkernel_region_size() function
In reply to Daniel KiperFollow similar x86 patch.
--- kexec/arch/arm/crashdump-arm.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
kexec/arch/arm/crashdump-arm.c +10 -0
@@ -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
PATCH 6/14 crashdump/cris: Add print_crashkernel_region_size() function
In reply to Daniel KiperProvide 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
@@ -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
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.Signed-off-by Daniel Kiper <[email protected]>--- kexec/arch/cris/kexec-cris.c | 5 +++++ 1 file changed, 5 insertions(+)kexec/arch/cris/kexec-cris.c +0
-0
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
Re: [PATCH 06/14] crashdump/cris: Add print_crashkernel_region_size() function
In reply to Daniel KiperQuoted 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.Signed-off-by Daniel Kiper <[email protected]>--- kexec/arch/cris/kexec-cris.c | 5 +++++ 1 file changed, 5 insertions(+)kexec/arch/cris/kexec-cris.c +0
-0
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
PATCH 6/14 crashdump/cris: Add print_crashkernel_region_size() function
In reply to Daniel KiperProvide 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
@@ -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
PATCH 7/14 crashdump/ia64: Add print_crashkernel_region_size() function
In reply to Daniel KiperFollow similar x86 patch.
--- kexec/arch/ia64/crashdump-ia64.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
kexec/arch/ia64/crashdump-ia64.c +10 -0
@@ -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
PATCH 7/14 crashdump/ia64: Add print_crashkernel_region_size() function
In reply to Daniel KiperFollow similar x86 patch.
--- kexec/arch/ia64/crashdump-ia64.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
kexec/arch/ia64/crashdump-ia64.c +10 -0
@@ -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
PATCH 8/14 crashdump/m68k: Add print_crashkernel_region_size() function
In reply to Daniel KiperProvide 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
@@ -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
PATCH 8/14 crashdump/m68k: Add print_crashkernel_region_size() function
In reply to Daniel KiperProvide 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
@@ -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
PATCH 9/14 crashdump/mips: Add print_crashkernel_region_size() function
In reply to Daniel KiperFollow similar x86 patch.
--- kexec/arch/mips/crashdump-mips.c | 9 +++++++++ 1 file changed, 9 insertions(+)
kexec/arch/mips/crashdump-mips.c +9 -0
@@ -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
PATCH 9/14 crashdump/mips: Add print_crashkernel_region_size() function
In reply to Daniel KiperFollow similar x86 patch.
--- kexec/arch/mips/crashdump-mips.c | 9 +++++++++ 1 file changed, 9 insertions(+)
kexec/arch/mips/crashdump-mips.c +9 -0
@@ -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
PATCH 10/14 crashdump/ppc: Add print_crashkernel_region_size() function
In reply to Daniel KiperProvide 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
@@ -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
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
Signed-off-by Daniel Kiper <[email protected]>--- kexec/arch/ppc/crashdump-powerpc.c | 4 ++++ 1 file changed, 4 insertions(+)kexec/arch/ppc/crashdump-powerpc.c +4
-0@@ -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
Re: [PATCH 10/14] crashdump/ppc: Add print_crashkernel_region_size() function
In reply to Daniel KiperQuoted 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
Signed-off-by Daniel Kiper <[email protected]>--- kexec/arch/ppc/crashdump-powerpc.c | 4 ++++ 1 file changed, 4 insertions(+)kexec/arch/ppc/crashdump-powerpc.c +4
-0@@ -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
PATCH 10/14 crashdump/ppc: Add print_crashkernel_region_size() function
In reply to Daniel KiperProvide 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
@@ -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
PATCH 11/14 crashdump/ppc64: Add print_crashkernel_region_size() function
In reply to Daniel KiperProvide 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
@@ -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
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
Signed-off-by Daniel Kiper <[email protected]>--- kexec/arch/ppc64/crashdump-ppc64.c | 5 +++++ 1 file changed, 5 insertions(+)kexec/arch/ppc64/crashdump-ppc64.c +5
-0@@ -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
Re: [PATCH 11/14] crashdump/ppc64: Add print_crashkernel_region_size() function
In reply to Daniel KiperQuoted 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
Signed-off-by Daniel Kiper <[email protected]>--- kexec/arch/ppc64/crashdump-ppc64.c | 5 +++++ 1 file changed, 5 insertions(+)kexec/arch/ppc64/crashdump-ppc64.c +5
-0@@ -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
PATCH 11/14 crashdump/ppc64: Add print_crashkernel_region_size() function
In reply to Daniel KiperProvide 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
@@ -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
PATCH 12/14 crashdump/s390: Add print_crashkernel_region_size() function
In reply to Daniel KiperFollow similar x86 patch.
--- kexec/arch/s390/kexec-s390.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
kexec/arch/s390/kexec-s390.c +10 -0
@@ -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
PATCH 12/14 crashdump/s390: Add print_crashkernel_region_size() function
In reply to Daniel KiperFollow similar x86 patch.
--- kexec/arch/s390/kexec-s390.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
kexec/arch/s390/kexec-s390.c +10 -0
@@ -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
PATCH 13/14 crashdump/sh: Add print_crashkernel_region_size() function
In reply to Daniel KiperFollow similar x86 patch.
--- kexec/arch/sh/crashdump-sh.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
kexec/arch/sh/crashdump-sh.c +10 -0
@@ -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
PATCH 13/14 crashdump/sh: Add print_crashkernel_region_size() function
In reply to Daniel KiperFollow similar x86 patch.
--- kexec/arch/sh/crashdump-sh.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
kexec/arch/sh/crashdump-sh.c +10 -0
@@ -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
PATCH 14/14 kexec: Add option to get crash kernel region size
In reply to Daniel KiperHere 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
@@ -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
@@ -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
@@ -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
PATCH 14/14 kexec: Add option to get crash kernel region size
In reply to Daniel KiperHere 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
@@ -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
@@ -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
@@ -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