Skip to contentSkip to conversation

Increase kernel text size for x86_64

PATCH In review Hannes Reinecke 2 participants 4 messages Aug 12, 2009 – Aug 13, 2009

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

PATCH 1/1 Increase kernel text size for x86_64

Hi all,

I cannot load a x86_64 kernel with kexec on 2.6.31; the error message is:

Can't find kernel text map area from kcore
Cannot load /boot/vmlinuz

Digging through the source I found a mismatch between the assumed kernel text size; kexec has:

#define KERNEL_TEXT_SIZE (40UL*1024*1024)

but on the kernel side we have:

include/asm/page_64_types.h:
#define KERNEL_IMAGE_SIZE (512 * 1024 * 1024)

And, indeed, changing the definition in kexec-tools to the kernel one fixed the problem.

Not sure if this has been reported before, if so please ignore the noise.

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
kexec/arch/x86_64/crashdump-x86_64.h +1 -1
index 9f4dee9..0e83527 100644
@@ -11,7 +11,7 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline,
 #define MAXMEM           0x3fffffffffffUL
 
 /* Kernel text size */
-#define KERNEL_TEXT_SIZE  (40UL*1024*1024)
+#define KERNEL_TEXT_SIZE  (512UL*1024*1024)
 
 #define CRASH_MAX_MEMMAP_NR	(KEXEC_MAX_SEGMENTS + 1)
 #define CRASH_MAX_MEMORY_RANGES	(MAX_MEMORY_RANGES + 2)

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

#1 lore raw
Quoted 14 lines · Hannes Reinecke

Hi all,

I cannot load a x86_64 kernel with kexec on 2.6.31; the error message is:

Can't find kernel text map area from kcore
Cannot load /boot/vmlinuz

Digging through the source I found a mismatch between the assumed kernel text size; kexec has:

#define KERNEL_TEXT_SIZE (40UL*1024*1024)

but on the kernel side we have:

Quoted 8 lines

include/asm/page_64_types.h:
#define KERNEL_IMAGE_SIZE (512 * 1024 * 1024)

And, indeed, changing the definition in kexec-tools to the kernel one fixed the problem.

Not sure if this has been reported before, if so please ignore the noise.

Hi,

I'm wondering what effect this would have when using kexec-tools with older kernels, which presumably have a smaller value for KERNEL_IMAGE_SIZE.

kexec/arch/x86_64/crashdump-x86_64.h int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline, · line 17

Quoted 13 lines
kexec/arch/x86_64/crashdump-x86_64.h +1 -1
index 9f4dee9..0e83527 100644
@@ -11,7 +11,7 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline,
 #define MAXMEM           0x3fffffffffffUL
 
 /* Kernel text size */
-#define KERNEL_TEXT_SIZE  (40UL*1024*1024)
+#define KERNEL_TEXT_SIZE  (512UL*1024*1024)
 
 #define CRASH_MAX_MEMMAP_NR	(KEXEC_MAX_SEGMENTS + 1)
 #define CRASH_MAX_MEMORY_RANGES	(MAX_MEMORY_RANGES + 2)

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

#2 lore raw
Quoted 37 lines · Simon Horman
Quoted 14 lines · Hannes Reinecke

Hi all,

I cannot load a x86_64 kernel with kexec on 2.6.31; the error message is:

Can't find kernel text map area from kcore
Cannot load /boot/vmlinuz

Digging through the source I found a mismatch between the assumed kernel text size; kexec has:

#define KERNEL_TEXT_SIZE (40UL*1024*1024)

but on the kernel side we have:

Quoted 8 lines

include/asm/page_64_types.h:
#define KERNEL_IMAGE_SIZE (512 * 1024 * 1024)

And, indeed, changing the definition in kexec-tools to the kernel one fixed the problem.

Not sure if this has been reported before, if so please ignore the noise.

Hi,

I'm wondering what effect this would have when using kexec-tools with older kernels, which presumably have a smaller value for KERNEL_IMAGE_SIZE.

Quoted 7 lines
kexec/arch/x86_64/crashdump-x86_64.h +0 -0
index 9f4dee9..0e83527 100644
@@ -11,7 +11,7 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline,
 #define MAXMEM           0x3fffffffffffUL
 
Quoted 7 lines

kexec/arch/x86_64/crashdump-x86_64.h int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline, · line 17

Quoted 6 lines
kexec/arch/x86_64/crashdump-x86_64.h +1 -1
 /* Kernel text size */
-#define KERNEL_TEXT_SIZE  (40UL*1024*1024)
+#define KERNEL_TEXT_SIZE  (512UL*1024*1024)
 
 #define CRASH_MAX_MEMMAP_NR	(KEXEC_MAX_SEGMENTS + 1)
 #define CRASH_MAX_MEMORY_RANGES	(MAX_MEMORY_RANGES + 2)

Well, the actual point of failure is in kexec/arch/x86_64/crashdump-x86_64.c:125

			/* Look for kernel text mapping header. */
			if ((saddr >= __START_KERNEL_map) &&
			    (eaddr <= __START_KERNEL_map + KERNEL_TEXT_SIZE)) {
				saddr = (saddr) & (~(KERN_VADDR_ALIGN - 1));
				info->kern_vaddr_start = saddr;
				size = eaddr - saddr;

which basically should look for a ELF header into which the kernel fits. As we're effectively just moving the upper limit I fail to see any harm to older kernels.

Hmm. Haven't checked for other occurrences of KERNEL_TEXT_SIZE, though.

Would be nice we could be getting these values off somewhere; rely on some kernel defines is going to break now and then.

Cheers,

Hannes

Signature · 9 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#3 lore raw
Quoted 54 lines · Hannes Reinecke
Quoted 37 lines · Simon Horman
Quoted 14 lines · Hannes Reinecke

Hi all,

I cannot load a x86_64 kernel with kexec on 2.6.31; the error message is:

Can't find kernel text map area from kcore
Cannot load /boot/vmlinuz

Digging through the source I found a mismatch between the assumed kernel text size; kexec has:

#define KERNEL_TEXT_SIZE (40UL*1024*1024)

but on the kernel side we have:

Quoted 8 lines

include/asm/page_64_types.h:
#define KERNEL_IMAGE_SIZE (512 * 1024 * 1024)

And, indeed, changing the definition in kexec-tools to the kernel one fixed the problem.

Not sure if this has been reported before, if so please ignore the noise.

Hi,

I'm wondering what effect this would have when using kexec-tools with older kernels, which presumably have a smaller value for KERNEL_IMAGE_SIZE.

Quoted 7 lines
kexec/arch/x86_64/crashdump-x86_64.h +0 -0
index 9f4dee9..0e83527 100644
@@ -11,7 +11,7 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline,
 #define MAXMEM           0x3fffffffffffUL
 
Quoted 7 lines

kexec/arch/x86_64/crashdump-x86_64.h int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline, · line 17

Quoted 6 lines
kexec/arch/x86_64/crashdump-x86_64.h +1 -1
 /* Kernel text size */
-#define KERNEL_TEXT_SIZE  (40UL*1024*1024)
+#define KERNEL_TEXT_SIZE  (512UL*1024*1024)
 
 #define CRASH_MAX_MEMMAP_NR	(KEXEC_MAX_SEGMENTS + 1)
 #define CRASH_MAX_MEMORY_RANGES	(MAX_MEMORY_RANGES + 2)

Well, the actual point of failure is in kexec/arch/x86_64/crashdump-x86_64.c:125

			/* Look for kernel text mapping header. */
			if ((saddr >= __START_KERNEL_map) &&
			    (eaddr <= __START_KERNEL_map + KERNEL_TEXT_SIZE)) {
				saddr = (saddr) & (~(KERN_VADDR_ALIGN - 1));
				info->kern_vaddr_start = saddr;
				size = eaddr - saddr;
Quoted 7 lines

which basically should look for a ELF header into which the kernel fits. As we're effectively just moving the upper limit I fail to see any harm to older kernels.

Hmm. Haven't checked for other occurrences of KERNEL_TEXT_SIZE, though.

Would be nice we could be getting these values off somewhere; rely on some kernel defines is going to break now and then.

Agreed, but I think that your patch is worth having in the mean time. I will apply it.

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