Skip to contentSkip to conversation

Kexec jump - v2 - the first step to kexec based hibernation

PATCH In review Huang, Ying 7 participants 34 messages Jul 15, 2007 – Aug 6, 2007

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

cover Kexec jump - v2 - the first step to kexec based hibernation

The changelog between v1 and v2

1. The kexec jump implementation is put into the kexec/kdump framework instead of software suspend framework. The device and CPU state save/restore code of software suspend is called when needed.

2. The same code path is used for both kexec a new kernel and jump back to original kernel.

The complete changelog of the patch is as follow:

---

Kexec base hibernation has some potential advantages over uswsusp and TuxOnIce (suspend2). Some most obvious advantages are:

1. The hibernation image size can exceed half of memory size easily.
2. The hibernation image can be written to and read from almost anywhere, such as USB disk, NFS.

This patch implements the functionality of "jumping from kexeced kernel to original kernel". That is, the following sequence is possible:

1. Boot a kernel A
2. Work under kernel A
3. Kexec another kernel B in kernel A
4. Work under kernel B
5. Jump from kernel B to kernel A
6. Continue work under kernel A

This is the first step to implement kexec based hibernation. If the memory image of kernel A is written to or read from a permanent media in step 4, a preliminary version of kexec based hibernation can be implemented.

The kernel B run as a crashdump kernel in reserved memory region. This is the biggest constrains of the patch. It is planed to be eliminated in the future version. That is, instead of reserving memory region previously, the needed memory region is backupped before kexec and restored after jumping back.

Another constrains of the patch is that the CONFIG_ACPI must be turned off to make kexec jump work. Because ACPI will put devices into low power state, the kexeced kernel can not be booted properly under it. This constrains can be eliminated by separating the suspend method and hibernate method of the devices as proposed earlier in the LKML.

The kexec jump is implemented in the framework of kexec/kdump. In sys_reboot, a new command named LINUX_REBOOT_CMD_KJUMP is defined to trigger the jumping to (executing) the new kernel or jump back to the original kernel.

Now, only the i386 architecture is supported. The patch is based on Linux kernel 2.6.22, and has been tested on my IBM T42.

Usage:

1. Compile kernel with following options selected:

CONFIG_X86_32=y
CONFIG_RELOCATABLE=y # not needed strictly, but it is more convenient with it CONFIG_KEXEC=y
CONFIG_PM=y
CONFIG_KEXEC_JUMP=y

2. Compile the kexec-tools with kdump and kjump patches, the kdump patch can be found at:

http://lse.sourceforge.net/kdump/patches/kexec-tools-1.101-kdump10.patch

While, the kexec-tools kjump patch is appended with the mail.

3. Boot kernel compiled for normal usage, the reserved crash kernel memory region must be added to kernel command line as following:

crashkernel=<XX>M@<XX>M

Where, <XX> should be replaced by the real memory size and position.

4. Load kernel compiled for hibernating usage as a crashdump kernel with kexec, the same kernel as that of 3 can be used if CONFIG_RELOCATABLE=y is selected. The kernel command line option as following must be appended to kernel command line.

kexec_jump_buf_pfn=cat /sys/kernel/kexec_jump_buf_pfn

For example, the shell command line can be as follow:

   kexec -p /boot/vmlinux --args-linux --append="root=/dev/hdb signal
       kexec_jump_buf_pfn=`cat /sys/kernel/kexec_jump_buf_pfn`"

5. Boot the hibernating kernel with following shell command line:

kexec -j

6. In the kexec booted kernel, trigger the jumping back with following shell command.

kexec -j

---

changelog of kexec-tools

A new command line option -j/--jump is added to support jumping/executing the currently loaded kernel or jumping back to the original kernel. The implementation of -j/--jump is to call corresponding syscall.

For i386 architecture, the address of backup of 0~640k is passed to kexeced kernel as a kernel command line option. This is used by kexeced kernel to restore the backup.

---

kexec/arch/i386/crashdump-x86.c +24 -0
Index: kexec-tools-1.101/kexec/arch/i386/crashdump-x86.c
===================================================================
@@ -428,6 +428,29 @@
 	return 0;
 }
 
+/* Adds the kexec_backup= command line parameter to command line. */
+static int cmdline_add_backup(char *cmdline, unsigned long addr)
+{
+	int cmdlen, len, align = 1024;
+	char str[30], *ptr;
+
+	/* Passing in kexec_backup=xxxK format. Saves space required
+	 * in cmdline. Ensure 1K alignment*/
+	if (addr%align)
+		return -1;
+	addr = addr/align;
+	ptr = str;
+	strcpy(str, " kexec_backup=");
+	ptr += strlen(str);
+	ultoa(addr, ptr);
+	strcat(str, "K");
+	len = strlen(str);
+	cmdlen = strlen(cmdline) + len;
+	if (cmdlen > (COMMAND_LINE_SIZE - 1))
+		die("Command line overflow\n");
+	strcat(cmdline, str);
+	return 0;
+}
 
 /*
  * This routine is specific to i386 architecture to maintain the
@@ -724,5 +747,6 @@
 		return -1;
 	cmdline_add_memmap(mod_cmdline, memmap_p);
 	cmdline_add_elfcorehdr(mod_cmdline, elfcorehdr);
+	cmdline_add_backup(mod_cmdline, info->backup_start);
 	return 0;
 }
kexec/kexec-syscall.h +5 -0
Index: kexec-tools-1.101/kexec/kexec-syscall.h
===================================================================
@@ -21,6 +21,7 @@
 #define LINUX_REBOOT_CMD_KEXEC_OLD	0x81726354
 #define LINUX_REBOOT_CMD_KEXEC_OLD2	0x18263645
 #define LINUX_REBOOT_CMD_KEXEC		0x45584543
+#define LINUX_REBOOT_CMD_KJUMP		0x3928A5FD
 
 #ifdef __i386__
 #define __NR_kexec_load		283
@@ -60,6 +61,10 @@
 	return (long) syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_KEXEC, 0);
 }
 
+static inline long kexec_jump(void)
+{
+	return (long) syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_KJUMP, 0);
+}
 
 #define KEXEC_ON_CRASH  0x00000001
 #define KEXEC_ARCH_MASK 0xffff0000
kexec/kexec.c +24 -0
Index: kexec-tools-1.101/kexec/kexec.c
===================================================================
@@ -660,6 +660,17 @@
 	return -1;
 }
 
+/*
+ *	Jump to the new kernel
+ */
+static int my_jump(void)
+{
+	int result;
+
+	result = kexec_jump();
+	return result;
+}
+
 static void version(void)
 {
 	printf("kexec " VERSION " released " RELEASE_DATE "\n");
@@ -683,6 +694,7 @@
 		" -p, --load-panic     Load the new kernel for use on panic.\n"
 		" -u, --unload         Unload the current kexec target kernel.\n"
 		" -e, --exec           Execute a currently loaded kernel.\n"
+		" -j, --jump           Jump to a currently loaded kernel or jump back to the previous kernel.\n"
 		" -t, --type=TYPE      Specify the new kernel is of this type.\n"
 		"     --mem-min=<addr> Specify the lowest memory addres to load code into.\n"
 		"     --mem-max=<addr> Specify the highest memory addres to load code into.\n"
@@ -715,6 +727,7 @@
 {
 	int do_load = 1;
 	int do_exec = 0;
+	int do_jump = 0;
 	int do_shutdown = 1;
 	int do_sync = 1;
 	int do_ifdown = 0;
@@ -768,6 +781,14 @@
 			do_ifdown = 1;
 			do_exec = 1;
 			break;
+		case OPT_JUMP:
+			do_load = 0;
+			do_shutdown = 0;
+			do_sync = 1;
+			do_ifdown = 0;
+			do_exec = 0;
+			do_jump = 1;
+			break;
 		case OPT_TYPE:
 			type = optarg;
 			break;
@@ -833,6 +854,9 @@
 	if ((result == 0) && do_exec) {
 		result = my_exec();
 	}
+	if ((result == 0) && do_jump) {
+		result = my_jump();
+	}
 
 	fflush(stdout);
 	fflush(stderr);
kexec/kexec.h +3 -1
Index: kexec-tools-1.101/kexec/kexec.h
===================================================================
@@ -151,6 +151,7 @@
 #define OPT_FORCE		'f'
 #define OPT_NOIFDOWN		'x'
 #define OPT_EXEC		'e'
+#define OPT_JUMP		'j'
 #define OPT_LOAD		'l'
 #define OPT_UNLOAD		'u'
 #define OPT_TYPE		't'
@@ -166,12 +167,13 @@
 	{ "load",		0, 0, OPT_LOAD }, \
 	{ "unload",		0, 0, OPT_UNLOAD }, \
 	{ "exec",		0, 0, OPT_EXEC }, \
+	{ "jump",		0, 0, OPT_JUMP }, \
 	{ "type",		1, 0, OPT_TYPE }, \
 	{ "load-panic",         0, 0, OPT_PANIC }, \
 	{ "mem-min",		1, 0, OPT_MEM_MIN }, \
 	{ "mem-max",		1, 0, OPT_MEM_MAX }, \
 
-#define KEXEC_OPT_STR "hvdfxluet:p"
+#define KEXEC_OPT_STR "hvdfxluejt:p"
 
 extern void die(char *fmt, ...);
 extern void *xmalloc(size_t size);

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

#1 lore raw

Hi.

Quoted 10 lines · Ying

The complete changelog of the patch is as follow:

---

Kexec base hibernation has some potential advantages over uswsusp and TuxOnIce (suspend2). Some most obvious advantages are:

1. The hibernation image size can exceed half of memory size easily.
2. The hibernation image can be written to and read from almost anywhere, such as USB disk, NFS.

This isn't right. TuxOnIce has no problem with image sizes exceeding half the amount of memory, and both uswsusp and TuxOnIce could write to a USB disk/key or NFS as well. Historically, the issue with writing to USB devices has been an issue with USB device drivers, not hibernation implementations. I haven't tried writing an image to USB, but with the work on the drivers, I wouldn't be surprised if it was usable now. NFS? Again, I haven't tried, but wouldn't expect it to be impossible. I did try writing an image to an NBD device a couple of years ago. It didn't quite work, but wasn't far away.

Regards,

Nigel

Signature · 2 lines
See http://www.tuxonice.net for Howtos, FAQs, mailing
lists, wiki and bugzilla info.
#2 lore raw
In reply to Huang, Ying
Quoted 10 lines · Ying

The changelog between v1 and v2

1. The kexec jump implementation is put into the kexec/kdump framework instead of software suspend framework. The device and CPU state save/restore code of software suspend is called when needed.

2. The same code path is used for both kexec a new kernel and jump back to original kernel.

Quoted 8 lines

The complete changelog of the patch is as follow:

---

Kexec base hibernation has some potential advantages over uswsusp and TuxOnIce (suspend2). Some most obvious advantages are:

1. The hibernation image size can exceed half of memory size easily.

In TuxOnIce (suspend2) there's no such limitation.

Quoted 2 lines

2. The hibernation image can be written to and read from almost anywhere, such as USB disk, NFS.

You can do this, too, with uswsusp.

Quoted 72 lines

This patch implements the functionality of "jumping from kexeced kernel to original kernel". That is, the following sequence is possible:

1. Boot a kernel A
2. Work under kernel A
3. Kexec another kernel B in kernel A
4. Work under kernel B
5. Jump from kernel B to kernel A
6. Continue work under kernel A

This is the first step to implement kexec based hibernation. If the memory image of kernel A is written to or read from a permanent media in step 4, a preliminary version of kexec based hibernation can be implemented.

The kernel B run as a crashdump kernel in reserved memory region. This is the biggest constrains of the patch. It is planed to be eliminated in the future version. That is, instead of reserving memory region previously, the needed memory region is backupped before kexec and restored after jumping back.

Another constrains of the patch is that the CONFIG_ACPI must be turned off to make kexec jump work. Because ACPI will put devices into low power state, the kexeced kernel can not be booted properly under it. This constrains can be eliminated by separating the suspend method and hibernate method of the devices as proposed earlier in the LKML.

The kexec jump is implemented in the framework of kexec/kdump. In sys_reboot, a new command named LINUX_REBOOT_CMD_KJUMP is defined to trigger the jumping to (executing) the new kernel or jump back to the original kernel.

Now, only the i386 architecture is supported. The patch is based on Linux kernel 2.6.22, and has been tested on my IBM T42.

Usage:

1. Compile kernel with following options selected:

CONFIG_X86_32=y
CONFIG_RELOCATABLE=y # not needed strictly, but it is more convenient with it CONFIG_KEXEC=y
CONFIG_PM=y
CONFIG_KEXEC_JUMP=y

2. Compile the kexec-tools with kdump and kjump patches, the kdump patch can be found at:

http://lse.sourceforge.net/kdump/patches/kexec-tools-1.101-kdump10.patch

While, the kexec-tools kjump patch is appended with the mail.

3. Boot kernel compiled for normal usage, the reserved crash kernel memory region must be added to kernel command line as following:

crashkernel=<XX>M@<XX>M

Where, <XX> should be replaced by the real memory size and position.

4. Load kernel compiled for hibernating usage as a crashdump kernel with kexec, the same kernel as that of 3 can be used if CONFIG_RELOCATABLE=y is selected. The kernel command line option as following must be appended to kernel command line.

kexec_jump_buf_pfn=cat /sys/kernel/kexec_jump_buf_pfn

For example, the shell command line can be as follow:

   kexec -p /boot/vmlinux --args-linux --append="root=/dev/hdb signal
       kexec_jump_buf_pfn=`cat /sys/kernel/kexec_jump_buf_pfn`"
Quoted 8 lines

5. Boot the hibernating kernel with following shell command line:

kexec -j

6. In the kexec booted kernel, trigger the jumping back with following shell command.

kexec -j

Well, I think that's _way_ too much complicated to be useful for hibernation on systems that are set up and administered by average users.

Greetings,
Rafael

Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
#3 lore raw
In reply to Huang, Ying
Quoted 10 lines · Ying

The changelog between v1 and v2

1. The kexec jump implementation is put into the kexec/kdump framework instead of software suspend framework. The device and CPU state save/restore code of software suspend is called when needed.

2. The same code path is used for both kexec a new kernel and jump back to original kernel.

Quoted 8 lines

The complete changelog of the patch is as follow:

---

Kexec base hibernation has some potential advantages over uswsusp and TuxOnIce (suspend2). Some most obvious advantages are:

1. The hibernation image size can exceed half of memory size easily.

In TuxOnIce (suspend2) there's no such limitation.

Quoted 2 lines

2. The hibernation image can be written to and read from almost anywhere, such as USB disk, NFS.

You can do this, too, with uswsusp.

Quoted 72 lines

This patch implements the functionality of "jumping from kexeced kernel to original kernel". That is, the following sequence is possible:

1. Boot a kernel A
2. Work under kernel A
3. Kexec another kernel B in kernel A
4. Work under kernel B
5. Jump from kernel B to kernel A
6. Continue work under kernel A

This is the first step to implement kexec based hibernation. If the memory image of kernel A is written to or read from a permanent media in step 4, a preliminary version of kexec based hibernation can be implemented.

The kernel B run as a crashdump kernel in reserved memory region. This is the biggest constrains of the patch. It is planed to be eliminated in the future version. That is, instead of reserving memory region previously, the needed memory region is backupped before kexec and restored after jumping back.

Another constrains of the patch is that the CONFIG_ACPI must be turned off to make kexec jump work. Because ACPI will put devices into low power state, the kexeced kernel can not be booted properly under it. This constrains can be eliminated by separating the suspend method and hibernate method of the devices as proposed earlier in the LKML.

The kexec jump is implemented in the framework of kexec/kdump. In sys_reboot, a new command named LINUX_REBOOT_CMD_KJUMP is defined to trigger the jumping to (executing) the new kernel or jump back to the original kernel.

Now, only the i386 architecture is supported. The patch is based on Linux kernel 2.6.22, and has been tested on my IBM T42.

Usage:

1. Compile kernel with following options selected:

CONFIG_X86_32=y
CONFIG_RELOCATABLE=y # not needed strictly, but it is more convenient with it CONFIG_KEXEC=y
CONFIG_PM=y
CONFIG_KEXEC_JUMP=y

2. Compile the kexec-tools with kdump and kjump patches, the kdump patch can be found at:

http://lse.sourceforge.net/kdump/patches/kexec-tools-1.101-kdump10.patch

While, the kexec-tools kjump patch is appended with the mail.

3. Boot kernel compiled for normal usage, the reserved crash kernel memory region must be added to kernel command line as following:

crashkernel=<XX>M@<XX>M

Where, <XX> should be replaced by the real memory size and position.

4. Load kernel compiled for hibernating usage as a crashdump kernel with kexec, the same kernel as that of 3 can be used if CONFIG_RELOCATABLE=y is selected. The kernel command line option as following must be appended to kernel command line.

kexec_jump_buf_pfn=cat /sys/kernel/kexec_jump_buf_pfn

For example, the shell command line can be as follow:

   kexec -p /boot/vmlinux --args-linux --append="root=/dev/hdb signal
       kexec_jump_buf_pfn=`cat /sys/kernel/kexec_jump_buf_pfn`"
Quoted 8 lines

5. Boot the hibernating kernel with following shell command line:

kexec -j

6. In the kexec booted kernel, trigger the jumping back with following shell command.

kexec -j

Well, I think that's _way_ too much complicated to be useful for hibernation on systems that are set up and administered by average users.

Greetings,
Rafael

Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
#4 lore raw
In reply to Huang, Ying

Hi.

Quoted 10 lines · Ying

The complete changelog of the patch is as follow:

---

Kexec base hibernation has some potential advantages over uswsusp and TuxOnIce (suspend2). Some most obvious advantages are:

1. The hibernation image size can exceed half of memory size easily.
2. The hibernation image can be written to and read from almost anywhere, such as USB disk, NFS.

This isn't right. TuxOnIce has no problem with image sizes exceeding half the amount of memory, and both uswsusp and TuxOnIce could write to a USB disk/key or NFS as well. Historically, the issue with writing to USB devices has been an issue with USB device drivers, not hibernation implementations. I haven't tried writing an image to USB, but with the work on the drivers, I wouldn't be surprised if it was usable now. NFS? Again, I haven't tried, but wouldn't expect it to be impossible. I did try writing an image to an NBD device a couple of years ago. It didn't quite work, but wasn't far away.

Regards,

Nigel

Signature · 2 lines
See http://www.tuxonice.net for Howtos, FAQs, mailing
lists, wiki and bugzilla info.

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

#5 lore raw
In reply to Huang, Ying
Quoted 10 lines · Ying

The changelog between v1 and v2

1. The kexec jump implementation is put into the kexec/kdump framework instead of software suspend framework. The device and CPU state save/restore code of software suspend is called when needed.

2. The same code path is used for both kexec a new kernel and jump back to original kernel.

I like the idea but I think I'll let people chat about it a bit more before looking at merging the patches, OK?

#6 lore raw
In reply to Huang, Ying
Quoted 10 lines · Ying

The changelog between v1 and v2

1. The kexec jump implementation is put into the kexec/kdump framework instead of software suspend framework. The device and CPU state save/restore code of software suspend is called when needed.

2. The same code path is used for both kexec a new kernel and jump back to original kernel.

I like the idea but I think I'll let people chat about it a bit more before looking at merging the patches, OK?

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

#7 lore raw

Hi.

Quoted 11 lines · On Thursday 19 July 2007 11:04:20 Andrew Morton wrote:
Quoted 8 lines · Ying

The changelog between v1 and v2

1. The kexec jump implementation is put into the kexec/kdump framework instead of software suspend framework. The device and CPU state save/restore code of software suspend is called when needed.

Quoted 5 lines
Quoted 2 lines

2. The same code path is used for both kexec a new kernel and jump back to original kernel.

I like the idea but I think I'll let people chat about it a bit more before looking at merging the patches, OK?

Please wait until you see a complete implementation that actually works. I'm sitting here quietly, following (and now breaking) the "If you can't say anything positive, don't say anything at all" line because I think that the more into the implementation details people get, the uglier this is going to show itself to be. I'm perfectly willing to be proven wrong, but haven't seen anything so far that's even begun to convince me otherwise.

Regards,

Nigel

Signature · 2 lines
See http://www.tuxonice.net for Howtos, FAQs, mailing
lists, wiki and bugzilla info.
#8 lore raw
Quoted 20 lines · Nigel Cunningham

Hi.

Quoted 11 lines · On Thursday 19 July 2007 11:04:20 Andrew Morton wrote:
Quoted 8 lines · Ying

The changelog between v1 and v2

1. The kexec jump implementation is put into the kexec/kdump framework instead of software suspend framework. The device and CPU state save/restore code of software suspend is called when needed.

Quoted 5 lines
Quoted 2 lines

2. The same code path is used for both kexec a new kernel and jump back to original kernel.

I like the idea but I think I'll let people chat about it a bit more before looking at merging the patches, OK?

Quoted 6 lines

Please wait until you see a complete implementation that actually works. I'm sitting here quietly, following (and now breaking) the "If you can't say anything positive, don't say anything at all" line because I think that the more into the implementation details people get, the uglier this is going to show itself to be. I'm perfectly willing to be proven wrong, but haven't seen anything so far that's even begun to convince me otherwise.

as someone who's eager to have this work, I have to agree with Nigel that it's premature to talk about merging anything.

the only exception I could see is if there are other uses for this functionality. but even then, let things settle out a little bit.

David Lang

#9 lore raw
In reply to Nigel Cunningham
Quoted 20 lines · Nigel Cunningham

Hi.

Quoted 11 lines · On Thursday 19 July 2007 11:04:20 Andrew Morton wrote:
Quoted 8 lines · Ying

The changelog between v1 and v2

1. The kexec jump implementation is put into the kexec/kdump framework instead of software suspend framework. The device and CPU state save/restore code of software suspend is called when needed.

Quoted 5 lines
Quoted 2 lines

2. The same code path is used for both kexec a new kernel and jump back to original kernel.

I like the idea but I think I'll let people chat about it a bit more before looking at merging the patches, OK?

Quoted 6 lines

Please wait until you see a complete implementation that actually works. I'm sitting here quietly, following (and now breaking) the "If you can't say anything positive, don't say anything at all" line because I think that the more into the implementation details people get, the uglier this is going to show itself to be. I'm perfectly willing to be proven wrong, but haven't seen anything so far that's even begun to convince me otherwise.

as someone who's eager to have this work, I have to agree with Nigel that it's premature to talk about merging anything.

the only exception I could see is if there are other uses for this functionality. but even then, let things settle out a little bit.

David Lang

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

#10 lore raw
In reply to Andrew Morton
Quoted 2 lines · Andrew Morton

I like the idea but I think I'll let people chat about it a bit more before looking at merging the patches, OK?

I think maybe we should wait for Rafael to separate the device hibernate (quiesce and state save) from device suspend. Without that, the ACPI issue can not be resolved.

Best Regards,
Huang Ying

#11 lore raw
In reply to Andrew Morton
Quoted 2 lines · Andrew Morton

I like the idea but I think I'll let people chat about it a bit more before looking at merging the patches, OK?

I think maybe we should wait for Rafael to separate the device hibernate (quiesce and state save) from device suspend. Without that, the ACPI issue can not be resolved.

Best Regards,
Huang Ying

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

#12 lore raw
Quoted 6 lines · Ying
Quoted 2 lines · Andrew Morton

I like the idea but I think I'll let people chat about it a bit more before looking at merging the patches, OK?

I think maybe we should wait for Rafael to separate the device hibernate (quiesce and state save) from device suspend.

Well, I'm afraid that will take some time ...

Quoted 1 line

Without that, the ACPI issue can not be resolved.

Yes, it seems so.

Greetings,
Rafael

Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
#13 lore raw
In reply to Huang, Ying
Quoted 6 lines · Ying
Quoted 2 lines · Andrew Morton

I like the idea but I think I'll let people chat about it a bit more before looking at merging the patches, OK?

I think maybe we should wait for Rafael to separate the device hibernate (quiesce and state save) from device suspend.

Well, I'm afraid that will take some time ...

Quoted 1 line

Without that, the ACPI issue can not be resolved.

Yes, it seems so.

Greetings,
Rafael

Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
#14 lore raw
In reply to Huang, Ying

Hi!

Quoted 21 lines

Index: kexec-tools-1.101/kexec/arch/i386/crashdump-x86.c
===================================================================

kexec/arch/i386/crashdump-x86.c +13 -0
@@ -428,6 +428,29 @@
 	return 0;
 }
 
+/* Adds the kexec_backup= command line parameter to command line. */
+static int cmdline_add_backup(char *cmdline, unsigned long addr)
+{
+	int cmdlen, len, align = 1024;
+	char str[30], *ptr;
+
+	/* Passing in kexec_backup=xxxK format. Saves space required
+	 * in cmdline. Ensure 1K alignment*/
+	if (addr%align)
+		return -1;
+	addr = addr/align;
+	ptr = str;
+	strcpy(str, " kexec_backup=");

kexec/arch/i386/crashdump-x86.c line 453

Quoted 10 lines
kexec/arch/i386/crashdump-x86.c +10 -0
+	ptr += strlen(str);
+	ultoa(addr, ptr);
+	strcat(str, "K");
+	len = strlen(str);
+	cmdlen = strlen(cmdline) + len;
+	if (cmdlen > (COMMAND_LINE_SIZE - 1))
+		die("Command line overflow\n");
+	strcat(cmdline, str);
+	return 0;
+}

This part did not apply for me -- it seems crashdump related and I did not have that applied. Is it critical?

Quoted 54 lines

Index: kexec-tools-1.101/kexec/kexec.c
===================================================================

kexec/kexec.c +21 -0
@@ -660,6 +660,17 @@
 	return -1;
 }
 
+/*
+ *	Jump to the new kernel
+ */
+static int my_jump(void)
+{
+	int result;
+
+	result = kexec_jump();
+	return result;
+}
+
 static void version(void)
 {
 	printf("kexec " VERSION " released " RELEASE_DATE "\n");
@@ -683,6 +694,7 @@
 		" -p, --load-panic     Load the new kernel for use on panic.\n"
 		" -u, --unload         Unload the current kexec target kernel.\n"
 		" -e, --exec           Execute a currently loaded kernel.\n"
+		" -j, --jump           Jump to a currently loaded kernel or jump back to the previous kernel.\n"
 		" -t, --type=TYPE      Specify the new kernel is of this type.\n"
 		"     --mem-min=<addr> Specify the lowest memory addres to load code into.\n"
 		"     --mem-max=<addr> Specify the highest memory addres to load code into.\n"
@@ -715,6 +727,7 @@
 {
 	int do_load = 1;
 	int do_exec = 0;
+	int do_jump = 0;
 	int do_shutdown = 1;
 	int do_sync = 1;
 	int do_ifdown = 0;
@@ -768,6 +781,14 @@
 			do_ifdown = 1;
 			do_exec = 1;
 			break;
+		case OPT_JUMP:
+			do_load = 0;
+			do_shutdown = 0;
+			do_sync = 1;
+			do_ifdown = 0;
+			do_exec = 0;
+			do_jump = 1;
+			break;
 		case OPT_TYPE:
 			type = optarg;
 			break;

kexec/kexec.c line 860

Quoted 7 lines
kexec/kexec.c +3 -0
@@ -833,6 +854,9 @@
 	if ((result == 0) && do_exec) {
 		result = my_exec();
 	}
+	if ((result == 0) && do_jump) {
+		result = my_jump();
+	}
 

Well, it may be nice to print something to the user he. kexec
-j does nothing, and does not print error message in case something is wrong...
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#15 lore raw
In reply to Huang, Ying

Hi!

Quoted 21 lines

Index: kexec-tools-1.101/kexec/arch/i386/crashdump-x86.c
===================================================================

kexec/arch/i386/crashdump-x86.c +13 -0
@@ -428,6 +428,29 @@
 	return 0;
 }
 
+/* Adds the kexec_backup= command line parameter to command line. */
+static int cmdline_add_backup(char *cmdline, unsigned long addr)
+{
+	int cmdlen, len, align = 1024;
+	char str[30], *ptr;
+
+	/* Passing in kexec_backup=xxxK format. Saves space required
+	 * in cmdline. Ensure 1K alignment*/
+	if (addr%align)
+		return -1;
+	addr = addr/align;
+	ptr = str;
+	strcpy(str, " kexec_backup=");

kexec/arch/i386/crashdump-x86.c line 453

Quoted 10 lines
kexec/arch/i386/crashdump-x86.c +10 -0
+	ptr += strlen(str);
+	ultoa(addr, ptr);
+	strcat(str, "K");
+	len = strlen(str);
+	cmdlen = strlen(cmdline) + len;
+	if (cmdlen > (COMMAND_LINE_SIZE - 1))
+		die("Command line overflow\n");
+	strcat(cmdline, str);
+	return 0;
+}

This part did not apply for me -- it seems crashdump related and I did not have that applied. Is it critical?

Quoted 54 lines

Index: kexec-tools-1.101/kexec/kexec.c
===================================================================

kexec/kexec.c +21 -0
@@ -660,6 +660,17 @@
 	return -1;
 }
 
+/*
+ *	Jump to the new kernel
+ */
+static int my_jump(void)
+{
+	int result;
+
+	result = kexec_jump();
+	return result;
+}
+
 static void version(void)
 {
 	printf("kexec " VERSION " released " RELEASE_DATE "\n");
@@ -683,6 +694,7 @@
 		" -p, --load-panic     Load the new kernel for use on panic.\n"
 		" -u, --unload         Unload the current kexec target kernel.\n"
 		" -e, --exec           Execute a currently loaded kernel.\n"
+		" -j, --jump           Jump to a currently loaded kernel or jump back to the previous kernel.\n"
 		" -t, --type=TYPE      Specify the new kernel is of this type.\n"
 		"     --mem-min=<addr> Specify the lowest memory addres to load code into.\n"
 		"     --mem-max=<addr> Specify the highest memory addres to load code into.\n"
@@ -715,6 +727,7 @@
 {
 	int do_load = 1;
 	int do_exec = 0;
+	int do_jump = 0;
 	int do_shutdown = 1;
 	int do_sync = 1;
 	int do_ifdown = 0;
@@ -768,6 +781,14 @@
 			do_ifdown = 1;
 			do_exec = 1;
 			break;
+		case OPT_JUMP:
+			do_load = 0;
+			do_shutdown = 0;
+			do_sync = 1;
+			do_ifdown = 0;
+			do_exec = 0;
+			do_jump = 1;
+			break;
 		case OPT_TYPE:
 			type = optarg;
 			break;

kexec/kexec.c line 860

Quoted 7 lines
kexec/kexec.c +3 -0
@@ -833,6 +854,9 @@
 	if ((result == 0) && do_exec) {
 		result = my_exec();
 	}
+	if ((result == 0) && do_jump) {
+		result = my_jump();
+	}
 

Well, it may be nice to print something to the user he. kexec
-j does nothing, and does not print error message in case something is wrong...
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#16 lore raw
Quoted 26 lines · Pavel Machek
Quoted 26 lines

Index: kexec-tools-1.101/kexec/arch/i386/crashdump-x86.c
===================================================================

kexec/arch/i386/crashdump-x86.c +18 -0
@@ -428,6 +428,29 @@
 	return 0;
 }
 
+/* Adds the kexec_backup= command line parameter to command line. */
+static int cmdline_add_backup(char *cmdline, unsigned long addr)
+{
+	int cmdlen, len, align = 1024;
+	char str[30], *ptr;
+
+	/* Passing in kexec_backup=xxxK format. Saves space required
+	 * in cmdline. Ensure 1K alignment*/
+	if (addr%align)
+		return -1;
+	addr = addr/align;
+	ptr = str;
+	strcpy(str, " kexec_backup=");
+	ptr += strlen(str);
+	ultoa(addr, ptr);
+	strcat(str, "K");
+	len = strlen(str);
+	cmdlen = strlen(cmdline) + len;
Quoted 8 lines

kexec/arch/i386/crashdump-x86.c line 453

Quoted 5 lines
kexec/arch/i386/crashdump-x86.c +5 -0
+	if (cmdlen > (COMMAND_LINE_SIZE - 1))
+		die("Command line overflow\n");
+	strcat(cmdline, str);
+	return 0;
+}

This part did not apply for me -- it seems crashdump related and I did not have that applied. Is it critical?

This is needed for kexec_jump to work properly. Which version of kexec-tools do you use? This patch is against 1.101. The kdump patch must be applied before this patch is applied.

Quoted 57 lines
Quoted 57 lines

Index: kexec-tools-1.101/kexec/kexec.c
===================================================================

kexec/kexec.c +21 -0
@@ -660,6 +660,17 @@
 	return -1;
 }
 
+/*
+ *	Jump to the new kernel
+ */
+static int my_jump(void)
+{
+	int result;
+
+	result = kexec_jump();
+	return result;
+}
+
 static void version(void)
 {
 	printf("kexec " VERSION " released " RELEASE_DATE "\n");
@@ -683,6 +694,7 @@
 		" -p, --load-panic     Load the new kernel for use on panic.\n"
 		" -u, --unload         Unload the current kexec target kernel.\n"
 		" -e, --exec           Execute a currently loaded kernel.\n"
+		" -j, --jump           Jump to a currently loaded kernel or jump back to the previous kernel.\n"
 		" -t, --type=TYPE      Specify the new kernel is of this type.\n"
 		"     --mem-min=<addr> Specify the lowest memory addres to load code into.\n"
 		"     --mem-max=<addr> Specify the highest memory addres to load code into.\n"
@@ -715,6 +727,7 @@
 {
 	int do_load = 1;
 	int do_exec = 0;
+	int do_jump = 0;
 	int do_shutdown = 1;
 	int do_sync = 1;
 	int do_ifdown = 0;
@@ -768,6 +781,14 @@
 			do_ifdown = 1;
 			do_exec = 1;
 			break;
+		case OPT_JUMP:
+			do_load = 0;
+			do_shutdown = 0;
+			do_sync = 1;
+			do_ifdown = 0;
+			do_exec = 0;
+			do_jump = 1;
+			break;
 		case OPT_TYPE:
 			type = optarg;
 			break;
@@ -833,6 +854,9 @@
 	if ((result == 0) && do_exec) {
 		result = my_exec();
 	}
Quoted 8 lines

kexec/kexec.c line 860

Quoted 4 lines
kexec/kexec.c +3 -0
+	if ((result == 0) && do_jump) {
+		result = my_jump();
+	}
 

Well, it may be nice to print something to the user he. kexec -j does nothing, and does not print error message in case something is wrong...

Yes. At least some message should be printed in case something is wrong. I will fix it in the next version.

Best Regards,
Huang Ying

#17 lore raw
Quoted 38 lines · Ying
Quoted 3 lines · Pavel Machek
Quoted 3 lines

Index: kexec-tools-1.101/kexec/arch/i386/crashdump-x86.c
===================================================================
--- kexec-tools-1.101.orig/kexec/arch/i386/crashdump-x86.c 2007-07-08

23:00:25.000000000 +0800

Quoted 1 line
Quoted 1 line

+++ kexec-tools-1.101/kexec/arch/i386/crashdump-x86.c 2007-07-14

17:06:45.000000000 +0800

Quoted 22 lines
Quoted 22 lines
kexec/arch/i386/crashdump-x86.c +18 -0
@@ -428,6 +428,29 @@
 	return 0;
 }
 
+/* Adds the kexec_backup= command line parameter to command line. */
+static int cmdline_add_backup(char *cmdline, unsigned long addr)
+{
+	int cmdlen, len, align = 1024;
+	char str[30], *ptr;
+
+	/* Passing in kexec_backup=xxxK format. Saves space required
+	 * in cmdline. Ensure 1K alignment*/
+	if (addr%align)
+		return -1;
+	addr = addr/align;
+	ptr = str;
+	strcpy(str, " kexec_backup=");
+	ptr += strlen(str);
+	ultoa(addr, ptr);
+	strcat(str, "K");
+	len = strlen(str);
+	cmdlen = strlen(cmdline) + len;
Quoted 8 lines

kexec/arch/i386/crashdump-x86.c line 453

Quoted 5 lines
kexec/arch/i386/crashdump-x86.c +5 -0
+	if (cmdlen > (COMMAND_LINE_SIZE - 1))
+		die("Command line overflow\n");
+	strcat(cmdline, str);
+	return 0;
+}

This part did not apply for me -- it seems crashdump related and I did not have that applied. Is it critical?

Quoted 3 lines

This is needed for kexec_jump to work properly. Which version of kexec-tools do you use? This patch is against 1.101. The kdump patch must be applied before this patch is applied.

Please work against the kexec-tools-testing tree, if you can. All of the outstanding patches should be there.

Eric

#23 lore raw
In reply to Huang, Ying

Hi!

Quoted 7 lines

3. Boot kernel compiled for normal usage, the reserved crash kernel memory region must be added to kernel command line as following:

crashkernel=<XX>M@<XX>M

Where, <XX> should be replaced by the real memory size and
position.

I used crashkernel=64M@64M .

Quoted 11 lines

4. Load kernel compiled for hibernating usage as a crashdump kernel with kexec, the same kernel as that of 3 can be used if CONFIG_RELOCATABLE=y is selected. The kernel command line option as following must be appended to kernel command line.

kexec_jump_buf_pfn=cat /sys/kernel/kexec_jump_buf_pfn

For example, the shell command line can be as follow:

   kexec -p /boot/vmlinux --args-linux --append="root=/dev/hdb signal
       kexec_jump_buf_pfn=`cat /sys/kernel/kexec_jump_buf_pfn`"

I think I followed the instructions closely. Now I'm trying to do

kexec -p /data/l/linux/vmlinux --args-linux --append="init=/bin/bash kexec_jump_buf_pfn=cat /sys/kernel/kexec_jump_buf_pfn"

but it tells me:

Invalid memory segment 0x100000 - 0x7a0fff

(and nothing in dmesg)

If I try to load bzImage (corresponding to vmlinux I tried to use), I get:

root@amd:~# kexec -p /data/l/linux/arch/i386/boot/bzImage --append="init=/bin/bash kexec_jump_buf_pfn=`cat /sys/kernel/kexec_jump_buf_pfn`"
Could not find a free area of memory of 9000 bytes...
locate_hole failed
root@amd:~#

What am I doing wrong?
Pavel

Signature · 7 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#33 lore raw
In reply to Huang, Ying

Hi!

Quoted 7 lines

3. Boot kernel compiled for normal usage, the reserved crash kernel memory region must be added to kernel command line as following:

crashkernel=<XX>M@<XX>M

Where, <XX> should be replaced by the real memory size and
position.

I used crashkernel=64M@64M .

Quoted 11 lines

4. Load kernel compiled for hibernating usage as a crashdump kernel with kexec, the same kernel as that of 3 can be used if CONFIG_RELOCATABLE=y is selected. The kernel command line option as following must be appended to kernel command line.

kexec_jump_buf_pfn=cat /sys/kernel/kexec_jump_buf_pfn

For example, the shell command line can be as follow:

   kexec -p /boot/vmlinux --args-linux --append="root=/dev/hdb signal
       kexec_jump_buf_pfn=`cat /sys/kernel/kexec_jump_buf_pfn`"

I think I followed the instructions closely. Now I'm trying to do

kexec -p /data/l/linux/vmlinux --args-linux --append="init=/bin/bash kexec_jump_buf_pfn=cat /sys/kernel/kexec_jump_buf_pfn"

but it tells me:

Invalid memory segment 0x100000 - 0x7a0fff

(and nothing in dmesg)

If I try to load bzImage (corresponding to vmlinux I tried to use), I get:

root@amd:~# kexec -p /data/l/linux/arch/i386/boot/bzImage --append="init=/bin/bash kexec_jump_buf_pfn=`cat /sys/kernel/kexec_jump_buf_pfn`"
Could not find a free area of memory of 9000 bytes...
locate_hole failed
root@amd:~#

What am I doing wrong?
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#18 lore raw
In reply to Eric W. Biederman

Hi!

Quoted 28 lines
Quoted 28 lines
Quoted 27 lines
Quoted 14 lines
kexec/arch/i386/crashdump-x86.c +13 -0
+/* Adds the kexec_backup= command line parameter to command line. */
+static int cmdline_add_backup(char *cmdline, unsigned long addr)
+{
+	int cmdlen, len, align = 1024;
+	char str[30], *ptr;
+
+	/* Passing in kexec_backup=xxxK format. Saves space required
+	 * in cmdline. Ensure 1K alignment*/
+	if (addr%align)
+		return -1;
+	addr = addr/align;
+	ptr = str;
+	strcpy(str, " kexec_backup=");

kexec/arch/i386/crashdump-x86.c line 453

Quoted 10 lines
kexec/arch/i386/crashdump-x86.c +10 -0
+	ptr += strlen(str);
+	ultoa(addr, ptr);
+	strcat(str, "K");
+	len = strlen(str);
+	cmdlen = strlen(cmdline) + len;
+	if (cmdlen > (COMMAND_LINE_SIZE - 1))
+		die("Command line overflow\n");
+	strcat(cmdline, str);
+	return 0;
+}

This part did not apply for me -- it seems crashdump related and I did not have that applied. Is it critical?

Quoted 6 lines
Quoted 3 lines

This is needed for kexec_jump to work properly. Which version of kexec-tools do you use? This patch is against 1.101. The kdump patch must be applied before this patch is applied.

Please work against the kexec-tools-testing tree, if you can. All of the outstanding patches should be there.

So
git://git.kernel.org/pub/scm/linux/kernel/git/horms/kexec-tools-testing.git
is the right tree to use?

Pavel

Signature · 7 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#21 lore raw
In reply to Huang, Ying

Hi!

Quoted 6 lines
Quoted 2 lines

This part did not apply for me -- it seems crashdump related and I did not have that applied. Is it critical?

This is needed for kexec_jump to work properly. Which version of kexec-tools do you use? This patch is against 1.101. The kdump patch must be applied before this patch is applied.

Ok, did that, got a clean compile, but still could not get it to work.
Pavel

Signature · 7 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#22 lore raw
In reply to Huang, Ying

Hi!

Quoted 6 lines
Quoted 2 lines

This part did not apply for me -- it seems crashdump related and I did not have that applied. Is it critical?

This is needed for kexec_jump to work properly. Which version of kexec-tools do you use? This patch is against 1.101. The kdump patch must be applied before this patch is applied.

Ok, did that, got a clean compile, but still could not get it to work.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#19 lore raw
In reply to Eric W. Biederman
Quoted 40 lines · Eric W. Biederman
Quoted 38 lines · Ying
Quoted 3 lines · Pavel Machek
Quoted 3 lines

Index: kexec-tools-1.101/kexec/arch/i386/crashdump-x86.c
===================================================================
--- kexec-tools-1.101.orig/kexec/arch/i386/crashdump-x86.c 2007-07-08

23:00:25.000000000 +0800

Quoted 1 line
Quoted 1 line

+++ kexec-tools-1.101/kexec/arch/i386/crashdump-x86.c 2007-07-14

17:06:45.000000000 +0800

Quoted 30 lines
Quoted 17 lines
kexec/arch/i386/crashdump-x86.c +13 -0
@@ -428,6 +428,29 @@
 	return 0;
 }
 
+/* Adds the kexec_backup= command line parameter to command line. */
+static int cmdline_add_backup(char *cmdline, unsigned long addr)
+{
+	int cmdlen, len, align = 1024;
+	char str[30], *ptr;
+
+	/* Passing in kexec_backup=xxxK format. Saves space required
+	 * in cmdline. Ensure 1K alignment*/
+	if (addr%align)
+		return -1;
+	addr = addr/align;
+	ptr = str;
+	strcpy(str, " kexec_backup=");

kexec/arch/i386/crashdump-x86.c line 453

Quoted 10 lines
kexec/arch/i386/crashdump-x86.c +10 -0
+	ptr += strlen(str);
+	ultoa(addr, ptr);
+	strcat(str, "K");
+	len = strlen(str);
+	cmdlen = strlen(cmdline) + len;
+	if (cmdlen > (COMMAND_LINE_SIZE - 1))
+		die("Command line overflow\n");
+	strcat(cmdline, str);
+	return 0;
+}

This part did not apply for me -- it seems crashdump related and I did not have that applied. Is it critical?

Quoted 6 lines
Quoted 3 lines

This is needed for kexec_jump to work properly. Which version of kexec-tools do you use? This patch is against 1.101. The kdump patch must be applied before this patch is applied.

Please work against the kexec-tools-testing tree, if you can. All of the outstanding patches should be there.

OK, I will work against the kexec-tools-testing tree in the next version.

Best Regards,
Huang Ying

#20 lore raw
In reply to Eric W. Biederman
Quoted 40 lines · Eric W. Biederman
Quoted 38 lines · Ying
Quoted 3 lines · Pavel Machek
Quoted 3 lines

Index: kexec-tools-1.101/kexec/arch/i386/crashdump-x86.c
===================================================================
--- kexec-tools-1.101.orig/kexec/arch/i386/crashdump-x86.c 2007-07-08

23:00:25.000000000 +0800

Quoted 1 line
Quoted 1 line

+++ kexec-tools-1.101/kexec/arch/i386/crashdump-x86.c 2007-07-14

17:06:45.000000000 +0800

Quoted 30 lines
Quoted 17 lines
kexec/arch/i386/crashdump-x86.c +13 -0
@@ -428,6 +428,29 @@
 	return 0;
 }
 
+/* Adds the kexec_backup= command line parameter to command line. */
+static int cmdline_add_backup(char *cmdline, unsigned long addr)
+{
+	int cmdlen, len, align = 1024;
+	char str[30], *ptr;
+
+	/* Passing in kexec_backup=xxxK format. Saves space required
+	 * in cmdline. Ensure 1K alignment*/
+	if (addr%align)
+		return -1;
+	addr = addr/align;
+	ptr = str;
+	strcpy(str, " kexec_backup=");

kexec/arch/i386/crashdump-x86.c line 453

Quoted 10 lines
kexec/arch/i386/crashdump-x86.c +10 -0
+	ptr += strlen(str);
+	ultoa(addr, ptr);
+	strcat(str, "K");
+	len = strlen(str);
+	cmdlen = strlen(cmdline) + len;
+	if (cmdlen > (COMMAND_LINE_SIZE - 1))
+		die("Command line overflow\n");
+	strcat(cmdline, str);
+	return 0;
+}

This part did not apply for me -- it seems crashdump related and I did not have that applied. Is it critical?

Quoted 6 lines
Quoted 3 lines

This is needed for kexec_jump to work properly. Which version of kexec-tools do you use? This patch is against 1.101. The kdump patch must be applied before this patch is applied.

Please work against the kexec-tools-testing tree, if you can. All of the outstanding patches should be there.

OK, I will work against the kexec-tools-testing tree in the next version.

Best Regards,
Huang Ying

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

#24 lore raw
In reply to Pavel Machek
Quoted 39 lines · Pavel Machek

Hi!

Quoted 7 lines

3. Boot kernel compiled for normal usage, the reserved crash kernel memory region must be added to kernel command line as following:

crashkernel=<XX>M@<XX>M

Where, <XX> should be replaced by the real memory size and
position.

I used crashkernel=64M@64M .

Quoted 11 lines

4. Load kernel compiled for hibernating usage as a crashdump kernel with kexec, the same kernel as that of 3 can be used if CONFIG_RELOCATABLE=y is selected. The kernel command line option as following must be appended to kernel command line.

kexec_jump_buf_pfn=cat /sys/kernel/kexec_jump_buf_pfn

For example, the shell command line can be as follow:

   kexec -p /boot/vmlinux --args-linux --append="root=/dev/hdb signal
       kexec_jump_buf_pfn=`cat /sys/kernel/kexec_jump_buf_pfn`"

I think I followed the instructions closely. Now I'm trying to do

kexec -p /data/l/linux/vmlinux --args-linux --append="init=/bin/bash kexec_jump_buf_pfn=cat /sys/kernel/kexec_jump_buf_pfn"

but it tells me:

Invalid memory segment 0x100000 - 0x7a0fff

(and nothing in dmesg)

If I try to load bzImage (corresponding to vmlinux I tried to use), I get:

Quoted 6 lines
root@amd:~# kexec -p /data/l/linux/arch/i386/boot/bzImage --append="init=/bin/bash kexec_jump_buf_pfn=`cat /sys/kernel/kexec_jump_buf_pfn`"
Could not find a free area of memory of 9000 bytes...
locate_hole failed
root@amd:~#

What am I doing wrong?

The kexec-tools version 1.101 does not work perfectly with relocatable kernel. This would have been solved if I worked against kexec-tools testing tree. I will work against testing tree in the next version.

But, with some trick, it can work. When configure kernel, make sure the following option is set:

CONFIG_PHYSICAL_START=0x4000000 # if crashkernel=<XX>M@64M

Best Regards,
Huang Ying

#25 lore raw
In reply to Pavel Machek
Quoted 39 lines · Pavel Machek

Hi!

Quoted 7 lines

3. Boot kernel compiled for normal usage, the reserved crash kernel memory region must be added to kernel command line as following:

crashkernel=<XX>M@<XX>M

Where, <XX> should be replaced by the real memory size and
position.

I used crashkernel=64M@64M .

Quoted 11 lines

4. Load kernel compiled for hibernating usage as a crashdump kernel with kexec, the same kernel as that of 3 can be used if CONFIG_RELOCATABLE=y is selected. The kernel command line option as following must be appended to kernel command line.

kexec_jump_buf_pfn=cat /sys/kernel/kexec_jump_buf_pfn

For example, the shell command line can be as follow:

   kexec -p /boot/vmlinux --args-linux --append="root=/dev/hdb signal
       kexec_jump_buf_pfn=`cat /sys/kernel/kexec_jump_buf_pfn`"

I think I followed the instructions closely. Now I'm trying to do

kexec -p /data/l/linux/vmlinux --args-linux --append="init=/bin/bash kexec_jump_buf_pfn=cat /sys/kernel/kexec_jump_buf_pfn"

but it tells me:

Invalid memory segment 0x100000 - 0x7a0fff

(and nothing in dmesg)

If I try to load bzImage (corresponding to vmlinux I tried to use), I get:

Quoted 6 lines
root@amd:~# kexec -p /data/l/linux/arch/i386/boot/bzImage --append="init=/bin/bash kexec_jump_buf_pfn=`cat /sys/kernel/kexec_jump_buf_pfn`"
Could not find a free area of memory of 9000 bytes...
locate_hole failed
root@amd:~#

What am I doing wrong?

The kexec-tools version 1.101 does not work perfectly with relocatable kernel. This would have been solved if I worked against kexec-tools testing tree. I will work against testing tree in the next version.

But, with some trick, it can work. When configure kernel, make sure the following option is set:

CONFIG_PHYSICAL_START=0x4000000 # if crashkernel=<XX>M@64M

Best Regards,
Huang Ying

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

#26 lore raw

Hi!

Quoted 7 lines
Quoted 6 lines
root@amd:~# kexec -p /data/l/linux/arch/i386/boot/bzImage --append="init=/bin/bash kexec_jump_buf_pfn=`cat /sys/kernel/kexec_jump_buf_pfn`"
Could not find a free area of memory of 9000 bytes...
locate_hole failed
root@amd:~#

What am I doing wrong?

Quoted 8 lines

The kexec-tools version 1.101 does not work perfectly with relocatable kernel. This would have been solved if I worked against kexec-tools testing tree. I will work against testing tree in the next version.

But, with some trick, it can work. When configure kernel, make sure the following option is set:

CONFIG_PHYSICAL_START=0x4000000 # if crashkernel=<XX>M@64M

Did the trick, I got the kernel to load, and it even attempted exec... but I got doublefault (or what is it?)

Int 6: ... EIP: c4739906. Address is in reserve_bootmem_core.

Do I have to disable ACPI completely? I tried with acpi=off, nosmp... but problem does not seem device related.
Pavel

Signature · 7 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#32 lore raw
In reply to Huang, Ying

Hi!

Quoted 7 lines
Quoted 6 lines
root@amd:~# kexec -p /data/l/linux/arch/i386/boot/bzImage --append="init=/bin/bash kexec_jump_buf_pfn=`cat /sys/kernel/kexec_jump_buf_pfn`"
Could not find a free area of memory of 9000 bytes...
locate_hole failed
root@amd:~#

What am I doing wrong?

Quoted 8 lines

The kexec-tools version 1.101 does not work perfectly with relocatable kernel. This would have been solved if I worked against kexec-tools testing tree. I will work against testing tree in the next version.

But, with some trick, it can work. When configure kernel, make sure the following option is set:

CONFIG_PHYSICAL_START=0x4000000 # if crashkernel=<XX>M@64M

Did the trick, I got the kernel to load, and it even attempted exec... but I got doublefault (or what is it?)

Int 6: ... EIP: c4739906. Address is in reserve_bootmem_core.

Do I have to disable ACPI completely? I tried with acpi=off, nosmp... but problem does not seem device related.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#27 lore raw
In reply to Pavel Machek
Quoted 7 lines · Pavel Machek

Did the trick, I got the kernel to load, and it even attempted exec... but I got doublefault (or what is it?)

Int 6: ... EIP: c4739906. Address is in reserve_bootmem_core.

Do I have to disable ACPI completely? I tried with acpi=off, nosmp... but problem does not seem device related.

It seems that the problem has nothing to do with device or ACPI. Can you do a normal kexec? That is:

kexec -l <...>
kexec -e

or

kexec -p <...>
ALT-SysRq-c to trigger a crash dump.

Best Regards,
Huang Ying

#28 lore raw
In reply to Pavel Machek
Quoted 7 lines · Pavel Machek

Did the trick, I got the kernel to load, and it even attempted exec... but I got doublefault (or what is it?)

Int 6: ... EIP: c4739906. Address is in reserve_bootmem_core.

Do I have to disable ACPI completely? I tried with acpi=off, nosmp... but problem does not seem device related.

It seems that the problem has nothing to do with device or ACPI. Can you do a normal kexec? That is:

kexec -l <...>
kexec -e

or

kexec -p <...>
ALT-SysRq-c to trigger a crash dump.

Best Regards,
Huang Ying

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

#29 lore raw

Hi!

Quoted 11 lines
Quoted 7 lines

Did the trick, I got the kernel to load, and it even attempted exec... but I got doublefault (or what is it?)

Int 6: ... EIP: c4739906. Address is in reserve_bootmem_core.

Do I have to disable ACPI completely? I tried with acpi=off, nosmp... but problem does not seem device related.

It seems that the problem has nothing to do with device or ACPI. Can you do a normal kexec? That is:

Quoted 7 lines

kexec -l <...>
kexec -e

or

kexec -p <...>
ALT-SysRq-c to trigger a crash dump.

...that was indeed a problem. I can do successful kexec, as long as I load bzImage (and not vmlinux). (Both kernels 2.6.22 and 2.6.23-rc2-git). Problem is, I can only load bzImage using -l, attempt to load bzImage using -p results in

"Could not find a free area of memory of 9000 bytes" locate_hole failed

. Any ideas?
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#30 lore raw
Quoted 11 lines

-----Original Message-----
From: Pavel Machek [mailto:[email protected]]

Quoted 9 lines
Quoted 7 lines

Did the trick, I got the kernel to load, and it even attempted exec... but I got doublefault (or what is it?)

Int 6: ... EIP: c4739906. Address is in reserve_bootmem_core.

Do I have to disable ACPI completely? I tried with acpi=off, nosmp... but problem does not seem device related.

It seems that the problem has nothing to do with device or ACPI. Can

you

Quoted 15 lines
Quoted 9 lines

do a normal kexec? That is:

kexec -l <...>
kexec -e

or

kexec -p <...>
ALT-SysRq-c to trigger a crash dump.

...that was indeed a problem. I can do successful kexec, as long as I load bzImage (and not vmlinux). (Both kernels 2.6.22 and 2.6.23-rc2-git). Problem is, I can only load bzImage using -l, attempt to load bzImage using -p results in

Quoted 4 lines

"Could not find a free area of memory of 9000 bytes" locate_hole failed

. Any ideas?

The Kexec-tools 1.101 can not deal with bzImage with "-p" properly. So vmlinux must be used with "-p". And the tricks previous mentioned must be used for normal kexec -p too. The example command line is as follow:

kexec -p --args-linux vmlinux --append="root=/dev/<xxx> ..."

Best Regards,
Huang Ying

#31 lore raw
In reply to Pavel Machek
Quoted 11 lines

-----Original Message-----
From: Pavel Machek [mailto:[email protected]]

Quoted 9 lines
Quoted 7 lines

Did the trick, I got the kernel to load, and it even attempted exec... but I got doublefault (or what is it?)

Int 6: ... EIP: c4739906. Address is in reserve_bootmem_core.

Do I have to disable ACPI completely? I tried with acpi=off, nosmp... but problem does not seem device related.

It seems that the problem has nothing to do with device or ACPI. Can

you

Quoted 15 lines
Quoted 9 lines

do a normal kexec? That is:

kexec -l <...>
kexec -e

or

kexec -p <...>
ALT-SysRq-c to trigger a crash dump.

...that was indeed a problem. I can do successful kexec, as long as I load bzImage (and not vmlinux). (Both kernels 2.6.22 and 2.6.23-rc2-git). Problem is, I can only load bzImage using -l, attempt to load bzImage using -p results in

Quoted 4 lines

"Could not find a free area of memory of 9000 bytes" locate_hole failed

. Any ideas?

The Kexec-tools 1.101 can not deal with bzImage with "-p" properly. So vmlinux must be used with "-p". And the tricks previous mentioned must be used for normal kexec -p too. The example command line is as follow:

kexec -p --args-linux vmlinux --append="root=/dev/<xxx> ..."

Best Regards,
Huang Ying

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