Skip to contentSkip to conversation

kexec jump -v11: kexec jump

PATCH In review Huang, Ying 2 participants 9 messages Jun 10, 2008 – Jun 16, 2008

Subsystems (8)
x86 PowerPC SuperH Suspend to RAM +4 more subsystems
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 kexec jump -v11: kexec jump

This patch provides an enhancement to kexec/kdump. It implements the following features:

- Backup/restore memory used by the original kernel before/after kexec.

- Save/restore CPU state before/after kexec.

The features of this patch can be used as a general method to call program in physical mode (paging turning off). This can be used to call BIOS code under Linux.

kexec-tools needs to be patched to support kexec jump. The patches and the precompiled kexec can be download from the following URL:

source: http://khibernation.sourceforge.net/download/release_v10/kexec-tools/kexec-tools-src_git_kh10.tar.bz2
patches: http://khibernation.sourceforge.net/download/release_v10/kexec-tools/kexec-tools-patches_git_kh10.tar.bz2
binary: http://khibernation.sourceforge.net/download/release_v10/kexec-tools/kexec_git_kh10

Usage example of calling some physical mode code and return:

1. Compile and install patched kernel with following options selected:

CONFIG_X86_32=y
CONFIG_KEXEC=y

2. Build patched kexec-tool or download the pre-built one.

3. Build some physical mode executable named such as "phy_mode"

4. Boot kernel compiled in step 1.

5. Load physical mode executable with /sbin/kexec. The shell command line can be as follow:

   /sbin/kexec --load-preserve-context --args-none phy_mode

6. Call physical mode executable with following shell command line:

/sbin/kexec -e

Implementation point:

To support jumping without reserving memory. One shadow backup page (source page) is allocated for each page used by kexeced code image (destination page). When do kexec_load, the image of kexeced code is loaded into source pages, and before executing, the destination pages and the source pages are swapped, so the contents of destination pages are backupped. Before jumping to the kexeced code image and after jumping back to the original kernel, the destination pages and the source pages are swapped too.

C ABI (calling convention) is used as communication protocol between kernel and called code.

A flag named KEXEC_PRESERVE_CONTEXT for sys_kexec_load is added to indicate that the loaded kernel image is used for jumping back.

ChangeLog:

v10:

- Device state save/restore related code is split into another patch because it depends on devices hibernation/restore callback and prone to be changed.

- C ABI (calling convention) is used as communication protocol between kernel and called code.

- Code cleanup: CPU state save/restore code goes in relocate_kernel().

v9:

- pm_mutex is locked during kexec jump to avoid potential conflict between kexec jump and suspend/resume/hibernation.

- Split /dev/oldmem writing and kimagecore patch out, keep only the core function.

v8:

- Split kexec jump patchset from kexec based hibernation patchset.

- Merge various KEXEC_PRESERVE_* flags into one KEXEC_PRESERVE_CONTEXT because there is no need for such subtle control.

- Delete variable argument based "kernel to kernel" communication mechanism from basic kexec jump patchset.

v7:

- Refactor kexec jump to be a command driven programming model.

- Use kexec_lock to do synchronization.

v6:

- Refactor kexec jump to be a general facility to call real mode code.

v5:

- A flag (KEXEC_JUMP_BACK) is added to indicate the loaded kernel image is used for jumping back. The reboot command for jumping back is removed. This interface is more stable (proposed by Eric Biederman).

- NX bit handling support for kexec is added.

- Merge machine_kexec and machine_kexec_jump, remove NO_RET attribute from machine_kexec.

- Passing jump back entry to kexeced kernel via kernel command line (parsed by user space tool via /proc/cmdline instead of kernel). Original corresponding boot parameter and sysfs code is removed.

v4:

- Two reboot command are merged back to one because the underlying implementation is same.

- Jumping without reserving memory is implemented. As a side effect, two direction jumping is implemented.

- A jump back protocol is defined and documented. The original kernel and kexeced kernel are more independent from each other.

- The CPU state save/restore code are merged into relocate_kernel.S.

v3:

- The reboot command LINUX_REBOOT_CMD_KJUMP is split into to two reboot command to reflect the different function.

- Document is added for added kernel parameters.

- /sys/kernel/kexec_jump_buf_pfn is made writable, it is used for memory image restoring.

- Console restoring after jumping back is implemented.

v2:

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

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

Now, only the i386 architecture is supported. The patchset is based on Linux kernel 2.6.26-rc5-mm1, and has been tested on IBM T42.

---
 arch/powerpc/kernel/machine_kexec.c  |    2 
 arch/ppc/kernel/machine_kexec.c      |    2 
 arch/sh/kernel/machine_kexec.c       |    2 
 arch/x86/kernel/machine_kexec_32.c   |   27 ++++-
 arch/x86/kernel/machine_kexec_64.c   |    2 
 arch/x86/kernel/relocate_kernel_32.S |  174 ++++++++++++++++++++++++++++++-----
 include/asm-x86/kexec.h              |   18 ++-
 include/linux/kexec.h                |   14 ++
 kernel/kexec.c                       |   27 +++++
 kernel/power/Kconfig                 |    2 
 kernel/sys.c                         |   35 ++++---
 11 files changed, 245 insertions(+), 60 deletions(-)
arch/x86/kernel/machine_kexec_32.c +21 -6
@@ -22,6 +22,7 @@
 #include <asm/cpufeature.h>
 #include <asm/desc.h>
 #include <asm/system.h>
+#include <asm/cacheflush.h>
 
 #define PAGE_ALIGNED __attribute__ ((__aligned__(PAGE_SIZE)))
 static u32 kexec_pgd[1024] PAGE_ALIGNED;
@@ -85,10 +86,12 @@ static void load_segments(void)
  * reboot code buffer to allow us to avoid allocations
  * later.
  *
- * Currently nothing.
+ * Make control page executable.
  */
 int machine_kexec_prepare(struct kimage *image)
 {
+	if (nx_enabled)
+		set_pages_x(image->control_code_page, 1);
 	return 0;
 }
 
@@ -98,16 +101,24 @@ int machine_kexec_prepare(struct kimage 
  */
 void machine_kexec_cleanup(struct kimage *image)
 {
+	if (nx_enabled)
+		set_pages_nx(image->control_code_page, 1);
 }
 
 /*
  * Do not allocate memory (or fail in any way) in machine_kexec().
  * We are past the point of no return, committed to rebooting now.
  */
-NORET_TYPE void machine_kexec(struct kimage *image)
+void machine_kexec(struct kimage *image)
 {
 	unsigned long page_list[PAGES_NR];
 	void *control_page;
+	asmlinkage unsigned long
+		(*relocate_kernel_ptr)(unsigned long indirection_page,
+				       unsigned long control_page,
+				       unsigned long start_address,
+				       unsigned int has_pae,
+				       unsigned int preserve_context);
 
 	tracer_disable();
 
@@ -115,10 +126,11 @@ NORET_TYPE void machine_kexec(struct kim
 	local_irq_disable();
 
 	control_page = page_address(image->control_code_page);
-	memcpy(control_page, relocate_kernel, PAGE_SIZE);
+	memcpy(control_page, relocate_kernel, PAGE_SIZE/2);
 
+	relocate_kernel_ptr = control_page;
 	page_list[PA_CONTROL_PAGE] = __pa(control_page);
-	page_list[VA_CONTROL_PAGE] = (unsigned long)relocate_kernel;
+	page_list[VA_CONTROL_PAGE] = (unsigned long)control_page;
 	page_list[PA_PGD] = __pa(kexec_pgd);
 	page_list[VA_PGD] = (unsigned long)kexec_pgd;
 #ifdef CONFIG_X86_PAE
@@ -131,6 +143,7 @@ NORET_TYPE void machine_kexec(struct kim
 	page_list[VA_PTE_0] = (unsigned long)kexec_pte0;
 	page_list[PA_PTE_1] = __pa(kexec_pte1);
 	page_list[VA_PTE_1] = (unsigned long)kexec_pte1;
+	page_list[PA_SWAP_PAGE] = (page_to_pfn(image->swap_page) << PAGE_SHIFT);
 
 	/* The segment registers are funny things, they have both a
 	 * visible and an invisible part.  Whenever the visible part is
@@ -149,8 +162,10 @@ NORET_TYPE void machine_kexec(struct kim
 	set_idt(phys_to_virt(0),0);
 
 	/* now call it */
-	relocate_kernel((unsigned long)image->head, (unsigned long)page_list,
-			image->start, cpu_has_pae);
+	image->start = relocate_kernel_ptr((unsigned long)image->head,
+					   (unsigned long)page_list,
+					   image->start, cpu_has_pae,
+					   image->preserve_context);
 }
 
 void arch_crash_save_vmcoreinfo(void)
include/linux/kexec.h +10 -4
@@ -83,6 +83,7 @@ struct kimage {
 
 	unsigned long start;
 	struct page *control_code_page;
+	struct page *swap_page;
 
 	unsigned long nr_segments;
 	struct kexec_segment segment[KEXEC_SEGMENT_MAX];
@@ -98,18 +99,20 @@ struct kimage {
 	unsigned int type : 1;
 #define KEXEC_TYPE_DEFAULT 0
 #define KEXEC_TYPE_CRASH   1
+	unsigned int preserve_context : 1;
 };
 
 
 
 /* kexec interface functions */
-extern NORET_TYPE void machine_kexec(struct kimage *image) ATTRIB_NORET;
+extern void machine_kexec(struct kimage *image);
 extern int machine_kexec_prepare(struct kimage *image);
 extern void machine_kexec_cleanup(struct kimage *image);
 extern asmlinkage long sys_kexec_load(unsigned long entry,
 					unsigned long nr_segments,
 					struct kexec_segment __user *segments,
 					unsigned long flags);
+extern int kexec_jump(struct kimage *image);
 #ifdef CONFIG_COMPAT
 extern asmlinkage long compat_sys_kexec_load(unsigned long entry,
 				unsigned long nr_segments,
@@ -151,13 +154,15 @@ unsigned long paddr_vmcoreinfo_note(void
 
 extern struct kimage *kexec_image;
 extern struct kimage *kexec_crash_image;
+extern int kexec_lock;
 
 #ifndef kexec_flush_icache_page
 #define kexec_flush_icache_page(page)
 #endif
 
-#define KEXEC_ON_CRASH  0x00000001
-#define KEXEC_ARCH_MASK 0xffff0000
+#define KEXEC_ON_CRASH		0x00000001
+#define KEXEC_PRESERVE_CONTEXT	0x00000002
+#define KEXEC_ARCH_MASK		0xffff0000
 
 /* These values match the ELF architecture values.
  * Unless there is a good reason that should continue to be the case.
@@ -174,7 +179,8 @@ extern struct kimage *kexec_crash_image;
 #define KEXEC_ARCH_MIPS_LE (10 << 16)
 #define KEXEC_ARCH_MIPS    ( 8 << 16)
 
-#define KEXEC_FLAGS    (KEXEC_ON_CRASH)  /* List of defined/legal kexec flags */
+/* List of defined/legal kexec flags */
+#define KEXEC_FLAGS    (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT)
 
 #define VMCOREINFO_BYTES           (4096)
 #define VMCOREINFO_NOTE_NAME       "VMCOREINFO"
kernel/kexec.c +26 -1
@@ -24,6 +24,7 @@
 #include <linux/utsrelease.h>
 #include <linux/utsname.h>
 #include <linux/numa.h>
+#include <linux/suspend.h>
 
 #include <asm/page.h>
 #include <asm/uaccess.h>
@@ -242,6 +243,12 @@ static int kimage_normal_alloc(struct ki
 		goto out;
 	}
 
+	image->swap_page = kimage_alloc_control_pages(image, 0);
+	if (!image->swap_page) {
+		printk(KERN_ERR "Could not allocate swap buffer\n");
+		goto out;
+	}
+
 	result = 0;
  out:
 	if (result == 0)
@@ -919,7 +926,7 @@ struct kimage *kexec_crash_image;
  * Nothing can wait so this mutex is safe to use
  * in interrupt context :)
  */
-static int kexec_lock;
+int kexec_lock;
 
 asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments,
 				struct kexec_segment __user *segments,
@@ -988,6 +995,8 @@ asmlinkage long sys_kexec_load(unsigned 
 		if (result)
 			goto out;
 
+		if (flags & KEXEC_PRESERVE_CONTEXT)
+			image->preserve_context = 1;
 		result = machine_kexec_prepare(image);
 		if (result)
 			goto out;
@@ -1415,3 +1424,19 @@ static int __init crash_save_vmcoreinfo_
 }
 
 module_init(crash_save_vmcoreinfo_init)
+
+int kexec_jump(struct kimage *image)
+{
+	if (image->preserve_context) {
+		local_irq_disable();
+		save_processor_state();
+	}
+
+	machine_kexec(image);
+
+	if (image->preserve_context) {
+		restore_processor_state();
+		local_irq_enable();
+	}
+	return 0;
+}
kernel/sys.c +23 -12
@@ -307,18 +307,26 @@ EXPORT_SYMBOL_GPL(kernel_restart);
  *	Move into place and start executing a preloaded standalone
  *	executable.  If nothing was preloaded return an error.
  */
-static void kernel_kexec(void)
+static int kernel_kexec(void)
 {
+	int ret = -ENOSYS;
 #ifdef CONFIG_KEXEC
-	struct kimage *image;
-	image = xchg(&kexec_image, NULL);
-	if (!image)
-		return;
-	kernel_restart_prepare(NULL);
-	printk(KERN_EMERG "Starting new kernel\n");
-	machine_shutdown();
-	machine_kexec(image);
+	if (xchg(&kexec_lock, 1))
+		return -EBUSY;
+	if (!kexec_image) {
+		ret = -EINVAL;
+		goto unlock;
+	}
+	if (!kexec_image->preserve_context) {
+		kernel_restart_prepare(NULL);
+		printk(KERN_EMERG "Starting new kernel\n");
+		machine_shutdown();
+	}
+	kexec_jump(kexec_image);
+unlock:
+	xchg(&kexec_lock, 0);
 #endif
+	return ret;
 }
 
 static void kernel_shutdown_prepare(enum system_states state)
@@ -426,9 +434,12 @@ asmlinkage long sys_reboot(int magic1, i
 		break;
 
 	case LINUX_REBOOT_CMD_KEXEC:
-		kernel_kexec();
-		unlock_kernel();
-		return -EINVAL;
+		{
+			int ret;
+			ret = kernel_kexec();
+			unlock_kernel();
+			return ret;
+		}
 
 #ifdef CONFIG_HIBERNATION
 	case LINUX_REBOOT_CMD_SW_SUSPEND:
kernel/power/Kconfig +1 -1
@@ -82,7 +82,7 @@ config PM_SLEEP_SMP
 
 config PM_SLEEP
 	bool
-	depends on SUSPEND || HIBERNATION
+	depends on SUSPEND || HIBERNATION || KEXEC
 	default y
 
 config SUSPEND
arch/x86/kernel/relocate_kernel_32.S +150 -24

211 lines not on this page · raw message

arch/ppc/kernel/machine_kexec.c +1 -1
@@ -66,7 +66,7 @@ void machine_kexec_cleanup(struct kimage
  * Do not allocate memory (or fail in any way) in machine_kexec().
  * We are past the point of no return, committed to rebooting now.
  */
-NORET_TYPE void machine_kexec(struct kimage *image)
+void machine_kexec(struct kimage *image)
 {
 	if (ppc_md.machine_kexec)
 		ppc_md.machine_kexec(image);
arch/x86/kernel/machine_kexec_64.c +1 -1
@@ -181,7 +181,7 @@ void machine_kexec_cleanup(struct kimage
  * Do not allocate memory (or fail in any way) in machine_kexec().
  * We are past the point of no return, committed to rebooting now.
  */
-NORET_TYPE void machine_kexec(struct kimage *image)
+void machine_kexec(struct kimage *image)
 {
 	unsigned long page_list[PAGES_NR];
 	void *control_page;
arch/sh/kernel/machine_kexec.c +1 -1
@@ -70,7 +70,7 @@ static void kexec_info(struct kimage *im
  * Do not allocate memory (or fail in any way) in machine_kexec().
  * We are past the point of no return, committed to rebooting now.
  */
-NORET_TYPE void machine_kexec(struct kimage *image)
+void machine_kexec(struct kimage *image)
 {
 
 	unsigned long page_list;
arch/powerpc/kernel/machine_kexec.c +1 -1
@@ -48,7 +48,7 @@ void machine_kexec_cleanup(struct kimage
  * Do not allocate memory (or fail in any way) in machine_kexec().
  * We are past the point of no return, committed to rebooting now.
  */
-NORET_TYPE void machine_kexec(struct kimage *image)
+void machine_kexec(struct kimage *image)
 {
 	if (ppc_md.machine_kexec)
 		ppc_md.machine_kexec(image);
include/asm-x86/kexec.h +10 -8
@@ -10,14 +10,15 @@
 # define VA_PTE_0		5
 # define PA_PTE_1		6
 # define VA_PTE_1		7
+# define PA_SWAP_PAGE		8
 # ifdef CONFIG_X86_PAE
-#  define PA_PMD_0		8
-#  define VA_PMD_0		9
-#  define PA_PMD_1		10
-#  define VA_PMD_1		11
-#  define PAGES_NR		12
+#  define PA_PMD_0		9
+#  define VA_PMD_0		10
+#  define PA_PMD_1		11
+#  define VA_PMD_1		12
+#  define PAGES_NR		13
 # else
-#  define PAGES_NR		8
+#  define PAGES_NR		9
 # endif
 #else
 # define PA_CONTROL_PAGE	0
@@ -152,11 +153,12 @@ static inline void crash_setup_regs(stru
 }
 
 #ifdef CONFIG_X86_32
-asmlinkage NORET_TYPE void
+asmlinkage unsigned long
 relocate_kernel(unsigned long indirection_page,
 		unsigned long control_page,
 		unsigned long start_address,
-		unsigned int has_pae) ATTRIB_NORET;
+		unsigned int has_pae,
+		unsigned int preserve_context);
 #else
 NORET_TYPE void
 relocate_kernel(unsigned long indirection_page,

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

#1 lore raw
Quoted 13 lines · Ying

This patch provides an enhancement to kexec/kdump. It implements the following features:

- Backup/restore memory used by the original kernel before/after kexec.

- Save/restore CPU state before/after kexec.

The features of this patch can be used as a general method to call program in physical mode (paging turning off). This can be used to call BIOS code under Linux.

Hi Huang,

I was testing these patches and I get following error on my machine.

Freezing remaining freezable tasks ... (elapsed 0.00 seconds) done. Suspending console(s) (use no_console_suspend to debug)
PM: Device i8042 failed to freeze: error -22
Restarting tasks ... done.

Any idea why keyboard controller would not freeze?

Thanks
Vivek

#2 lore raw
In reply to Huang, Ying
Quoted 13 lines · Ying

This patch provides an enhancement to kexec/kdump. It implements the following features:

- Backup/restore memory used by the original kernel before/after kexec.

- Save/restore CPU state before/after kexec.

The features of this patch can be used as a general method to call program in physical mode (paging turning off). This can be used to call BIOS code under Linux.

Hi Huang,

I was testing these patches and I get following error on my machine.

Freezing remaining freezable tasks ... (elapsed 0.00 seconds) done. Suspending console(s) (use no_console_suspend to debug)
PM: Device i8042 failed to freeze: error -22
Restarting tasks ... done.

Any idea why keyboard controller would not freeze?

Thanks
Vivek

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

#3 lore raw
Quoted 17 lines · Vivek Goyal
Quoted 13 lines · Ying

This patch provides an enhancement to kexec/kdump. It implements the following features:

- Backup/restore memory used by the original kernel before/after kexec.

- Save/restore CPU state before/after kexec.

The features of this patch can be used as a general method to call program in physical mode (paging turning off). This can be used to call BIOS code under Linux.

Hi Huang,

Quoted 8 lines

I was testing these patches and I get following error on my machine.

Freezing remaining freezable tasks ... (elapsed 0.00 seconds) done. Suspending console(s) (use no_console_suspend to debug)
PM: Device i8042 failed to freeze: error -22
Restarting tasks ... done.

Any idea why keyboard controller would not freeze?

Which kernel version do you use?

Does original hibernation work? It can be setup easily. Just add following parameters to kernel command line:

resume=/dev/<xxx>

Where <xxx> is the swap partition.

And execute following command:

echo reboot > /sys/power/disk
echo disk > /sys/power/state

Best Regards,
Huang Ying

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

#4 lore raw
Quoted 20 lines · Ying
Quoted 19 lines · Vivek Goyal
Quoted 13 lines · Ying

This patch provides an enhancement to kexec/kdump. It implements the following features:

- Backup/restore memory used by the original kernel before/after kexec.

- Save/restore CPU state before/after kexec.

The features of this patch can be used as a general method to call program in physical mode (paging turning off). This can be used to call BIOS code under Linux.

Hi Huang,

I was testing these patches and I get following error on my machine.

Quoted 9 lines
Quoted 6 lines

Freezing remaining freezable tasks ... (elapsed 0.00 seconds) done. Suspending console(s) (use no_console_suspend to debug)
PM: Device i8042 failed to freeze: error -22
Restarting tasks ... done.

Any idea why keyboard controller would not freeze?

Which kernel version do you use?

2.6.26-rc5-mm1.

Quoted 3 lines

Does original hibernation work? It can be setup easily. Just add following parameters to kernel command line:

Ok, I found that in my config CONFIG_HIBERNATION was not enabled. After enabling CONFIG_HIBERNATION, both suspend to disk and kjump started working.

Does that mean there is some dependency on code under CONFIG_HIBERNATION. If yes, I think this dependency should be resolved during compile time. May be addtional config option (CONFIG_KEXEC_JUMP), which also selects the CONFIG_HIBERNATION automatically etc...

Thanks
Vivek

#5 lore raw
In reply to Huang, Ying
Quoted 20 lines · Ying
Quoted 19 lines · Vivek Goyal
Quoted 13 lines · Ying

This patch provides an enhancement to kexec/kdump. It implements the following features:

- Backup/restore memory used by the original kernel before/after kexec.

- Save/restore CPU state before/after kexec.

The features of this patch can be used as a general method to call program in physical mode (paging turning off). This can be used to call BIOS code under Linux.

Hi Huang,

I was testing these patches and I get following error on my machine.

Quoted 9 lines
Quoted 6 lines

Freezing remaining freezable tasks ... (elapsed 0.00 seconds) done. Suspending console(s) (use no_console_suspend to debug)
PM: Device i8042 failed to freeze: error -22
Restarting tasks ... done.

Any idea why keyboard controller would not freeze?

Which kernel version do you use?

2.6.26-rc5-mm1.

Quoted 3 lines

Does original hibernation work? It can be setup easily. Just add following parameters to kernel command line:

Ok, I found that in my config CONFIG_HIBERNATION was not enabled. After enabling CONFIG_HIBERNATION, both suspend to disk and kjump started working.

Does that mean there is some dependency on code under CONFIG_HIBERNATION. If yes, I think this dependency should be resolved during compile time. May be addtional config option (CONFIG_KEXEC_JUMP), which also selects the CONFIG_HIBERNATION automatically etc...

Thanks
Vivek

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

#6 lore raw

On Fri, 2008-06-13 at 14:00 -0400, Vivek Goyal wrote:
[...]

Quoted 8 lines

Ok, I found that in my config CONFIG_HIBERNATION was not enabled. After enabling CONFIG_HIBERNATION, both suspend to disk and kjump started working.

Does that mean there is some dependency on code under CONFIG_HIBERNATION. If yes, I think this dependency should be resolved during compile time. May be addtional config option (CONFIG_KEXEC_JUMP), which also selects the CONFIG_HIBERNATION automatically etc...

Yes. kexec jump need to put devices into quiescent state and save devices state into memory, which is implemented by calling hibernation
function: device_suspend(PMSG_FREEZE), whose implementation depends on CONFIG_HIBERNATION.

So, I will add CONFIG_KEXEC_JUMP and select CONFIG_HIBERNATION automatically.

Best Regards,
Huang Ying

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

#7 lore raw
In reply to Vivek Goyal

On Fri, 2008-06-13 at 14:00 -0400, Vivek Goyal wrote:
[...]

Quoted 8 lines

Ok, I found that in my config CONFIG_HIBERNATION was not enabled. After enabling CONFIG_HIBERNATION, both suspend to disk and kjump started working.

Does that mean there is some dependency on code under CONFIG_HIBERNATION. If yes, I think this dependency should be resolved during compile time. May be addtional config option (CONFIG_KEXEC_JUMP), which also selects the CONFIG_HIBERNATION automatically etc...

Yes. kexec jump need to put devices into quiescent state and save devices state into memory, which is implemented by calling hibernation
function: device_suspend(PMSG_FREEZE), whose implementation depends on CONFIG_HIBERNATION.

So, I will add CONFIG_KEXEC_JUMP and select CONFIG_HIBERNATION automatically.

Best Regards,
Huang Ying

#8 lore raw
In reply to Vivek Goyal
Quoted 17 lines · Vivek Goyal
Quoted 13 lines · Ying

This patch provides an enhancement to kexec/kdump. It implements the following features:

- Backup/restore memory used by the original kernel before/after kexec.

- Save/restore CPU state before/after kexec.

The features of this patch can be used as a general method to call program in physical mode (paging turning off). This can be used to call BIOS code under Linux.

Hi Huang,

Quoted 8 lines

I was testing these patches and I get following error on my machine.

Freezing remaining freezable tasks ... (elapsed 0.00 seconds) done. Suspending console(s) (use no_console_suspend to debug)
PM: Device i8042 failed to freeze: error -22
Restarting tasks ... done.

Any idea why keyboard controller would not freeze?

Which kernel version do you use?

Does original hibernation work? It can be setup easily. Just add following parameters to kernel command line:

resume=/dev/<xxx>

Where <xxx> is the swap partition.

And execute following command:

echo reboot > /sys/power/disk
echo disk > /sys/power/state

Best Regards,
Huang Ying