Re: kexec on panic
Hi Denys, On 02/10/2017 03:14 AM, Denys Fedoryshchenko wrote: > After years of using kexec and recent unpleasant experience with modern > (supposed to be blazing fast to boot) hardware that need 5-10 minutes just to > pass POST tests, > one question came up to me: > Is it possible anyhow to execute regular (not special "panic" one to capture > crash data) kexec on panic to reduce reboot time? Generally, you don't want to do this, because various platform hardware might be in non-quiescent states (still doing DMA to random memory, etc.) and other nastiness that means you don't want to do more than the minimal amount in a kexec on panic (crash). We've seen no end of fun and games even with just regular crash dumps while hardware is busily writing to memory that it shouldn't be. An IOMMU helps, but isn't a cure-all. Jon. ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
[PATCH v5 07/11] crashdump/ppc: Add get_crash_kernel_load_range() function
From: Daniel KiperImplement get_crash_kernel_load_range() in support of print crash kernel region size option. Signed-off-by: Daniel Kiper Signed-off-by: Eric DeVolder Reviewed-by: Daniel Kiper --- v5: Incorporated feedback: - Removed extraneous setting of start and end in get_devtree_value() - changes for coding convention and formatting v4: Incorporated feedback: - changes for coding convention and formatting v3: Incorporated feedback: - changes for coding convention and formatting - restructured to introduce get_crash_kernel_load_range() for each architecture, and then a single function in kexec/kexec.c to call the per-architecture get_crash_kernel_load_range() and print the result. - changed print_crashkernel_region_size() to get_crash_kernel_load_range() - introduced get_devtree_value() v2: Incorporated feedback: - utilize the is_crashkernel_mem_reserved() function common in all archs - utilize device-tree values to print size v1: Posted to kexec-tools mailing list --- kexec/arch/ppc/crashdump-powerpc.c | 22 +- kexec/arch/ppc/kexec-ppc.c | 24 kexec/arch/ppc/kexec-ppc.h | 1 + 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/kexec/arch/ppc/crashdump-powerpc.c b/kexec/arch/ppc/crashdump-powerpc.c index 3dc35eb..dde6de7 100644 --- a/kexec/arch/ppc/crashdump-powerpc.c +++ b/kexec/arch/ppc/crashdump-powerpc.c @@ -16,6 +16,9 @@ #include "kexec-ppc.h" #include "crashdump-powerpc.h" +#define DEVTREE_CRASHKERNEL_BASE "/proc/device-tree/chosen/linux,crashkernel-base" +#define DEVTREE_CRASHKERNEL_SIZE "/proc/device-tree/chosen/linux,crashkernel-size" + #ifdef CONFIG_PPC64 static struct crash_elf_info elf_info64 = { class: ELFCLASS64, @@ -397,11 +400,28 @@ void add_usable_mem_rgns(unsigned long long base, unsigned long long size) usablemem_rgns.size, base, size); } +int get_crash_kernel_load_range(uint64_t *start, uint64_t *end) +{ + unsigned long long value; + + if (!get_devtree_value(DEVTREE_CRASHKERNEL_BASE, )) + *start = value; + else + return -1; + + if (!get_devtree_value(DEVTREE_CRASHKERNEL_SIZE, )) + *end = *start + value - 1; + else + return -1; + + return 0; +} + int is_crashkernel_mem_reserved(void) { int fd; - fd = open("/proc/device-tree/chosen/linux,crashkernel-base", O_RDONLY); + fd = open(DEVTREE_CRASHKERNEL_BASE, O_RDONLY); if (fd < 0) return 0; close(fd); diff --git a/kexec/arch/ppc/kexec-ppc.c b/kexec/arch/ppc/kexec-ppc.c index d046110..03bec36 100644 --- a/kexec/arch/ppc/kexec-ppc.c +++ b/kexec/arch/ppc/kexec-ppc.c @@ -423,6 +423,30 @@ err_out: return -1; } +/* Return 0 if fname/value valid, -1 otherwise */ +int get_devtree_value(const char *fname, unsigned long long *value) +{ + FILE *file; + char buf[MAXBYTES]; + int n = -1; + + if ((file = fopen(fname, "r"))) { + n = fread(buf, 1, MAXBYTES, file); + fclose(file); + } + + if (n == sizeof(uint32_t)) + *value = ((uint32_t *)buf)[0]; + else if (n == sizeof(uint64_t)) + *value = ((uint64_t *)buf)[0]; + else { + fprintf(stderr, "%s node has invalid size: %d\n", fname, n); + return -1; + } + + return 0; +} + /* Get devtree details and create exclude_range array * Also create usablemem_ranges for KEXEC_ON_CRASH */ diff --git a/kexec/arch/ppc/kexec-ppc.h b/kexec/arch/ppc/kexec-ppc.h index 904cf48..f8fd678 100644 --- a/kexec/arch/ppc/kexec-ppc.h +++ b/kexec/arch/ppc/kexec-ppc.h @@ -75,6 +75,7 @@ extern unsigned long dt_address_cells, dt_size_cells; extern int init_memory_region_info(void); extern int read_memory_region_limits(int fd, unsigned long long *start, unsigned long long *end); +extern int get_devtree_value(const char *fname, unsigned long long *pvalue); #define COMMAND_LINE_SIZE 512 /* from kernel */ /*fs2dt*/ void reserve(unsigned long long where, unsigned long long length); -- 2.7.4 ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
[PATCH v5 01/11] crashdump/arm: Add get_crash_kernel_load_range() function
From: Daniel KiperImplement get_crash_kernel_load_range() in support of print crash kernel region size option. Signed-off-by: Daniel Kiper Signed-off-by: Eric DeVolder Reviewed-by: Daniel Kiper --- v5: Incorporated feedback: - no changes for this arch v4: Incorporated feedback: - no changes for this arch v3: Incorporated feedback: - changes for coding convention and formatting - restructured to introduce get_crash_kernel_load_range() for each architecture, and then a single function in kexec/kexec.c to call the per-architecture get_crash_kernel_load_range() and print the result. - print_crashkernel_region_size() changed to get_crash_kernel_load_range() v2: Incorporated feedback: - no changes for this arch v1: Posted to kexec-tools mailing list --- kexec/arch/arm/crashdump-arm.c | 5 + 1 file changed, 5 insertions(+) diff --git a/kexec/arch/arm/crashdump-arm.c b/kexec/arch/arm/crashdump-arm.c index 4a89b5e..ac76e0a 100644 --- a/kexec/arch/arm/crashdump-arm.c +++ b/kexec/arch/arm/crashdump-arm.c @@ -413,3 +413,8 @@ int is_crashkernel_mem_reserved(void) return crash_kernel_mem.start != crash_kernel_mem.end; } + +int get_crash_kernel_load_range(uint64_t *start, uint64_t *end) +{ + return parse_iomem_single("Crash kernel\n", start, end); +} -- 2.7.4 ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
[PATCH v5 10/11] crashdump/sh: Add get_crash_kernel_load_range() function
From: Daniel KiperImplement get_crash_kernel_load_range() in support of print crash kernel region size option. Signed-off-by: Daniel Kiper Signed-off-by: Eric DeVolder Reviewed-by: Daniel Kiper --- v5: Incorporated feedback: - no changes for this arch v4: Incorporated feedback: - no changes for this arch v3: Incorporated feedback: - changes for coding convention and formatting - restructured to introduce get_crash_kernel_load_range() for each architecture, and then a single function in kexec/kexec.c to call the per-architecture get_crash_kernel_load_range() and print the result. - print_crashkernel_region_size() changed to get_crash_kernel_load_range() v2: Incorporated feedback: - no changes for this arch v1: Posted to kexec-tools mailing list --- kexec/arch/sh/crashdump-sh.c | 5 + 1 file changed, 5 insertions(+) diff --git a/kexec/arch/sh/crashdump-sh.c b/kexec/arch/sh/crashdump-sh.c index 9e6af6b..aa25dea 100644 --- a/kexec/arch/sh/crashdump-sh.c +++ b/kexec/arch/sh/crashdump-sh.c @@ -178,3 +178,8 @@ int is_crashkernel_mem_reserved(void) return parse_iomem_single("Crash kernel\n", , ) == 0 ? (start != end) : 0; } + +int get_crash_kernel_load_range(uint64_t *start, uint64_t *end) +{ + return parse_iomem_single("Crash kernel\n", start, end); +} -- 2.7.4 ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
[PATCH v5 00/11] kexec: Add option to get crash kernel region size
This is the fifth version of a patch series originally posted by Daniel Kiper on December 5. This version differs from the previous version based on feedback received from the mailing list, as such: v5: Incorporated feedback: - for ppc/ppc64, slight enhancement to get_devtree_value() - fix indentation in print_crash_kernel_load_range() - additional changes for coding convention and formatting v4: Incorporated feedback: - additional changes for coding convention and formatting v3: Incorporated feedback: - changes for coding convention and formatting - restructured to introduce get_crash_kernel_load_range() for each architecture, and then a single function in kexec/kexec.c to call the per-architecture get_crash_kernel_load_range() and print the result. v2: Incorporated feedback: - utilize the is_crashkernel_mem_reserved() function common in all archs - for ppc and ppc64, utilize device-tree values to print size - for unsupported architectures, print appropriate message v1: Posted to kexec-tools mailing list Eric Daniel Kiper (10): crashdump/arm: Add get_crash_kernel_load_range() function crashdump/cris: Add get_crash_kernel_load_range() function crashdump/ia64: Add get_crash_kernel_load_range() function crashdump/m68k: Add get_crash_kernel_load_range() function crashdump/mips: Add get_crash_kernel_load_range() function crashdump/ppc: Add get_crash_kernel_load_range() function crashdump/ppc64: Add get_crash_kernel_load_range() function crashdump/s390: Add get_crash_kernel_load_range() function crashdump/sh: Add get_crash_kernel_load_range() function kexec: Add option to get crash kernel region size Eric DeVolder (1): crashdump/arm64: Add get_crash_kernel_load_range() function kexec/arch/arm/crashdump-arm.c | 5 + kexec/arch/arm64/crashdump-arm64.c | 6 ++ kexec/arch/cris/kexec-cris.c | 6 ++ kexec/arch/ia64/crashdump-ia64.c | 5 + kexec/arch/m68k/kexec-m68k.c | 6 ++ kexec/arch/mips/crashdump-mips.c | 4 kexec/arch/ppc/crashdump-powerpc.c | 22 +- kexec/arch/ppc/kexec-ppc.c | 24 kexec/arch/ppc/kexec-ppc.h | 1 + kexec/arch/ppc64/crashdump-ppc64.c | 22 +- kexec/arch/ppc64/kexec-ppc64.c | 24 kexec/arch/ppc64/kexec-ppc64.h | 2 ++ kexec/arch/s390/kexec-s390.c | 5 + kexec/arch/sh/crashdump-sh.c | 5 + kexec/kexec.8 | 3 +++ kexec/kexec.c | 16 kexec/kexec.h | 4 +++- 17 files changed, 157 insertions(+), 3 deletions(-) -- 2.7.4 ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
[PATCH v5 08/11] crashdump/ppc64: Add get_crash_kernel_load_range() function
From: Daniel KiperImplement get_crash_kernel_load_range() in support of print crash kernel region size option. Signed-off-by: Daniel Kiper Signed-off-by: Eric DeVolder Reviewed-by: Daniel Kiper --- v5: Incorporated feedback: - Removed extraneous setting of start and end in get_devtree_value() - changes for coding convention and formatting v4: Incorporated feedback: - changes for coding convention and formatting v3: Incorporated feedback: - changes for coding convention and formatting - restructured to introduce get_crash_kernel_load_range() for each architecture, and then a single function in kexec/kexec.c to call the per-architecture get_crash_kernel_load_range() and print the result. - changed print_crashkernel_region_size() to get_crash_kernel_load_range() - introduced get_devtree_value() v2: Incorporated feedback: - utilize the is_crashkernel_mem_reserved() function common in all archs - utilize device-tree values to print size v1: Posted to kexec-tools mailing list --- kexec/arch/ppc64/crashdump-ppc64.c | 22 +- kexec/arch/ppc64/kexec-ppc64.c | 24 kexec/arch/ppc64/kexec-ppc64.h | 2 ++ 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/kexec/arch/ppc64/crashdump-ppc64.c b/kexec/arch/ppc64/crashdump-ppc64.c index f62b159..5a71d51 100644 --- a/kexec/arch/ppc64/crashdump-ppc64.c +++ b/kexec/arch/ppc64/crashdump-ppc64.c @@ -36,6 +36,9 @@ #include "../../fs2dt.h" #include "crashdump-ppc64.h" +#define DEVTREE_CRASHKERNEL_BASE "/proc/device-tree/chosen/linux,crashkernel-base" +#define DEVTREE_CRASHKERNEL_SIZE "/proc/device-tree/chosen/linux,crashkernel-size" + static struct crash_elf_info elf_info64 = { class: ELFCLASS64, @@ -526,11 +529,28 @@ void add_usable_mem_rgns(unsigned long long base, unsigned long long size) usablemem_rgns.size, base, size); } +int get_crash_kernel_load_range(uint64_t *start, uint64_t *end) +{ + unsigned long long value; + + if (!get_devtree_value(DEVTREE_CRASHKERNEL_BASE, )) + *start = value; + else + return -1; + + if (!get_devtree_value(DEVTREE_CRASHKERNEL_SIZE, )) + *end = *start + value - 1; + else + return -1; + + return 0; +} + int is_crashkernel_mem_reserved(void) { int fd; - fd = open("/proc/device-tree/chosen/linux,crashkernel-base", O_RDONLY); + fd = open(DEVTREE_CRASHKERNEL_BASE, O_RDONLY); if (fd < 0) return 0; close(fd); diff --git a/kexec/arch/ppc64/kexec-ppc64.c b/kexec/arch/ppc64/kexec-ppc64.c index 09ee025..6e8c175 100644 --- a/kexec/arch/ppc64/kexec-ppc64.c +++ b/kexec/arch/ppc64/kexec-ppc64.c @@ -356,6 +356,30 @@ void scan_reserved_ranges(unsigned long kexec_flags, int *range_index) *range_index = i; } +/* Return 0 if fname/value valid, -1 otherwise */ +int get_devtree_value(const char *fname, unsigned long long *value) +{ + FILE *file; + char buf[MAXBYTES]; + int n = -1; + + if ((file = fopen(fname, "r"))) { + n = fread(buf, 1, MAXBYTES, file); + fclose(file); + } + + if (n == sizeof(uint32_t)) + *value = ((uint32_t *)buf)[0]; + else if (n == sizeof(uint64_t)) + *value = ((uint64_t *)buf)[0]; + else { + fprintf(stderr, "%s node has invalid size: %d\n", fname, n); + return -1; + } + + return 0; +} + /* Get devtree details and create exclude_range array * Also create usablemem_ranges for KEXEC_ON_CRASH */ diff --git a/kexec/arch/ppc64/kexec-ppc64.h b/kexec/arch/ppc64/kexec-ppc64.h index 89ee942..633ae77 100644 --- a/kexec/arch/ppc64/kexec-ppc64.h +++ b/kexec/arch/ppc64/kexec-ppc64.h @@ -14,6 +14,8 @@ #define HAVE_DYNAMIC_MEMORY #define NEED_RESERVE_DTB +extern int get_devtree_value(const char *fname, unsigned long long *pvalue); + int setup_memory_ranges(unsigned long kexec_flags); int elf_ppc64_probe(const char *buf, off_t len); -- 2.7.4 ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
[PATCH v5 05/11] crashdump/m68k: Add get_crash_kernel_load_range() function
From: Daniel KiperProvide stub get_crash_kernel_load_range() in support of print crash kernel region size option. Signed-off-by: Daniel Kiper Signed-off-by: Eric DeVolder Reviewed-by: Daniel Kiper --- v5: Incorporated feedback: - no changes for this arch v4: Incorporated feedback: - Changed commit description to make it clear that get_crash_kernel_load_range() is a stub v3: Incorporated feedback: - changes for coding convention and formatting - restructured to introduce get_crash_kernel_load_range() for each architecture, and then a single function in kexec/kexec.c to call the per-architecture get_crash_kernel_load_range() and print the result. v2: Incorporated feedback: - unsupported architectures, print appropriate message v1: Posted to kexec-tools mailing list --- kexec/arch/m68k/kexec-m68k.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/kexec/arch/m68k/kexec-m68k.c b/kexec/arch/m68k/kexec-m68k.c index 372aa37..cb54927 100644 --- a/kexec/arch/m68k/kexec-m68k.c +++ b/kexec/arch/m68k/kexec-m68k.c @@ -89,6 +89,12 @@ int is_crashkernel_mem_reserved(void) return 0; } +int get_crash_kernel_load_range(uint64_t *start, uint64_t *end) +{ + /* Crash kernel region size is not exposed by the system */ + return -1; +} + unsigned long virt_to_phys(unsigned long addr) { return addr + m68k_memoffset; -- 2.7.4 ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
[PATCH v5 03/11] crashdump/cris: Add get_crash_kernel_load_range() function
From: Daniel KiperProvide stub get_crash_kernel_load_range() in support of print crash kernel region size option. Signed-off-by: Daniel Kiper Signed-off-by: Eric DeVolder Reviewed-by: Daniel Kiper --- v5: Incorporated feedback: - no changes for this arch v4: Incorporated feedback: - Changed commit description to make it clear that get_crash_kernel_load_range() is a stub v3: Incorporated feedback: - changes for coding convention and formatting - restructured to introduce get_crash_kernel_load_range() for each architecture, and then a single function in kexec/kexec.c to call the per-architecture get_crash_kernel_load_range() and print the result. v2: Incorporated feedback: - unsupported architectures, print appropriate message v1: Posted to kexec-tools mailing list --- kexec/arch/cris/kexec-cris.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/kexec/arch/cris/kexec-cris.c b/kexec/arch/cris/kexec-cris.c index 4ac2f89..3b69709 100644 --- a/kexec/arch/cris/kexec-cris.c +++ b/kexec/arch/cris/kexec-cris.c @@ -77,6 +77,12 @@ int is_crashkernel_mem_reserved(void) return 0; } +int get_crash_kernel_load_range(uint64_t *start, uint64_t *end) +{ + /* Crash kernel region size is not exposed by the system */ + return -1; +} + unsigned long virt_to_phys(unsigned long addr) { return (addr) & 0x7fff; -- 2.7.4 ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
[PATCH v5 11/11] kexec: Add option to get crash kernel region size
From: 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. Signed-off-by: Daniel Kiper Signed-off-by: Eric DeVolder Reviewed-by: Daniel Kiper --- v5: Incorporated feedback: - Fixed indentation in print_crash_kernel_load_range() - changes for coding convention and formatting v4: Incorporated feedback: - changes for coding convention and formatting - Changed commit description to make it clear that get_crash_kernel_load_range() is a stub on some archs v3: Incorporated feedback: - changes for coding convention and formatting - restructured to introduce get_crash_kernel_load_range() for each architecture, and then a single function in kexec/kexec.c to call the per-architecture get_crash_kernel_load_range() and print the result. v2: Incorporated feedback: - utilize the is_crashkernel_mem_reserved() function common in all archs - for ppc and ppc64, utilize device-tree values to print size - for unsupported architectures, print appropriate message v1: Posted to kexec-tools mailing list --- kexec/kexec.8 | 3 +++ kexec/kexec.c | 16 kexec/kexec.h | 4 +++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/kexec/kexec.8 b/kexec/kexec.8 index f4b39a6..e0131b4 100644 --- a/kexec/kexec.8 +++ b/kexec/kexec.8 @@ -179,6 +179,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, if available. .SH SUPPORTED KERNEL FILE TYPES AND OPTIONS diff --git a/kexec/kexec.c b/kexec/kexec.c index a2ba79d..cfd837c 100644 --- a/kexec/kexec.c +++ b/kexec/kexec.c @@ -995,6 +995,7 @@ void usage(void) " --mem-max= Specify the highest memory address to\n" " load code into.\n" " --reuseinitrdReuse 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" @@ -1218,6 +1219,18 @@ static int do_kexec_file_load(int fileind, int argc, char **argv, return ret; } +static void print_crashkernel_region_size(void) +{ + uint64_t start = 0, end = 0; + + if (is_crashkernel_mem_reserved() && + get_crash_kernel_load_range(, )) { + fprintf(stderr, "get_crash_kernel_load_range() failed.\n"); + return; + } + + printf("%lu\n", (start != end) ? (end - start + 1) : 0UL); +} int main(int argc, char *argv[]) { @@ -1375,6 +1388,9 @@ int main(int argc, char *argv[]) case OPT_STATUS: do_status = 1; 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 2b06f59..52bef9b 100644 --- a/kexec/kexec.h +++ b/kexec/kexec.h @@ -226,7 +226,8 @@ extern int file_types; #define OPT_LOAD_PRESERVE_CONTEXT 259 #define OPT_LOAD_JUMP_BACK_HELPER 260 #define OPT_ENTRY 261 -#define OPT_MAX262 +#define OPT_PRINT_CKR_SIZE 262 +#define OPT_MAX263 #define KEXEC_OPTIONS \ { "help", 0, 0, OPT_HELP }, \ { "version",0, 0, OPT_VERSION }, \ @@ -247,6 +248,7 @@ extern int file_types; { "kexec-file-syscall", 0, 0, OPT_KEXEC_FILE_SYSCALL }, \ { "debug", 0, 0, OPT_DEBUG }, \ { "status", 0, 0, OPT_STATUS }, \ + { "print-ckr-size", 0, 0, OPT_PRINT_CKR_SIZE }, \ #define KEXEC_OPT_STR "h?vdfxyluet:psS" -- 2.7.4 ___ kexec mailing list
[PATCH v5 06/11] crashdump/mips: Add get_crash_kernel_load_range() function
From: Daniel KiperImplement get_crash_kernel_load_range() in support of print crash kernel region size option. Signed-off-by: Daniel Kiper Signed-off-by: Eric DeVolder Reviewed-by: Daniel Kiper --- v5: Incorporated feedback: - no changes for this arch v4: Incorporated feedback: - no changes for this arch v3: Incorporated feedback: - changes for coding convention and formatting - restructured to introduce get_crash_kernel_load_range() for each architecture, and then a single function in kexec/kexec.c to call the per-architecture get_crash_kernel_load_range() and print the result. - print_crashkernel_region_size() changed to get_crash_kernel_load_range() v2: Incorporated feedback: - no changes for this arch v1: Posted to kexec-tools mailing list --- kexec/arch/mips/crashdump-mips.c | 4 1 file changed, 4 insertions(+) diff --git a/kexec/arch/mips/crashdump-mips.c b/kexec/arch/mips/crashdump-mips.c index d6cff5a..9c33599 100644 --- a/kexec/arch/mips/crashdump-mips.c +++ b/kexec/arch/mips/crashdump-mips.c @@ -385,3 +385,7 @@ int is_crashkernel_mem_reserved(void) (start != end) : 0; } +int get_crash_kernel_load_range(uint64_t *start, uint64_t *end) +{ + return parse_iomem_single("Crash kernel\n", start, end); +} -- 2.7.4 ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
[PATCH v5 04/11] crashdump/ia64: Add get_crash_kernel_load_range() function
From: Daniel KiperImplement get_crash_kernel_load_range() in support of print crash kernel region size option. Signed-off-by: Daniel Kiper Signed-off-by: Eric DeVolder Reviewed-by: Daniel Kiper --- v5: Incorporated feedback: - no changes for this arch v4: Incorporated feedback: - no changes for this arch v3: Incorporated feedback: - changes for coding convention and formatting - restructured to introduce get_crash_kernel_load_range() for each architecture, and then a single function in kexec/kexec.c to call the per-architecture get_crash_kernel_load_range() and print the result. - print_crashkernel_region_size() changed to get_crash_kernel_load_range() v2: Incorporated feedback: - no changes for this arch v1: Posted to kexec-tools mailing list --- kexec/arch/ia64/crashdump-ia64.c | 5 + 1 file changed, 5 insertions(+) diff --git a/kexec/arch/ia64/crashdump-ia64.c b/kexec/arch/ia64/crashdump-ia64.c index 726c9f4..755ee5e 100644 --- a/kexec/arch/ia64/crashdump-ia64.c +++ b/kexec/arch/ia64/crashdump-ia64.c @@ -286,3 +286,8 @@ int is_crashkernel_mem_reserved(void) return parse_iomem_single("Crash kernel\n", , ) == 0 ? (start != end) : 0; } + +int get_crash_kernel_load_range(uint64_t *start, uint64_t *end) +{ + return parse_iomem_single("Crash kernel\n", start, end); +} -- 2.7.4 ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
[PATCH v5 02/11] crashdump/arm64: Add get_crash_kernel_load_range() function
Provide stub get_crash_kernel_load_range() in support of print crash kernel region size option. Signed-off-by: Eric DeVolderReviewed-by: Daniel Kiper --- v5: Incorporated feedback: - no changes for this arch v4: Incorporated feedback: - Changed commit description to make it clear that get_crash_kernel_load_range() is a stub v3: Incorporated feedback: - changes for coding convention and formatting - restructured to introduce get_crash_kernel_load_range() for each architecture, and then a single function in kexec/kexec.c to call the per-architecture get_crash_kernel_load_range() and print the result. v2: Incorporated feedback: - unsupported architectures, print appropriate message v1: Posted to kexec-tools mailing list --- kexec/arch/arm64/crashdump-arm64.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/kexec/arch/arm64/crashdump-arm64.c b/kexec/arch/arm64/crashdump-arm64.c index d2272c8..b0e4713 100644 --- a/kexec/arch/arm64/crashdump-arm64.c +++ b/kexec/arch/arm64/crashdump-arm64.c @@ -19,3 +19,9 @@ int is_crashkernel_mem_reserved(void) { return 0; } + +int get_crash_kernel_load_range(uint64_t *start, uint64_t *end) +{ + /* Crash kernel region size is not exposed by the system */ + return -1; +} -- 2.7.4 ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
[PATCH v5 09/11] crashdump/s390: Add get_crash_kernel_load_range() function
From: Daniel KiperImplement get_crash_kernel_load_range() in support of print crash kernel region size option. Signed-off-by: Daniel Kiper Signed-off-by: Eric DeVolder Reviewed-by: Daniel Kiper --- v5: Incorporated feedback: - no changes for this arch v4: Incorporated feedback: - no changes for this arch v3: Incorporated feedback: - changes for coding convention and formatting - restructured to introduce get_crash_kernel_load_range() for each architecture, and then a single function in kexec/kexec.c to call the per-architecture get_crash_kernel_load_range() and print the result. - print_crashkernel_region_size() changed to get_crash_kernel_load_range() v2: Incorporated feedback: - no changes for this arch v1: Posted to kexec-tools mailing list --- kexec/arch/s390/kexec-s390.c | 5 + 1 file changed, 5 insertions(+) diff --git a/kexec/arch/s390/kexec-s390.c b/kexec/arch/s390/kexec-s390.c index 074575e..f863483 100644 --- a/kexec/arch/s390/kexec-s390.c +++ b/kexec/arch/s390/kexec-s390.c @@ -262,3 +262,8 @@ int is_crashkernel_mem_reserved(void) return parse_iomem_single("Crash kernel\n", , ) == 0 ? (start != end) : 0; } + +int get_crash_kernel_load_range(uint64_t *start, uint64_t *end) +{ + return parse_iomem_single("Crash kernel\n", start, end); +} -- 2.7.4 ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH] x86/mce: Keep quiet in case of broadcasted mce after system panic
On 02/17/2017 at 05:07 PM, Borislav Petkov wrote: > On Fri, Feb 17, 2017 at 09:53:21AM +0800, Xunlei Pang wrote: >> It changes the value of cpu_online_mask/etc which will cause confusion to >> vmcore analysis. > Then export the crashing_cpu variable, initialize it to something > invalid in the first kernel, -1 for example, and test it in the #MC > handlier like this: > > int cpu; > > ... > > cpu = smp_processor_id(); > > if (cpu_is_offline(cpu) || > ((crashing_cpu != -1) && (crashing_cpu != cpu)) { > u64 mcgstatus; > > mcgstatus = mce_rdmsrl(MSR_IA32_MCG_STATUS); > if (mcgstatus & MCG_STATUS_RIPV) { > mce_wrmsrl(MSR_IA32_MCG_STATUS, 0); > return; > } > } Yes, it is doable, I will do some tests later. >> Moreover, for the code(see comment inlined) >> >> if (cpu_is_offline(smp_processor_id())) { >> u64 mcgstatus; >> >> mcgstatus = mce_rdmsrl(MSR_IA32_MCG_STATUS); >> if (mcgstatus & MCG_STATUS_RIPV) { // This condition may be >> not true, the mce triggered on kdump cpu >> // >> doesn't need to have this bit set for the other cpus remain in 1st kernel. > Is this on kvm or on a real hardware? Because for kvm I don't care. And > don't say "theoretically". > It's from my understanding, I didn't get the explicit description from the intel SDM on this point. If a broadcast SRAO comes on real hardware, will MSR_IA32_MCG_STATUS of each cpu have MCG_STATUS_RIPV bit set? Regards, Xunlei ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH v32 06/13] arm64: kdump: protect crash dump kernel memory
Hi Akashi, On 07/02/17 08:08, AKASHI Takahiro wrote: > arch_kexec_protect_crashkres() and arch_kexec_unprotect_crashkres() > are meant to be called by kexec_load() in order to protect the memory > allocated for crash dump kernel once it's loaded. > > Here, the protection is implemented by unmapping the relevant range > of memory, rather than making it read-only, to prevent any corruption > due to potential cache alias (with different attributes) problem. > > To make the things work correctly, we have to > - use page-level mappings entirely > - have the mappings isolated from the other normal memory > - move copying kexec's control_code_page to machine_kexec_prepare() > > Note that page-level mappings are required to allow shrinking the region, > through /sys/kernel/kexec_crash_size, to the size of any number of pages > and putting the freed memory back to buddy system. This shrinking means memory marked memblock:reserve gets used by the slab allocator. This makes me feel uneasy, but I agree its not going to break anything, and we can't easily un-reserve it. The temporary no-map when building the linear map is a neat trick! Reviewed-by: James MorseThis patch will conflict with Ard's 'arm64: mmu: avoid writeable-executable mappings' series[0], but they may be complimentary as he adds a update_mapping_prot() call in patch 2 [1] which has a similar use-case. Thanks, James [0] https://www.spinics.net/lists/arm-kernel/msg562724.html [1] https://www.spinics.net/lists/arm-kernel/msg562726.html ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH] x86/mce: Keep quiet in case of broadcasted mce after system panic
On Fri, Feb 17, 2017 at 09:53:21AM +0800, Xunlei Pang wrote: > It changes the value of cpu_online_mask/etc which will cause confusion to > vmcore analysis. Then export the crashing_cpu variable, initialize it to something invalid in the first kernel, -1 for example, and test it in the #MC handlier like this: int cpu; ... cpu = smp_processor_id(); if (cpu_is_offline(cpu) || ((crashing_cpu != -1) && (crashing_cpu != cpu)) { u64 mcgstatus; mcgstatus = mce_rdmsrl(MSR_IA32_MCG_STATUS); if (mcgstatus & MCG_STATUS_RIPV) { mce_wrmsrl(MSR_IA32_MCG_STATUS, 0); return; } } > Moreover, for the code(see comment inlined) > > if (cpu_is_offline(smp_processor_id())) { > u64 mcgstatus; > > mcgstatus = mce_rdmsrl(MSR_IA32_MCG_STATUS); > if (mcgstatus & MCG_STATUS_RIPV) { // This condition may be > not true, the mce triggered on kdump cpu > // > doesn't need to have this bit set for the other cpus remain in 1st kernel. Is this on kvm or on a real hardware? Because for kvm I don't care. And don't say "theoretically". -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply. ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec