Welcome to Soft32 Linux Forums!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

[PATH 0/1] Kexec jump - v2 - the first step to kexec based..

 
Goto page 1, 2
   Soft32 Home -> Linux -> Kernel RSS
Next:  [PATCH 2/2] MCA: setup ifdefs  
Author Message
Huang, Ying

External


Since: Jun 08, 2007
Posts: 58



(Msg. 1) Posted: Sun Jul 15, 2007 4:20 am
Post subject: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation
Archived from groups: linux>kernel (more info?)

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);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.DeleteThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Rafael J. Wysocki

External


Since: Aug 02, 2005
Posts: 1886



(Msg. 2) Posted: Sun Jul 15, 2007 7:10 am
Post subject: Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.DeleteThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Andrew Morton

External


Since: Feb 02, 2007
Posts: 2642



(Msg. 3) Posted: Wed Jul 18, 2007 10:10 pm
Post subject: Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Sun, 15 Jul 2007 15:13:13 +0800
"Huang, Ying" <ying.huang.DeleteThis@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?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.DeleteThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
david

External


Since: May 03, 2007
Posts: 254



(Msg. 4) Posted: Thu Jul 19, 2007 12:40 am
Post subject: Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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 DeleteThis @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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo DeleteThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Huang, Ying

External


Since: Jun 08, 2007
Posts: 58



(Msg. 5) Posted: Thu Jul 19, 2007 3:50 am
Post subject: Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.TakeThisOut@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Rafael J. Wysocki

External


Since: Aug 02, 2005
Posts: 1886



(Msg. 6) Posted: Thu Jul 19, 2007 6:10 am
Post subject: Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo DeleteThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Pavel Machek

External


Since: Aug 02, 2005
Posts: 1024



(Msg. 7) Posted: Tue Jul 31, 2007 6:20 am
Post subject: Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.DeleteThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Huang, Ying

External


Since: Jun 08, 2007
Posts: 58



(Msg. 8) Posted: Tue Jul 31, 2007 6:30 am
Post subject: Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo DeleteThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Eric W. Biederman

External


Since: Nov 04, 2006
Posts: 800



(Msg. 9) Posted: Tue Jul 31, 2007 8:00 am
Post subject: Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Huang, Ying" <ying.huang.TakeThisOut@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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.TakeThisOut@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Pavel Machek

External


Since: Aug 02, 2005
Posts: 1024



(Msg. 10) Posted: Tue Jul 31, 2007 8:10 am
Post subject: Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.TakeThisOut@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Pavel Machek

External


Since: Aug 02, 2005
Posts: 1024



(Msg. 11) Posted: Tue Jul 31, 2007 8:20 am
Post subject: Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo RemoveThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Pavel Machek

External


Since: Aug 02, 2005
Posts: 1024



(Msg. 12) Posted: Tue Jul 31, 2007 8:20 am
Post subject: Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo RemoveThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Huang, Ying

External


Since: Jun 08, 2007
Posts: 58



(Msg. 13) Posted: Tue Jul 31, 2007 10:20 pm
Post subject: Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Tue, 2007-07-31 at 04:52 -0600, Eric W. Biederman wrote:
> "Huang, Ying" <ying.huang.TakeThisOut@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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.TakeThisOut@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Huang, Ying

External


Since: Jun 08, 2007
Posts: 58



(Msg. 14) Posted: Tue Jul 31, 2007 10:40 pm
Post subject: Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo RemoveThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Pavel Machek

External


Since: Aug 02, 2005
Posts: 1024



(Msg. 15) Posted: Sun Aug 05, 2007 2:47 pm
Post subject: Re: [PATH 0/1] Kexec jump - v2 - the first step to kexec based hibernation [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.RemoveThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Display posts from previous:   
Related Topics:
HowTo crashkernel hibernation (was: [PATH 0/1] Kexec jump .. - Pavel Machek wrote: > > 3. Boot kernel compiled for normal usage, the reserved crash kernel > > memory regi...

[PATCH 0/2] Kexec jump: The first step to kexec base hiber.. - Kexec base hibernation has some potential advantages over uswsusp and suspend2. Some most obvious advantages are: 1...

[PATH 1/1] Kexec jump - v2 - kexec jump - This patch implement the functionality of jumping from kexeced kernel to original kernel. A new reboot command named..

[PATCH 2/2] Kexec jump: Kexec jump - This patch provide the kexec based implementation of hibernation image operation. Now, only jumping between original..

[PATCH 1/2] Kexec jump: Hibernation image operations - This patch make it possible to have multiple implementations of hibernation image operations such as write, read, check...

kexec and aacraid broken - latest tree, can not use kexec to load 2.6.22-rc3 at least. got: AAC0: adapter kernel panic'd fffffffd AAC0: adapter....
       Soft32 Home -> Linux -> Kernel All times are: Pacific Time (US & Canada) (change)
Goto page 1, 2
Page 1 of 2

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Categories:
 Windows
  Linux
 Mac
 PDA


[ Contact us | Terms of Service/Privacy Policy ]