Skip to contentSkip to conversation

kdump: Common code changes for s390 kdump support

PATCH In review Michael Holzheu 4 participants 7 messages Aug 19, 2011 – Aug 22, 2011

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

cover kdump: Common code changes for s390 kdump support

Hello Andrew,

I had a long discussion with Vivek Goyal on the s390 kdump support (thanks Vivek for all the time!). As a result of this, here are two common code patches that are required for the s390 port. Could you please integrate them upstream in the next merge window? The s390 specific part will be integrated by our s390 maintainer Martin Schwidefsky.

I will be on vacation for the next two weeks. Therefore if you have comments or questions, please contact also Martin Schwidefsky and Heiko Carstens.

Thanks

Michael

#1 lore raw

PATCH 1/2 kdump: Add KEXEC_CRASH_CONTROL_MEMORY_LIMIT

From: Michael Holzheu <[email protected]>

On s390 there is a different KEXEC_CONTROL_MEMORY_LIMIT for the normal and the kdump kexec case. Therefore this patch introduces a new macro KEXEC_CRASH_CONTROL_MEMORY_LIMIT. This is set to KEXEC_CONTROL_MEMORY_LIMIT for all architectures that do not define KEXEC_CRASH_CONTROL_MEMORY_LIMIT.

---
 include/linux/kexec.h |    4 ++++
 kernel/kexec.c        |    2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
include/linux/kexec.h +4 -0
@@ -33,6 +33,10 @@
 #error KEXEC_ARCH not defined
 #endif
 
+#ifndef KEXEC_CRASH_CONTROL_MEMORY_LIMIT
+#define KEXEC_CRASH_CONTROL_MEMORY_LIMIT KEXEC_CONTROL_MEMORY_LIMIT
+#endif
+
 #define KEXEC_NOTE_HEAD_BYTES ALIGN(sizeof(struct elf_note), 4)
 #define KEXEC_CORE_NOTE_NAME "CORE"
 #define KEXEC_CORE_NOTE_NAME_BYTES ALIGN(sizeof(KEXEC_CORE_NOTE_NAME), 4)
kernel/kexec.c +1 -1
@@ -498,7 +498,7 @@ static struct page *kimage_alloc_crash_c
 	while (hole_end <= crashk_res.end) {
 		unsigned long i;
 
-		if (hole_end > KEXEC_CONTROL_MEMORY_LIMIT)
+		if (hole_end > KEXEC_CRASH_CONTROL_MEMORY_LIMIT)
 			break;
 		if (hole_end > crashk_res.end)
 			break;
Acked-by on v1 1/2
#2 lore raw

Re: [patch 1/2] kdump: Add KEXEC_CRASH_CONTROL_MEMORY_LIMIT

Quoted 9 lines · Michael Holzheu

From: Michael Holzheu <[email protected]>

On s390 there is a different KEXEC_CONTROL_MEMORY_LIMIT for the normal and the kdump kexec case. Therefore this patch introduces a new macro KEXEC_CRASH_CONTROL_MEMORY_LIMIT. This is set to KEXEC_CONTROL_MEMORY_LIMIT for all architectures that do not define KEXEC_CRASH_CONTROL_MEMORY_LIMIT.

Looks good to me.

Vivek

Quoted 29 lines
---
 include/linux/kexec.h |    4 ++++
 kernel/kexec.c        |    2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
include/linux/kexec.h +4 -0
@@ -33,6 +33,10 @@
 #error KEXEC_ARCH not defined
 #endif
 
+#ifndef KEXEC_CRASH_CONTROL_MEMORY_LIMIT
+#define KEXEC_CRASH_CONTROL_MEMORY_LIMIT KEXEC_CONTROL_MEMORY_LIMIT
+#endif
+
 #define KEXEC_NOTE_HEAD_BYTES ALIGN(sizeof(struct elf_note), 4)
 #define KEXEC_CORE_NOTE_NAME "CORE"
 #define KEXEC_CORE_NOTE_NAME_BYTES ALIGN(sizeof(KEXEC_CORE_NOTE_NAME), 4)
kernel/kexec.c +1 -1
@@ -498,7 +498,7 @@ static struct page *kimage_alloc_crash_c
 	while (hole_end <= crashk_res.end) {
 		unsigned long i;
 
-		if (hole_end > KEXEC_CONTROL_MEMORY_LIMIT)
+		if (hole_end > KEXEC_CRASH_CONTROL_MEMORY_LIMIT)
 			break;
 		if (hole_end > crashk_res.end)
 			break;
#3 lore raw

PATCH 2/2 kdump: Add size to elfcorehdr kernel parameter

In reply to Michael Holzheu

From: Michael Holzheu <[email protected]>

Currently only the address of the pre-allocated ELF header is passed with the elfcorehdr= kernel parameter. In order to reserve memory for the header in the 2nd kernel also the size is required. Current kdump architecture backends use different methods to do that, e.g. x86 uses the memmap= kernel parameter. On s390 there is no easy way to transfer this information. Therefore the elfcorehdr kernel parameter is extended to also pass the size. This now can also be used as standard mechanism by all future kdump architecture backends.

The syntax of the kernel parameter is extended as follows:

elfcorehdr=[size[KMG]@]offset[KMG]

This change is backward compatible because elfcorehdr=size is still allowed.

---
 Documentation/kernel-parameters.txt |    6 +++---
 include/linux/crash_dump.h          |    1 +
 kernel/crash_dump.c                 |   11 +++++++++++
 3 files changed, 15 insertions(+), 3 deletions(-)
Documentation/kernel-parameters.txt +3 -3
@@ -727,10 +727,10 @@ bytes respectively. Such letter suffixes
 			See Documentation/block/as-iosched.txt and
 			Documentation/block/deadline-iosched.txt for details.
 
-	elfcorehdr=	[IA-64,PPC,SH,X86]
+	elfcorehdr=[size[KMG]@]offset[KMG] [IA64,PPC,SH,X86,S390]
 			Specifies physical address of start of kernel core
-			image elf header. Generally kexec loader will
-			pass this option to capture kernel.
+			image elf header and optionally the size. Generally
+			kexec loader will pass this option to capture kernel.
 			See Documentation/kdump/kdump.txt for details.
 
 	enable_mtrr_cleanup [X86]
include/linux/crash_dump.h +1 -0
@@ -10,6 +10,7 @@
 #define ELFCORE_ADDR_ERR	(-2ULL)
 
 extern unsigned long long elfcorehdr_addr;
+extern unsigned long long elfcorehdr_size;
 
 extern ssize_t copy_oldmem_page(unsigned long, char *, size_t,
 						unsigned long, int);
kernel/crash_dump.c +11 -0
@@ -20,8 +20,15 @@ unsigned long saved_max_pfn;
 unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
 
 /*
+ * stores the size of elf header of crash image
+ */
+unsigned long long elfcorehdr_size;
+
+/*
  * elfcorehdr= specifies the location of elf core header stored by the crashed
  * kernel. This option will be passed by kexec loader to the capture kernel.
+ *
+ * Syntax: elfcorehdr=[size[KMG]@]offset[KMG]
  */
 static int __init setup_elfcorehdr(char *arg)
 {
@@ -29,6 +36,10 @@ static int __init setup_elfcorehdr(char
 	if (!arg)
 		return -EINVAL;
 	elfcorehdr_addr = memparse(arg, &end);
+	if (*end == '@') {
+		elfcorehdr_size = elfcorehdr_addr;
+		elfcorehdr_addr = memparse(end + 1, &end);
+	}
 	return end > arg ? 0 : -EINVAL;
 }
 early_param("elfcorehdr", setup_elfcorehdr);
Acked-by on v1 2/2
#4 lore raw

Re: [patch 2/2] kdump: Add size to elfcorehdr kernel parameter

Quoted 11 lines · Michael Holzheu

From: Michael Holzheu <[email protected]>

Currently only the address of the pre-allocated ELF header is passed with the elfcorehdr= kernel parameter. In order to reserve memory for the header in the 2nd kernel also the size is required. Current kdump architecture backends use different methods to do that, e.g. x86 uses the memmap= kernel parameter. On s390 there is no easy way to transfer this information. Therefore the elfcorehdr kernel parameter is extended to also pass the size. This now can also be used as standard mechanism by all future kdump architecture backends.

Quoted 7 lines

The syntax of the kernel parameter is extended as follows:

elfcorehdr=[size[KMG]@]offset[KMG]

This change is backward compatible because elfcorehdr=size is still allowed.

Looks good to me.

Vivek

Quoted 61 lines
---
 Documentation/kernel-parameters.txt |    6 +++---
 include/linux/crash_dump.h          |    1 +
 kernel/crash_dump.c                 |   11 +++++++++++
 3 files changed, 15 insertions(+), 3 deletions(-)
Documentation/kernel-parameters.txt +3 -3
@@ -727,10 +727,10 @@ bytes respectively. Such letter suffixes
 			See Documentation/block/as-iosched.txt and
 			Documentation/block/deadline-iosched.txt for details.
 
-	elfcorehdr=	[IA-64,PPC,SH,X86]
+	elfcorehdr=[size[KMG]@]offset[KMG] [IA64,PPC,SH,X86,S390]
 			Specifies physical address of start of kernel core
-			image elf header. Generally kexec loader will
-			pass this option to capture kernel.
+			image elf header and optionally the size. Generally
+			kexec loader will pass this option to capture kernel.
 			See Documentation/kdump/kdump.txt for details.
 
 	enable_mtrr_cleanup [X86]
include/linux/crash_dump.h +1 -0
@@ -10,6 +10,7 @@
 #define ELFCORE_ADDR_ERR	(-2ULL)
 
 extern unsigned long long elfcorehdr_addr;
+extern unsigned long long elfcorehdr_size;
 
 extern ssize_t copy_oldmem_page(unsigned long, char *, size_t,
 						unsigned long, int);
kernel/crash_dump.c +11 -0
@@ -20,8 +20,15 @@ unsigned long saved_max_pfn;
 unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
 
 /*
+ * stores the size of elf header of crash image
+ */
+unsigned long long elfcorehdr_size;
+
+/*
  * elfcorehdr= specifies the location of elf core header stored by the crashed
  * kernel. This option will be passed by kexec loader to the capture kernel.
+ *
+ * Syntax: elfcorehdr=[size[KMG]@]offset[KMG]
  */
 static int __init setup_elfcorehdr(char *arg)
 {
@@ -29,6 +36,10 @@ static int __init setup_elfcorehdr(char
 	if (!arg)
 		return -EINVAL;
 	elfcorehdr_addr = memparse(arg, &end);
+	if (*end == '@') {
+		elfcorehdr_size = elfcorehdr_addr;
+		elfcorehdr_addr = memparse(end + 1, &end);
+	}
 	return end > arg ? 0 : -EINVAL;
 }
 early_param("elfcorehdr", setup_elfcorehdr);
maintainer
#5 lore raw
In reply to Michael Holzheu
Quoted 5 lines · On Fri, 19 Aug 2011 16:18:57 +0200 Michael Holzheu…

I had a long discussion with Vivek Goyal on the s390 kdump support (thanks Vivek for all the time!). As a result of this, here are two common code patches that are required for the s390 port. Could you please integrate them upstream in the next merge window? The s390 specific part will be integrated by our s390 maintainer Martin Schwidefsky.

The patches look OK to me. I suggest that they be carried in Martin's tree, alongside the s390 kdump support. That will somewhat simplify things during the merge window, and will greatly simplify getting the entire feature into linux-next.

You can put my acked-by's on them if you like.

Quoted 2 lines

I will be on vacation for the next two weeks. Therefore if you have comments or questions, please contact also Martin Schwidefsky and Heiko Carstens.

I'll put the patches into my tree (and hence linux-next) now, because I need the typing practice ;) I'll drop them again if/when they turn up in linux-next's s390 tree.

#6 lore raw
Quoted 14 lines · On Fri, 19 Aug 2011 15:03:53 -0700 Andrew Morton <[email protected]>…
Quoted 5 lines · On Fri, 19 Aug 2011 16:18:57 +0200 Michael Holzheu…

I had a long discussion with Vivek Goyal on the s390 kdump support (thanks Vivek for all the time!). As a result of this, here are two common code patches that are required for the s390 port. Could you please integrate them upstream in the next merge window? The s390 specific part will be integrated by our s390 maintainer Martin Schwidefsky.

The patches look OK to me. I suggest that they be carried in Martin's tree, alongside the s390 kdump support. That will somewhat simplify things during the merge window, and will greatly simplify getting the entire feature into linux-next.

Quoted 8 lines

You can put my acked-by's on them if you like.

Quoted 2 lines

I will be on vacation for the next two weeks. Therefore if you have comments or questions, please contact also Martin Schwidefsky and Heiko Carstens.

I'll put the patches into my tree (and hence linux-next) now, because I need the typing practice ;) I'll drop them again if/when they turn up in linux-next's s390 tree.

Ok, sounds reasonable to me. I'll take them via the s390 tree and add you acked-by. Thanks Andrew.

Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.