linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation
@ 2007-07-15  7:13 Huang, Ying
  2007-07-15  9:08 ` Nigel Cunningham
                   ` (4 more replies)
  0 siblings, 5 replies; 20+ messages in thread
From: Huang, Ying @ 2007-07-15  7:13 UTC (permalink / raw)
  To: Eric W. Biederman, Pavel Machek, nigel, Rafael J. Wysocki,
	Jeremy Maitin-Shepard, Alan Stern, Andrew Morton, david
  Cc: linux-kernel, linux-pm, Kexec Mailing List

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.

---

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
+++ kexec-tools-1.101/kexec/arch/i386/crashdump-x86.c	2007-07-14 17:06:45.000000000 +0800
@@ -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;
 }
Index: kexec-tools-1.101/kexec/kexec-syscall.h
===================================================================
--- kexec-tools-1.101.orig/kexec/kexec-syscall.h	2007-07-14 17:24:52.000000000 +0800
+++ kexec-tools-1.101/kexec/kexec-syscall.h	2007-07-14 17:27:10.000000000 +0800
@@ -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
Index: kexec-tools-1.101/kexec/kexec.c
===================================================================
--- kexec-tools-1.101.orig/kexec/kexec.c	2007-07-14 16:57:26.000000000 +0800
+++ kexec-tools-1.101/kexec/kexec.c	2007-07-14 21:04:51.000000000 +0800
@@ -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);
Index: kexec-tools-1.101/kexec/kexec.h
===================================================================
--- kexec-tools-1.101.orig/kexec/kexec.h	2007-07-14 17:09:28.000000000 +0800
+++ kexec-tools-1.101/kexec/kexec.h	2007-07-14 17:10:43.000000000 +0800
@@ -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);

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation
  2007-07-15  7:13 [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation Huang, Ying
@ 2007-07-15  9:08 ` Nigel Cunningham
  2007-07-15 10:09 ` Rafael J. Wysocki
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 20+ messages in thread
From: Nigel Cunningham @ 2007-07-15  9:08 UTC (permalink / raw)
  To: Huang, Ying
  Cc: Eric W. Biederman, Pavel Machek, Rafael J. Wysocki,
	Jeremy Maitin-Shepard, Alan Stern, Andrew Morton, david,
	linux-kernel, linux-pm, Kexec Mailing List

[-- Attachment #1: Type: text/plain, Size: 1172 bytes --]

Hi.

On Sunday 15 July 2007 17:13:13 Huang, Ying wrote:
> 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
-- 
See http://www.tuxonice.net for Howtos, FAQs, mailing
lists, wiki and bugzilla info.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation
  2007-07-15  7:13 [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation Huang, Ying
  2007-07-15  9:08 ` Nigel Cunningham
@ 2007-07-15 10:09 ` Rafael J. Wysocki
  2007-07-19  1:04 ` Andrew Morton
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 20+ messages in thread
From: Rafael J. Wysocki @ 2007-07-15 10:09 UTC (permalink / raw)
  To: Huang, Ying
  Cc: Eric W. Biederman, Pavel Machek, nigel, Jeremy Maitin-Shepard,
	Alan Stern, Andrew Morton, david, linux-kernel, linux-pm,
	Kexec Mailing List

On Sunday, 15 July 2007 09:13, Huang, Ying wrote:
> 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.

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

> 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.

> 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

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


-- 
"Premature optimization is the root of all evil." - Donald Knuth

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation
  2007-07-15  7:13 [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation Huang, Ying
  2007-07-15  9:08 ` Nigel Cunningham
  2007-07-15 10:09 ` Rafael J. Wysocki
@ 2007-07-19  1:04 ` Andrew Morton
  2007-07-19  2:15   ` Nigel Cunningham
  2007-07-19  6:43   ` Huang, Ying
  2007-07-31  9:10 ` Pavel Machek
  2007-07-31 11:04 ` Pavel Machek
  4 siblings, 2 replies; 20+ messages in thread
From: Andrew Morton @ 2007-07-19  1:04 UTC (permalink / raw)
  To: Huang, Ying
  Cc: Eric W. Biederman, Pavel Machek, nigel, Rafael J. Wysocki,
	Jeremy Maitin-Shepard, Alan Stern, david, linux-kernel, linux-pm,
	Kexec Mailing List

On Sun, 15 Jul 2007 15:13:13 +0800
"Huang, Ying" <ying.huang@intel.com> wrote:

> 
> 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?

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation
  2007-07-19  1:04 ` Andrew Morton
@ 2007-07-19  2:15   ` Nigel Cunningham
  2007-07-19  3:30     ` david
  2007-07-19  6:43   ` Huang, Ying
  1 sibling, 1 reply; 20+ messages in thread
From: Nigel Cunningham @ 2007-07-19  2:15 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Huang, Ying, Eric W. Biederman, Pavel Machek, Rafael J. Wysocki,
	Jeremy Maitin-Shepard, Alan Stern, david, linux-kernel, linux-pm,
	Kexec Mailing List

[-- Attachment #1: Type: text/plain, Size: 1226 bytes --]

Hi.

On Thursday 19 July 2007 11:04:20 Andrew Morton wrote:
> On Sun, 15 Jul 2007 15:13:13 +0800
> "Huang, Ying" <ying.huang@intel.com> wrote:
> 
> > 
> > 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?

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
-- 
See http://www.tuxonice.net for Howtos, FAQs, mailing
lists, wiki and bugzilla info.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation
  2007-07-19  2:15   ` Nigel Cunningham
@ 2007-07-19  3:30     ` david
  0 siblings, 0 replies; 20+ messages in thread
From: david @ 2007-07-19  3:30 UTC (permalink / raw)
  To: nigel
  Cc: Andrew Morton, Huang, Ying, Eric W. Biederman, Pavel Machek,
	Rafael J. Wysocki, Jeremy Maitin-Shepard, Alan Stern,
	linux-kernel, linux-pm, Kexec Mailing List

On Thu, 19 Jul 2007, Nigel Cunningham wrote:

> Hi.
>
> On Thursday 19 July 2007 11:04:20 Andrew Morton wrote:
>> On Sun, 15 Jul 2007 15:13:13 +0800
>> "Huang, Ying" <ying.huang@intel.com> wrote:
>>
>>>
>>> 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?
>
> 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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation
  2007-07-19  1:04 ` Andrew Morton
  2007-07-19  2:15   ` Nigel Cunningham
@ 2007-07-19  6:43   ` Huang, Ying
  2007-07-19  9:13     ` Rafael J. Wysocki
  1 sibling, 1 reply; 20+ messages in thread
From: Huang, Ying @ 2007-07-19  6:43 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Eric W. Biederman, Pavel Machek, nigel, Rafael J. Wysocki,
	Jeremy Maitin-Shepard, Alan Stern, david, linux-kernel, linux-pm,
	Kexec Mailing List

On Wed, 2007-07-18 at 18:04 -0700, Andrew Morton wrote:
> 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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation
  2007-07-19  6:43   ` Huang, Ying
@ 2007-07-19  9:13     ` Rafael J. Wysocki
  0 siblings, 0 replies; 20+ messages in thread
From: Rafael J. Wysocki @ 2007-07-19  9:13 UTC (permalink / raw)
  To: Huang, Ying
  Cc: Andrew Morton, Eric W. Biederman, Pavel Machek, nigel,
	Jeremy Maitin-Shepard, Alan Stern, david, linux-kernel, linux-pm,
	Kexec Mailing List

On Thursday, 19 July 2007 08:43, Huang, Ying wrote:
> On Wed, 2007-07-18 at 18:04 -0700, Andrew Morton wrote:
> > 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 ...

> Without that, the ACPI issue can not be resolved.

Yes, it seems so.

Greetings,
Rafael


-- 
"Premature optimization is the root of all evil." - Donald Knuth

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation
  2007-07-15  7:13 [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation Huang, Ying
                   ` (2 preceding siblings ...)
  2007-07-19  1:04 ` Andrew Morton
@ 2007-07-31  9:10 ` Pavel Machek
  2007-07-31  9:25   ` Huang, Ying
  2007-07-31 11:04 ` Pavel Machek
  4 siblings, 1 reply; 20+ messages in thread
From: Pavel Machek @ 2007-07-31  9:10 UTC (permalink / raw)
  To: Huang, Ying
  Cc: Eric W. Biederman, nigel, Rafael J. Wysocki,
	Jeremy Maitin-Shepard, Alan Stern, Andrew Morton, david,
	linux-kernel, linux-pm, Kexec Mailing List

Hi!


> 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
> +++ kexec-tools-1.101/kexec/arch/i386/crashdump-x86.c	2007-07-14 17:06:45.000000000 +0800
> @@ -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 part did not apply for me -- it seems crashdump related and I did
not have that applied. Is it critical?

> Index: kexec-tools-1.101/kexec/kexec.c
> ===================================================================
> --- kexec-tools-1.101.orig/kexec/kexec.c	2007-07-14 16:57:26.000000000 +0800
> +++ kexec-tools-1.101/kexec/kexec.c	2007-07-14 21:04:51.000000000 +0800
> @@ -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();
> +	}
>  

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
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation
  2007-07-31  9:10 ` Pavel Machek
@ 2007-07-31  9:25   ` Huang, Ying
  2007-07-31 10:52     ` Eric W. Biederman
  2007-07-31 11:14     ` Pavel Machek
  0 siblings, 2 replies; 20+ messages in thread
From: Huang, Ying @ 2007-07-31  9:25 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Eric W. Biederman, nigel, Rafael J. Wysocki,
	Jeremy Maitin-Shepard, Alan Stern, Andrew Morton, david,
	linux-kernel, linux-pm, Kexec Mailing List

On Tue, 2007-07-31 at 11:10 +0200, Pavel Machek wrote:
> > 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
> > +++ kexec-tools-1.101/kexec/arch/i386/crashdump-x86.c	2007-07-14 17:06:45.000000000 +0800
> > @@ -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 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.

> > Index: kexec-tools-1.101/kexec/kexec.c
> > ===================================================================
> > --- kexec-tools-1.101.orig/kexec/kexec.c	2007-07-14 16:57:26.000000000 +0800
> > +++ kexec-tools-1.101/kexec/kexec.c	2007-07-14 21:04:51.000000000 +0800
> > @@ -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();
> > +	}
> >  
> 
> 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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation
  2007-07-31  9:25   ` Huang, Ying
@ 2007-07-31 10:52     ` Eric W. Biederman
  2007-07-31 11:12       ` Pavel Machek
  2007-08-01  1:16       ` Huang, Ying
  2007-07-31 11:14     ` Pavel Machek
  1 sibling, 2 replies; 20+ messages in thread
From: Eric W. Biederman @ 2007-07-31 10:52 UTC (permalink / raw)
  To: Huang, Ying
  Cc: Pavel Machek, nigel, Rafael J. Wysocki, Jeremy Maitin-Shepard,
	Alan Stern, Andrew Morton, david, linux-kernel, linux-pm,
	Kexec Mailing List

"Huang, Ying" <ying.huang@intel.com> writes:

> On Tue, 2007-07-31 at 11:10 +0200, Pavel Machek wrote:
>> > 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
>> > +++ kexec-tools-1.101/kexec/arch/i386/crashdump-x86.c 2007-07-14
> 17:06:45.000000000 +0800
>> > @@ -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 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.

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

Eric

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation
  2007-07-15  7:13 [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation Huang, Ying
                   ` (3 preceding siblings ...)
  2007-07-31  9:10 ` Pavel Machek
@ 2007-07-31 11:04 ` Pavel Machek
  2007-08-01  1:34   ` Huang, Ying
  4 siblings, 1 reply; 20+ messages in thread
From: Pavel Machek @ 2007-07-31 11:04 UTC (permalink / raw)
  To: Huang, Ying
  Cc: Eric W. Biederman, nigel, Rafael J. Wysocki,
	Jeremy Maitin-Shepard, Alan Stern, Andrew Morton, david,
	linux-kernel, linux-pm, Kexec Mailing List

Hi!

> 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 .


> 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
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation
  2007-07-31 10:52     ` Eric W. Biederman
@ 2007-07-31 11:12       ` Pavel Machek
  2007-08-01  1:16       ` Huang, Ying
  1 sibling, 0 replies; 20+ messages in thread
From: Pavel Machek @ 2007-07-31 11:12 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: Huang, Ying, nigel, Rafael J. Wysocki, Jeremy Maitin-Shepard,
	Alan Stern, Andrew Morton, david, linux-kernel, linux-pm,
	Kexec Mailing List

Hi!

> >> >  
> >> > +/* 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 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.
> 
> 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
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation
  2007-07-31  9:25   ` Huang, Ying
  2007-07-31 10:52     ` Eric W. Biederman
@ 2007-07-31 11:14     ` Pavel Machek
  1 sibling, 0 replies; 20+ messages in thread
From: Pavel Machek @ 2007-07-31 11:14 UTC (permalink / raw)
  To: Huang, Ying
  Cc: Eric W. Biederman, nigel, Rafael J. Wysocki,
	Jeremy Maitin-Shepard, Alan Stern, Andrew Morton, david,
	linux-kernel, linux-pm, Kexec Mailing List

Hi!

> > 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
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation
  2007-07-31 10:52     ` Eric W. Biederman
  2007-07-31 11:12       ` Pavel Machek
@ 2007-08-01  1:16       ` Huang, Ying
  1 sibling, 0 replies; 20+ messages in thread
From: Huang, Ying @ 2007-08-01  1:16 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: Pavel Machek, nigel, Rafael J. Wysocki, Jeremy Maitin-Shepard,
	Alan Stern, Andrew Morton, david, linux-kernel, linux-pm,
	Kexec Mailing List

On Tue, 2007-07-31 at 04:52 -0600, Eric W. Biederman wrote:
> "Huang, Ying" <ying.huang@intel.com> writes:
> 
> > On Tue, 2007-07-31 at 11:10 +0200, Pavel Machek wrote:
> >> > 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
> >> > +++ kexec-tools-1.101/kexec/arch/i386/crashdump-x86.c 2007-07-14
> > 17:06:45.000000000 +0800
> >> > @@ -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 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.
> 
> 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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation
  2007-07-31 11:04 ` Pavel Machek
@ 2007-08-01  1:34   ` Huang, Ying
  2007-08-05 18:55     ` Pavel Machek
  0 siblings, 1 reply; 20+ messages in thread
From: Huang, Ying @ 2007-08-01  1:34 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Eric W. Biederman, nigel, Rafael J. Wysocki,
	Jeremy Maitin-Shepard, Alan Stern, Andrew Morton, david,
	linux-kernel, linux-pm, Kexec Mailing List

On Tue, 2007-07-31 at 13:04 +0200, Pavel Machek wrote:
> Hi!
> 
> > 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 .
> 
> 
> > 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?

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation
  2007-08-01  1:34   ` Huang, Ying
@ 2007-08-05 18:55     ` Pavel Machek
  2007-08-06  2:31       ` Huang, Ying
  0 siblings, 1 reply; 20+ messages in thread
From: Pavel Machek @ 2007-08-05 18:55 UTC (permalink / raw)
  To: Huang, Ying
  Cc: Eric W. Biederman, nigel, Rafael J. Wysocki,
	Jeremy Maitin-Shepard, Alan Stern, Andrew Morton, david,
	linux-kernel, linux-pm, Kexec Mailing List

Hi!

> > 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

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
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation
  2007-08-05 18:55     ` Pavel Machek
@ 2007-08-06  2:31       ` Huang, Ying
  2007-08-06  9:02         ` Pavel Machek
  0 siblings, 1 reply; 20+ messages in thread
From: Huang, Ying @ 2007-08-06  2:31 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Eric W. Biederman, nigel, Rafael J. Wysocki,
	Jeremy Maitin-Shepard, Alan Stern, Andrew Morton, david,
	linux-kernel, linux-pm, Kexec Mailing List

On Sun, 2007-08-05 at 20:55 +0200, Pavel Machek wrote:
> 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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation
  2007-08-06  2:31       ` Huang, Ying
@ 2007-08-06  9:02         ` Pavel Machek
  2007-08-06 13:22           ` Huang, Ying
  0 siblings, 1 reply; 20+ messages in thread
From: Pavel Machek @ 2007-08-06  9:02 UTC (permalink / raw)
  To: Huang, Ying
  Cc: Eric W. Biederman, nigel, Rafael J. Wysocki,
	Jeremy Maitin-Shepard, Alan Stern, Andrew Morton, david,
	linux-kernel, linux-pm, Kexec Mailing List

Hi!

> > 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.

...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
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation
  2007-08-06  9:02         ` Pavel Machek
@ 2007-08-06 13:22           ` Huang, Ying
  0 siblings, 0 replies; 20+ messages in thread
From: Huang, Ying @ 2007-08-06 13:22 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Eric W. Biederman, nigel, Rafael J. Wysocki,
	Jeremy Maitin-Shepard, Alan Stern, Andrew Morton, david,
	linux-kernel, linux-pm, Kexec Mailing List

>-----Original Message-----
>From: Pavel Machek [mailto:pavel@ucw.cz]
>> > 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.
>
>...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?

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2007-08-06 13:31 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-15  7:13 [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation Huang, Ying
2007-07-15  9:08 ` Nigel Cunningham
2007-07-15 10:09 ` Rafael J. Wysocki
2007-07-19  1:04 ` Andrew Morton
2007-07-19  2:15   ` Nigel Cunningham
2007-07-19  3:30     ` david
2007-07-19  6:43   ` Huang, Ying
2007-07-19  9:13     ` Rafael J. Wysocki
2007-07-31  9:10 ` Pavel Machek
2007-07-31  9:25   ` Huang, Ying
2007-07-31 10:52     ` Eric W. Biederman
2007-07-31 11:12       ` Pavel Machek
2007-08-01  1:16       ` Huang, Ying
2007-07-31 11:14     ` Pavel Machek
2007-07-31 11:04 ` Pavel Machek
2007-08-01  1:34   ` Huang, Ying
2007-08-05 18:55     ` Pavel Machek
2007-08-06  2:31       ` Huang, Ying
2007-08-06  9:02         ` Pavel Machek
2007-08-06 13:22           ` Huang, Ying

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).