Skip to contentSkip to conversation

Kexec / Kdump: Release 20061130 (xen-unstable-12621)

PATCH In review Magnus Damm 2 participants 6 messages Nov 30, 2006

lore
Share & tools
lore
#0 lore raw

cover Kexec / Kdump: Release 20061130 (xen-unstable-12621)

[PATCH 00/04] Kexec / Kdump: Release 20061130 (xen-unstable-12621)

Hi again,

Here comes yet another release of the Kexec / Kdump patches for x86 Xen. Many thanks to Ian Campbell for reviewing the previous version of the patch set, I hopefully managed to fix all issues reported. I've spent the day so far up-porting and testing as you can see below. The results are all good, and I think the code is in a good condition.

If there is anything I can do to help out with the merge don't hesitate to ask!

/ magnus

Test Results:
Kexec Kexec Kexec Kexec Kdump
Hardware Xen -> Xen -> bzImage -> Xen -> Xen ->
Arch Platform Xen bzImage Xen vmlinux vmlinux

i386      A         PASS       PASS       PASS       PASS       PASS
i386      B (VMX)   PASS       PASS       PASS       PASS       PASS
i386      C (SVM)   PASS       PASS       PASS       PASS       PASS
i386/PAE  A         PASS       PASS       PASS       PASS       PASS
i386/PAE  B (VMX)   PASS       PASS       PASS       PASS       PASS
i386/PAE  C (SVM)   PASS       PASS       PASS       PASS       PASS
x86_64    D         PASS       PASS       PASS       PASS       PASS
x86_64    B (VMX)   PASS       PASS       PASS       PASS       PASS
x86_64    C (SVM)   PASS       PASS       PASS       PASS       PASS

Hardware Platforms:

A: i386 - VA Linux 1220, 2 x Pentium III 866 Mhz, 2 GB
B: Intel VT - Shuttle XPC SD36G5, 1 x Pentium D 930, 1 GB
C: AMD VT - Shuttle XPC SK22G2, 1 x Athlon64 x2 3800+, 1 GB
D: x86_64 - TYAN Transport GX28 B2881, 2 x Opteron 244 1.8 GHz, 2 GB

Linux kernels:

Upstream linux-2.6.18 is used in the bzImage/vmlinux tests above.

kexec-tools:

The kexec-tools-testing git tree is Xen aware. You can find this tree among the other ones on kernel.org. The following version is known to work for both i386 and x86_64: b5c22baac1a632363a91da666886bb0ae285bd67.

Changes since 20061122:

20061130 - Release 20061130 for xen-unstable-12621

- Fixed vanilla code build breakage:
- Removed kexec-xen.h
- Removed linux-2.6.16.29-crash-xen-i386/x86_64.patch
- Code now present in linux-2.6.19-rc1-kexec-xen-i386/x86_64.patch

- Changed ELF note handling code:
- ELF note types now defined in xen/include/public/elfnote.h
- "Xen", XEN_ELFNOTE_CRASH_INFO for system wide information
- Contains the old "XEN CORE" information plus taint variable
- "Xen", XEN_ELFNOTE_CRASH_REGS for per-cpu system registers
- Contains CR0, CR2, CR3 and CR4

- Reworked physical cpu note code:
- Use num_present_cpus() instead of NR_CPUS
- Removed heap clearing code. =)

- Up-ported code to 2.6.16.33

#1 lore raw

PATCH 1/4 Kexec / Kdump: Generic code

[PATCH 01/04] Kexec / Kdump: Generic code

This patch implements the generic portion of the Kexec / Kdump port to Xen.

---

Applies on top of xen-unstable-12621.

 linux-2.6-xen-sparse/drivers/xen/core/Makefile        |    1
 linux-2.6-xen-sparse/drivers/xen/core/machine_kexec.c |  170 +++++++
 patches/linux-2.6.16.33/kexec-generic.patch           |  228 ++++++++++
 patches/linux-2.6.16.33/series                        |    1
 xen/arch/ia64/xen/Makefile                            |    2
 xen/arch/ia64/xen/crash.c                             |   19
 xen/arch/ia64/xen/machine_kexec.c                     |   34 +
 xen/arch/powerpc/Makefile                             |    2
 xen/arch/powerpc/crash.c                              |   19
 xen/arch/powerpc/machine_kexec.c                      |   34 +
 xen/arch/x86/Makefile                                 |    2
 xen/arch/x86/crash.c                                  |   19
 xen/arch/x86/machine_kexec.c                          |   34 +
 xen/common/Makefile                                   |    1
 xen/common/kexec.c                                    |  370 +++++++++++++++++
 xen/common/page_alloc.c                               |   33 +
 xen/drivers/char/console.c                            |    3
 xen/include/asm-ia64/elf.h                            |   30 +
 xen/include/asm-ia64/kexec.h                          |   25 +
 xen/include/asm-powerpc/elf.h                         |   30 +
 xen/include/asm-powerpc/kexec.h                       |   25 +
 xen/include/asm-x86/elf.h                             |   30 +
 xen/include/asm-x86/kexec.h                           |   24 +
 xen/include/public/elfnote.h                          |   19
 xen/include/public/kexec.h                            |  131 ++++++
 xen/include/xen/elf.h                                 |   16
 xen/include/xen/elfcore.h                             |  137 ++++++
 xen/include/xen/hypercall.h                           |    6
 xen/include/xen/kexec.h                               |   43 +
 xen/include/xen/mm.h                                  |    1
 30 files changed, 1466 insertions(+), 23 deletions(-)
linux-2.6-xen-sparse/drivers/xen/core/Makefile +1 -0
@@ -11,3 +11,4 @@ obj-$(CONFIG_XEN_SYSFS)		+= xen_sysfs.o
 obj-$(CONFIG_XEN_SKBUFF)	+= skbuff.o
 obj-$(CONFIG_XEN_REBOOT)	+= reboot.o machine_reboot.o
 obj-$(CONFIG_XEN_SMPBOOT)	+= smpboot.o
+obj-$(CONFIG_KEXEC)		+= machine_kexec.o
linux-2.6-xen-sparse/drivers/xen/core/machine_kexec.c new file +170 -0

170 lines not on this page · raw message

patches/linux-2.6.16.33/kexec-generic.patch new file +228 -0

228 lines not on this page · raw message

patches/linux-2.6.16.33/series +1 -0
@@ -1,3 +1,4 @@
+kexec-generic.patch
 blktap-aio-16_03_06.patch
 device_bind.patch
 fix-hz-suspend.patch
xen/arch/ia64/xen/Makefile +2 -0
@@ -1,3 +1,5 @@
+obj-y += machine_kexec.o
+obj-y += crash.o
 obj-y += acpi.o
 obj-y += dom0_ops.o
 obj-y += domain.o
xen/arch/ia64/xen/crash.c new file +19 -0
@@ -0,0 +1,19 @@
+#include <xen/lib.h>       /* for printk() used in stub */
+#include <xen/types.h>
+#include <public/kexec.h>
+
+void machine_crash_shutdown(void)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
+
xen/arch/ia64/xen/machine_kexec.c new file +34 -0
@@ -0,0 +1,34 @@
+#include <xen/lib.h>       /* for printk() used in stubs */
+#include <xen/types.h>
+#include <public/kexec.h>
+
+int machine_kexec_load(int type, int slot, xen_kexec_image_t *image)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+    return -1;
+}
+
+void machine_kexec_unload(int type, int slot, xen_kexec_image_t *image)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+}
+
+void machine_kexec(xen_kexec_image_t *image)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+}
+
+void machine_shutdown(xen_kexec_image_t *image)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
xen/arch/powerpc/Makefile +2 -0
@@ -40,6 +40,8 @@ obj-y += smp-tbsync.o
 obj-y += sysctl.o
 obj-y += time.o
 obj-y += usercopy.o
+obj-y += machine_kexec.o
+obj-y += crash.o
 
 obj-$(debug) += 0opt.o
 obj-$(crash_debug) += gdbstub.o
xen/arch/powerpc/crash.c new file +19 -0
@@ -0,0 +1,19 @@
+#include <xen/lib.h>       /* for printk() used in stub */
+#include <xen/types.h>
+#include <public/kexec.h>
+
+void machine_crash_shutdown(void)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
+
xen/arch/powerpc/machine_kexec.c new file +34 -0
@@ -0,0 +1,34 @@
+#include <xen/lib.h>       /* for printk() used in stubs */
+#include <xen/types.h>
+#include <public/kexec.h>
+
+int machine_kexec_load(int type, int slot, xen_kexec_image_t *image)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+    return -1;
+}
+
+void machine_kexec_unload(int type, int slot, xen_kexec_image_t *image)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+}
+
+void machine_kexec(xen_kexec_image_t *image)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+}
+
+void machine_shutdown(xen_kexec_image_t *image)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
xen/arch/x86/Makefile +2 -0
@@ -43,6 +43,8 @@ obj-y += trampoline.o
 obj-y += traps.o
 obj-y += usercopy.o
 obj-y += x86_emulate.o
+obj-y += machine_kexec.o
+obj-y += crash.o
 
 obj-$(crash_debug) += gdbstub.o
 
xen/arch/x86/crash.c new file +19 -0
@@ -0,0 +1,19 @@
+#include <xen/lib.h>       /* for printk() used in stub */
+#include <xen/types.h>
+#include <public/kexec.h>
+
+void machine_crash_shutdown(void)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
+
xen/arch/x86/machine_kexec.c new file +34 -0
@@ -0,0 +1,34 @@
+#include <xen/lib.h>       /* for printk() used in stubs */
+#include <xen/types.h>
+#include <public/kexec.h>
+
+int machine_kexec_load(int type, int slot, xen_kexec_image_t *image)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+    return -1;
+}
+
+void machine_kexec_unload(int type, int slot, xen_kexec_image_t *image)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+}
+
+void machine_kexec(xen_kexec_image_t *image)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+}
+
+void machine_shutdown(xen_kexec_image_t *image)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
xen/common/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-y += event_channel.o
 obj-y += grant_table.o
 obj-y += kernel.o
 obj-y += keyhandler.o
+obj-y += kexec.o
 obj-y += lib.o
 obj-y += memory.o
 obj-y += multicall.o
xen/common/kexec.c new file +370 -0

370 lines not on this page · raw message

xen/common/page_alloc.c +22 -11
@@ -237,24 +237,35 @@ void init_boot_pages(paddr_t ps, paddr_t
     }
 }
 
+unsigned long alloc_boot_pages_at(unsigned long nr_pfns, unsigned long pfn_at)
+{
+    unsigned long i;
+
+    for ( i = 0; i < nr_pfns; i++ )
+        if ( allocated_in_map(pfn_at + i) )
+             break;
+
+    if ( i == nr_pfns )
+    {
+        map_alloc(pfn_at, nr_pfns);
+        return pfn_at;
+    }
+
+    return 0;
+}
+
 unsigned long alloc_boot_pages(unsigned long nr_pfns, unsigned long pfn_align)
 {
-    unsigned long pg, i;
+    unsigned long pg, i = 0;
 
     for ( pg = 0; (pg + nr_pfns) < max_page; pg += pfn_align )
     {
-        for ( i = 0; i < nr_pfns; i++ )
-            if ( allocated_in_map(pg + i) )
-                 break;
-
-        if ( i == nr_pfns )
-        {
-            map_alloc(pg, nr_pfns);
-            return pg;
-        }
+        i = alloc_boot_pages_at(nr_pfns, pg);
+        if (i != 0)
+            break;
     }
 
-    return 0;
+    return i;
 }
 
 
xen/drivers/char/console.c +3 -0
@@ -27,6 +27,7 @@
 #include <xen/guest_access.h>
 #include <xen/shutdown.h>
 #include <xen/vga.h>
+#include <xen/kexec.h>
 #include <asm/current.h>
 #include <asm/debugger.h>
 #include <asm/io.h>
@@ -865,6 +866,8 @@ void panic(const char *fmt, ...)
 
     debugger_trap_immediate();
 
+    machine_crash_kexec();
+
     if ( opt_noreboot )
     {
         machine_halt();
xen/include/asm-ia64/elf.h new file +30 -0
@@ -0,0 +1,30 @@
+#ifndef __IA64_ELF_H__
+#define __IA64_ELF_H__
+
+#include <xen/lib.h>       /* for printk() used in stub */
+
+typedef struct {
+    unsigned long dummy;
+} ELF_Gregset;
+
+typedef struct {
+    unsigned long dummy;
+} crash_xen_core_t;
+
+extern inline void elf_core_save_regs(ELF_Gregset *core_regs, 
+                                      crash_xen_core_t *xen_core_regs)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+}
+
+#endif /* __IA64_ELF_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
xen/include/asm-ia64/kexec.h new file +25 -0
@@ -0,0 +1,25 @@
+#ifndef __IA64_KEXEC_H__
+#define __IA64_KEXEC_H__
+
+#include <xen/lib.h>       /* for printk() used in stub */
+#include <xen/types.h>
+#include <public/xen.h>
+#include <xen/kexec.h>
+
+static inline void machine_kexec(xen_kexec_image_t *image)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+}
+
+#endif /* __IA64_KEXEC_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
+
xen/include/asm-powerpc/elf.h new file +30 -0
@@ -0,0 +1,30 @@
+#ifndef _ASM_ELF_H__
+#define _ASM_ELF_H__
+
+#include <xen/lib.h>       /* for printk() used in stub */
+
+typedef struct {
+    unsigned long dummy;
+} ELF_Gregset;
+
+typedef struct {
+    unsigned long dummy;
+} crash_xen_core_t;
+
+extern inline void elf_core_save_regs(ELF_Gregset *core_regs, 
+                                      crash_xen_core_t *xen_core_regs)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+}
+
+#endif /* _ASM_ELF_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
xen/include/asm-powerpc/kexec.h new file +25 -0
@@ -0,0 +1,25 @@
+#ifndef _ASM_KEXEC_H__
+#define _ASM_KEXEC_H__
+
+#include <xen/lib.h>       /* for printk() used in stub */
+#include <xen/types.h>
+#include <public/xen.h>
+#include <xen/kexec.h>
+
+static inline void machine_kexec(xen_kexec_image_t *image)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+}
+
+#endif /* _ASM_KEXEC_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
+
xen/include/asm-x86/elf.h new file +30 -0
@@ -0,0 +1,30 @@
+#ifndef __X86_ELF_H__
+#define __X86_ELF_H__
+
+#include <xen/lib.h>       /* for printk() used in stub */
+
+typedef struct {
+    unsigned long dummy;
+} ELF_Gregset;
+
+typedef struct {
+    unsigned long dummy;
+} crash_xen_core_t;
+
+extern inline void elf_core_save_regs(ELF_Gregset *core_regs, 
+                                      crash_xen_core_t *xen_core_regs)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+}
+
+#endif /* __X86_ELF_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
xen/include/asm-x86/kexec.h new file +24 -0
@@ -0,0 +1,24 @@
+#ifndef __X86_KEXEC_H__
+#define __X86_KEXEC_H__
+
+#include <xen/lib.h>       /* for printk() used in stub */
+#include <xen/types.h>
+#include <public/xen.h>
+#include <xen/kexec.h>
+
+static inline void machine_kexec(xen_kexec_image_t *image)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+}
+
+#endif /* __X86_KEXEC_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
xen/include/public/elfnote.h +19 -0
@@ -147,6 +147,25 @@
  */
 #define XEN_ELFNOTE_HV_START_LOW  12
 
+/*
+ * System information exported through crash notes.
+ *
+ * The kexec / kdump code will create one XEN_ELFNOTE_CRASH_INFO 
+ * note in case of a system crash. This note will contain various
+ * information about the system, see xen/include/xen/elfcore.h.
+ */
+#define XEN_ELFNOTE_CRASH_INFO 0x1000001
+
+/*
+ * System registers exported through crash notes.
+ *
+ * The kexec / kdump code will create one XEN_ELFNOTE_CRASH_REGS 
+ * note per cpu in case of a system crash. This note is architecture
+ * specific and will contain registers not saved in the "CORE" note.
+ * See xen/include/xen/elfcore.h for more information.
+ */
+#define XEN_ELFNOTE_CRASH_REGS 0x1000002
+
 #endif /* __XEN_PUBLIC_ELFNOTE_H__ */
 
 /*
xen/include/public/kexec.h new file +131 -0

131 lines not on this page · raw message

xen/include/xen/elf.h +4 -12
@@ -452,18 +452,12 @@ unsigned int elf_hash(const unsigned cha
 /*
  * Note Definitions
  */
-typedef struct {
-	Elf32_Word namesz;
-	Elf32_Word descsz;
-	Elf32_Word type;
-} Elf32_Note;
 
 typedef struct {
-	Elf64_Half namesz;
-	Elf64_Half descsz;
-	Elf64_Half type;
-} Elf64_Note;
-
+	u32 namesz;
+	u32 descsz;
+	u32 type;
+} Elf_Note; /* same format for both 32-bit and 64-bit ELF */
 
 #if defined(ELFSIZE)
 #define CONCAT(x,y)	__CONCAT(x,y)
@@ -486,7 +480,6 @@ typedef struct {
 #define Elf_Addr	Elf32_Addr
 #define Elf_Off		Elf32_Off
 #define Elf_Nhdr	Elf32_Nhdr
-#define Elf_Note	Elf32_Note
 
 #define ELF_R_SYM	ELF32_R_SYM
 #define ELF_R_TYPE	ELF32_R_TYPE
@@ -511,7 +504,6 @@ typedef struct {
 #define Elf_Addr	Elf64_Addr
 #define Elf_Off		Elf64_Off
 #define Elf_Nhdr	Elf64_Nhdr
-#define Elf_Note	Elf64_Note
 
 #define ELF_R_SYM	ELF64_R_SYM
 #define ELF_R_TYPE	ELF64_R_TYPE
xen/include/xen/elfcore.h new file +137 -0

137 lines not on this page · raw message

xen/include/xen/hypercall.h +6 -0
@@ -102,4 +102,10 @@ do_hvm_op(
     unsigned long op,
     XEN_GUEST_HANDLE(void) arg);
 
+extern long
+do_kexec_op(
+    unsigned long op,
+    int arg1,
+    XEN_GUEST_HANDLE(void) arg);
+
 #endif /* __XEN_HYPERCALL_H__ */
xen/include/xen/kexec.h new file +43 -0

43 lines not on this page · raw message

xen/include/xen/mm.h +1 -0
@@ -40,6 +40,7 @@ struct page_info;
 paddr_t init_boot_allocator(paddr_t bitmap_start);
 void init_boot_pages(paddr_t ps, paddr_t pe);
 unsigned long alloc_boot_pages(unsigned long nr_pfns, unsigned long pfn_align);
+unsigned long alloc_boot_pages_at(unsigned long nr_pfns, unsigned long pfn_at);
 void end_boot_allocator(void);
 
 /* Generic allocator. These functions are *not* interrupt-safe. */
#2 lore raw

PATCH 2/4 Kexec / Kdump: Code shared between x86_32 and x86_64

In reply to Magnus Damm

[PATCH 02/04] Kexec / Kdump: Code shared between x86_32 and x86_64

This patch contains Kexec / Kdump code shared between x86_32 and x86_64.

---

Applies on top of xen-unstable-12621.

 patches/linux-2.6.16.33/git-2a...f7.patch | 62 +++++
 patches/linux-2.6.16.33/git-2e...11.patch | 93 ++++++++
 patches/linux-2.6.16.33/series            |  2
 xen/arch/x86/crash.c                      | 115 +++++++++-
 xen/arch/x86/machine_kexec.c              | 83 ++++++-
 xen/arch/x86/setup.c                      | 73 +++++-
 xen/arch/x86/traps.c                      |  2
 xen/include/asm-x86/elf.h                 | 18 -
 xen/include/asm-x86/fixmap.h              |  4
 xen/include/asm-x86/hypercall.h           |  5
 xen/include/asm-x86/kexec.h               | 14 -
 xen/include/asm-x86/x86_32/elf.h          | 26 ++
 xen/include/asm-x86/x86_32/kexec.h        | 24 ++
 xen/include/asm-x86/x86_64/elf.h          | 26 ++
 xen/include/asm-x86/x86_64/kexec.h        | 24 ++
 xen/include/public/kexec.h                |  7
 xen/include/xen/elfcore.h                 |  3
 17 files changed, 538 insertions(+), 43 deletions(-)
patches/linux-2.6.16.33/git-2a8a3d5b65e86ec1dfef7d268c64a909eab94af7.patch new file +62 -0
@@ -0,0 +1,62 @@
+From: Eric W. Biederman <[email protected]>
+Date: Sun, 30 Jul 2006 10:03:20 +0000 (-0700)
+Subject: [PATCH] machine_kexec.c: Fix the description of segment handling
+X-Git-Tag: v2.6.18-rc4
+X-Git-Url: http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=2a8a3d5b65e86ec1dfef7d268c64a909eab94af7
+
+[PATCH] machine_kexec.c: Fix the description of segment handling
+
+One of my original comments in machine_kexec was unclear
+and this should fix it.
+
+Signed-off-by: Eric W. Biederman <[email protected]>
+Cc: Andi Kleen <[email protected]>
+Acked-by: Horms <[email protected]>
+Signed-off-by: Andrew Morton <[email protected]>
+Signed-off-by: Linus Torvalds <[email protected]>
+---
+
+--- a/arch/i386/kernel/machine_kexec.c
++++ b/arch/i386/kernel/machine_kexec.c
+@@ -189,14 +189,11 @@ NORET_TYPE void machine_kexec(struct kim
+ 	memcpy((void *)reboot_code_buffer, relocate_new_kernel,
+ 						relocate_new_kernel_size);
+ 
+-	/* The segment registers are funny things, they are
+-	 * automatically loaded from a table, in memory wherever you
+-	 * set them to a specific selector, but this table is never
+-	 * accessed again you set the segment to a different selector.
+-	 *
+-	 * The more common model is are caches where the behide
+-	 * the scenes work is done, but is also dropped at arbitrary
+-	 * times.
++	/* The segment registers are funny things, they have both a
++	 * visible and an invisible part.  Whenever the visible part is
++	 * set to a specific selector, the invisible part is loaded
++	 * with from a table in memory.  At no other time is the
++	 * descriptor table in memory accessed.
+ 	 *
+ 	 * I take advantage of this here by force loading the
+ 	 * segments, before I zap the gdt with an invalid value.
+--- a/arch/x86_64/kernel/machine_kexec.c
++++ b/arch/x86_64/kernel/machine_kexec.c
+@@ -207,14 +207,11 @@ NORET_TYPE void machine_kexec(struct kim
+ 	__flush_tlb();
+ 
+ 
+-	/* The segment registers are funny things, they are
+-	 * automatically loaded from a table, in memory wherever you
+-	 * set them to a specific selector, but this table is never
+-	 * accessed again unless you set the segment to a different selector.
+-	 *
+-	 * The more common model are caches where the behide
+-	 * the scenes work is done, but is also dropped at arbitrary
+-	 * times.
++	/* The segment registers are funny things, they have both a
++	 * visible and an invisible part.  Whenever the visible part is
++	 * set to a specific selector, the invisible part is loaded
++	 * with from a table in memory.  At no other time is the
++	 * descriptor table in memory accessed.
+ 	 *
+ 	 * I take advantage of this here by force loading the
+ 	 * segments, before I zap the gdt with an invalid value.
patches/linux-2.6.16.33/git-2efe55a9cec8418f0e0cde3dc3787a42fddc4411.patch new file +93 -0

93 lines not on this page · raw message

patches/linux-2.6.16.33/series +2 -0
@@ -1,4 +1,6 @@
 kexec-generic.patch
+git-2efe55a9cec8418f0e0cde3dc3787a42fddc4411.patch
+git-2a8a3d5b65e86ec1dfef7d268c64a909eab94af7.patch
 blktap-aio-16_03_06.patch
 device_bind.patch
 fix-hz-suspend.patch
xen/arch/x86/crash.c +112 -3

122 lines not on this page · raw message

xen/arch/x86/machine_kexec.c +73 -10

99 lines not on this page · raw message

xen/arch/x86/setup.c +64 -9

103 lines not on this page · raw message

xen/arch/x86/traps.c +2 -0
@@ -45,6 +45,7 @@
 #include <xen/iocap.h>
 #include <xen/nmi.h>
 #include <xen/version.h>
+#include <xen/kexec.h>
 #include <asm/shadow.h>
 #include <asm/system.h>
 #include <asm/io.h>
@@ -1633,6 +1634,7 @@ static void unknown_nmi_error(unsigned c
         printk("Uhhuh. NMI received for unknown reason %02x.\n", reason);
         printk("Dazed and confused, but trying to continue\n");
         printk("Do you have a strange power saving mode enabled?\n");
+        machine_crash_kexec();
     }
 }
 
xen/include/asm-x86/elf.h +6 -12
@@ -1,21 +1,15 @@
 #ifndef __X86_ELF_H__
 #define __X86_ELF_H__
 
-#include <xen/lib.h>       /* for printk() used in stub */
-
-typedef struct {
-    unsigned long dummy;
-} ELF_Gregset;
-
 typedef struct {
-    unsigned long dummy;
+    unsigned long cr0, cr2, cr3, cr4;
 } crash_xen_core_t;
 
-extern inline void elf_core_save_regs(ELF_Gregset *core_regs, 
-                                      crash_xen_core_t *xen_core_regs)
-{
-    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
-}
+#ifdef __x86_64__
+#include <asm/x86_64/elf.h>
+#else
+#include <asm/x86_32/elf.h>
+#endif
 
 #endif /* __X86_ELF_H__ */
 
xen/include/asm-x86/fixmap.h +4 -0
@@ -16,6 +16,7 @@
 #include <asm/apicdef.h>
 #include <asm/acpi.h>
 #include <asm/page.h>
+#include <xen/kexec.h>
 
 /*
  * Here we define all the compile-time 'special' virtual
@@ -36,6 +37,9 @@ enum fixed_addresses {
     FIX_ACPI_END = FIX_ACPI_BEGIN + FIX_ACPI_PAGES - 1,
     FIX_HPET_BASE,
     FIX_CYCLONE_TIMER,
+    FIX_KEXEC_BASE_0,
+    FIX_KEXEC_BASE_END = FIX_KEXEC_BASE_0 \
+      + ((KEXEC_XEN_NO_PAGES >> 1) * KEXEC_IMAGE_NR) - 1,
     __end_of_fixed_addresses
 };
 
xen/include/asm-x86/hypercall.h +5 -0
@@ -6,6 +6,7 @@
 #define __ASM_X86_HYPERCALL_H__
 
 #include <public/physdev.h>
+#include <xen/types.h>
 
 extern long
 do_event_channel_op_compat(
@@ -87,6 +88,10 @@ extern long
 arch_do_vcpu_op(
     int cmd, struct vcpu *v, XEN_GUEST_HANDLE(void) arg);
 
+extern int
+do_kexec(
+    unsigned long op, unsigned arg1, XEN_GUEST_HANDLE(void) uarg);
+
 #ifdef __x86_64__
 
 extern long
xen/include/asm-x86/kexec.h +5 -9
@@ -1,15 +1,11 @@
 #ifndef __X86_KEXEC_H__
 #define __X86_KEXEC_H__
 
-#include <xen/lib.h>       /* for printk() used in stub */
-#include <xen/types.h>
-#include <public/xen.h>
-#include <xen/kexec.h>
-
-static inline void machine_kexec(xen_kexec_image_t *image)
-{
-    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
-}
+#ifdef __x86_64__
+#include <asm/x86_64/kexec.h>
+#else
+#include <asm/x86_32/kexec.h>
+#endif
 
 #endif /* __X86_KEXEC_H__ */
 
xen/include/asm-x86/x86_32/elf.h new file +26 -0
@@ -0,0 +1,26 @@
+#ifndef __X86_32_ELF_H__
+#define __X86_32_ELF_H__
+
+#include <xen/lib.h>       /* for printk() used in stub */
+
+typedef struct {
+    unsigned long dummy;
+} ELF_Gregset;
+
+extern inline void elf_core_save_regs(ELF_Gregset *core_regs, 
+                                      crash_xen_core_t *xen_core_regs)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+}
+
+#endif /* __X86_32_ELF_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
xen/include/asm-x86/x86_32/kexec.h new file +24 -0
@@ -0,0 +1,24 @@
+#ifndef __X86_32_KEXEC_H__
+#define __X86_32_KEXEC_H__
+
+#include <xen/lib.h>       /* for printk() used in stub */
+#include <xen/types.h>
+#include <public/xen.h>
+#include <xen/kexec.h>
+
+static inline void machine_kexec(xen_kexec_image_t *image)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+}
+
+#endif /* __X86_32_KEXEC_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
xen/include/asm-x86/x86_64/elf.h new file +26 -0
@@ -0,0 +1,26 @@
+#ifndef __X86_64_ELF_H__
+#define __X86_64_ELF_H__
+
+#include <xen/lib.h>       /* for printk() used in stub */
+
+typedef struct {
+    unsigned long dummy;
+} ELF_Gregset;
+
+extern inline void elf_core_save_regs(ELF_Gregset *core_regs, 
+                                      crash_xen_core_t *xen_core_regs)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+}
+
+#endif /* __X86_64_ELF_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
xen/include/asm-x86/x86_64/kexec.h new file +24 -0
@@ -0,0 +1,24 @@
+#ifndef __X86_64_KEXEC_H__
+#define __X86_64_KEXEC_H__
+
+#include <xen/lib.h>       /* for printk() used in stub */
+#include <xen/types.h>
+#include <public/xen.h>
+#include <xen/kexec.h>
+
+static inline void machine_kexec(xen_kexec_image_t *image)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+}
+
+#endif /* __X86_64_KEXEC_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
xen/include/public/kexec.h +7 -0
@@ -40,6 +40,10 @@
 
 #include "xen.h"
 
+#if defined(__i386__) || defined(__x86_64__)
+#define KEXEC_XEN_NO_PAGES 17
+#endif
+
 /*
  * Prototype for this hypercall is:
  *  int kexec_op(int cmd, void *args)
@@ -72,6 +76,9 @@
  */
  
 typedef struct xen_kexec_image {
+#if defined(__i386__) || defined(__x86_64__)
+    unsigned long page_list[KEXEC_XEN_NO_PAGES];
+#endif
     unsigned long indirection_page;
     unsigned long start_address;
 } xen_kexec_image_t;
xen/include/xen/elfcore.h +3 -0
@@ -108,6 +108,9 @@ typedef struct {
     unsigned long xen_compile_date;
     unsigned long xen_compile_time;
     unsigned long tainted;
+#ifdef CONFIG_X86
+    unsigned long dom0_pfn_to_mfn_frame_list_list;
+#endif
 } crash_xen_info_t;
 
 TYPEDEF_NOTE(crash_note_xen_info_t, XEN_STR_LEN, crash_xen_info_t);
#3 lore raw

PATCH 3/4 Kexec / Kdump: x86_32 specific code

In reply to Magnus Damm

[PATCH 03/04] Kexec / Kdump: x86_32 specific code

This patch contains the x86_32 implementation of Kexec / Kdump for Xen.

---

Applies on top of xen-unstable-12621.

 buildconfigs/linux-defconfig_xen_x86_32                          |   2
 linux-2.6-xen-sparse/arch/i386/Kconfig                           |   2
 linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c                |  19
 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h   |   8
 patches/linux-2.6.16.33/git-35...c9.patch                        | 401 +++++++
 patches/linux-2.6.16.33/linux-2.6.19-rc1-kexec...code-i386.patch | 169 ++++
 patches/linux-2.6.16.33/linux-2.6.19-rc1-kexec-xen-i386.patch    | 108 ++
 patches/linux-2.6.16.33/series                                   |   3
 xen/arch/x86/x86_32/entry.S                                      |   2
 xen/include/asm-x86/x86_32/elf.h                                 |  52 +
 xen/include/asm-x86/x86_32/kexec.h                               |  28
 11 files changed, 783 insertions(+), 11 deletions(-)
buildconfigs/linux-defconfig_xen_x86_32 +2 -0
@@ -183,6 +183,7 @@ CONFIG_MTRR=y
 CONFIG_REGPARM=y
 CONFIG_SECCOMP=y
 CONFIG_HZ_100=y
+CONFIG_KEXEC=y
 # CONFIG_HZ_250 is not set
 # CONFIG_HZ_1000 is not set
 CONFIG_HZ=100
@@ -1036,6 +1037,7 @@ CONFIG_DNOTIFY=y
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+# CONFIG_PROC_VMCORE is not set
 CONFIG_SYSFS=y
 CONFIG_TMPFS=y
 # CONFIG_HUGETLB_PAGE is not set
linux-2.6-xen-sparse/arch/i386/Kconfig +1 -1
@@ -726,7 +726,7 @@ source kernel/Kconfig.hz
 
 config KEXEC
 	bool "kexec system call (EXPERIMENTAL)"
-	depends on EXPERIMENTAL && !X86_XEN
+	depends on EXPERIMENTAL && !XEN_UNPRIVILEGED_GUEST
 	help
 	  kexec is a system call that implements the ability to shutdown your
 	  current kernel, and to start another kernel.  It is like a reboot
linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c +18 -1
@@ -69,6 +69,10 @@
 #include "setup_arch_pre.h"
 #include <bios_ebda.h>
 
+#ifdef CONFIG_XEN
+#include <xen/interface/kexec.h>
+#endif
+
 /* Forward Declaration. */
 void __init find_max_pfn(void);
 
@@ -943,6 +947,7 @@ static void __init parse_cmdline_early (
 		 * after a kernel panic.
 		 */
 		else if (!memcmp(from, "crashkernel=", 12)) {
+#ifndef CONFIG_XEN
 			unsigned long size, base;
 			size = memparse(from+12, &from);
 			if (*from == '@') {
@@ -953,6 +958,10 @@ static void __init parse_cmdline_early (
 				crashk_res.start = base;
 				crashk_res.end   = base + size - 1;
 			}
+#else
+			printk("Ignoring crashkernel command line, "
+			       "parameter will be supplied by xen\n");
+#endif
 		}
 #endif
 #ifdef CONFIG_PROC_VMCORE
@@ -1322,10 +1331,14 @@ void __init setup_bootmem_allocator(void
 	}
 #endif
 #ifdef CONFIG_KEXEC
+#ifdef CONFIG_XEN
+	xen_machine_kexec_setup_resources();
+#else
 	if (crashk_res.start != crashk_res.end)
 		reserve_bootmem(crashk_res.start,
 			crashk_res.end - crashk_res.start + 1);
 #endif
+#endif
 
 	if (!xen_feature(XENFEAT_auto_translated_physmap))
 		phys_to_machine_mapping =
@@ -1389,7 +1402,11 @@ legacy_init_iomem_resources(struct e820e
 			request_resource(res, data_resource);
 #endif
 #ifdef CONFIG_KEXEC
-			request_resource(res, &crashk_res);
+			if (crashk_res.start != crashk_res.end)
+			     request_resource(res, &crashk_res);
+#ifdef CONFIG_XEN
+			xen_machine_kexec_register_resources(res);
+#endif
 #endif
 		}
 	}
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h +8 -0
@@ -395,5 +395,13 @@ HYPERVISOR_xenoprof_op(
 	return _hypercall2(int, xenoprof_op, op, arg);
 }
 
+static inline int
+HYPERVISOR_kexec_op(
+	unsigned long op, void *args)
+{
+	return _hypercall2(int, kexec_op, op, args);
+}
+
+
 
 #endif /* __HYPERCALL_H__ */
patches/linux-2.6.16.33/git-3566561bfadffcb5dbc85d576be80c0dbf2cccc9.patch new file +401 -0

401 lines not on this page · raw message

patches/linux-2.6.16.33/linux-2.6.19-rc1-kexec-move_segment_code-i386.patch new file +169 -0

169 lines not on this page · raw message

patches/linux-2.6.16.33/linux-2.6.19-rc1-kexec-xen-i386.patch new file +108 -0

108 lines not on this page · raw message

patches/linux-2.6.16.33/series +3 -0
@@ -1,6 +1,9 @@
 kexec-generic.patch
 git-2efe55a9cec8418f0e0cde3dc3787a42fddc4411.patch
 git-2a8a3d5b65e86ec1dfef7d268c64a909eab94af7.patch
+git-3566561bfadffcb5dbc85d576be80c0dbf2cccc9.patch
+linux-2.6.19-rc1-kexec-move_segment_code-i386.patch
+linux-2.6.19-rc1-kexec-xen-i386.patch
 blktap-aio-16_03_06.patch
 device_bind.patch
 fix-hz-suspend.patch
xen/arch/x86/x86_32/entry.S +2 -0
@@ -659,6 +659,7 @@ ENTRY(hypercall_table)
         .long do_hvm_op
         .long do_sysctl             /* 35 */
         .long do_domctl
+        .long do_kexec_op
         .rept NR_hypercalls-((.-hypercall_table)/4)
         .long do_ni_hypercall
         .endr
@@ -701,6 +702,7 @@ ENTRY(hypercall_args_table)
         .byte 2 /* do_hvm_op            */
         .byte 1 /* do_sysctl            */  /* 35 */
         .byte 1 /* do_domctl            */
+        .byte 2 /* do_kexec_op          */
         .rept NR_hypercalls-(.-hypercall_args_table)
         .byte 0 /* do_ni_hypercall      */
         .endr
xen/include/asm-x86/x86_32/elf.h +49 -3

65 lines not on this page · raw message

xen/include/asm-x86/x86_32/kexec.h +22 -6
@@ -1,17 +1,33 @@
-#ifndef __X86_32_KEXEC_H__
-#define __X86_32_KEXEC_H__
+/******************************************************************************
+ * kexec.h
+ * 
+ * Based heavily on machine_kexec.c and kexec.h from Linux 2.6.19-rc1
+ *
+ */
+  
+#ifndef __X86_KEXEC_X86_32_H__
+#define __X86_KEXEC_X86_32_H__
 
-#include <xen/lib.h>       /* for printk() used in stub */
 #include <xen/types.h>
-#include <public/xen.h>
 #include <xen/kexec.h>
+#include <asm/fixmap.h>
+
+typedef asmlinkage void (*relocate_new_kernel_t)(
+               unsigned long indirection_page,
+               unsigned long page_list,
+               unsigned long start_address,
+               unsigned int has_pae);
 
 static inline void machine_kexec(xen_kexec_image_t *image)
 {
-    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+    relocate_new_kernel_t rnk;
+
+    rnk = (relocate_new_kernel_t) image->page_list[1];
+    (*rnk)(image->indirection_page, (unsigned long)image->page_list, 
+           image->start_address, (unsigned long)cpu_has_pae);
 }
 
-#endif /* __X86_32_KEXEC_H__ */
+#endif /* __X86_KEXEC_X86_32_H__ */
 
 /*
  * Local variables:
#4 lore raw

PATCH 4/4 Kexec / Kdump: x86_64 specific code

In reply to Magnus Damm

[PATCH 04/04] Kexec / Kdump: x86_64 specific code

This patch contains the x86_64 implementation of Kexec / Kdump for Xen.

---

Applies on top of xen-unstable-12621.

 buildconfigs/linux-defconfig_xen_x86_64                            |    1
 linux-2.6-xen-sparse/arch/x86_64/Kconfig                           |    2
 linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c                 |    6
 linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c                |   13
 linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h   |    7
 linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/ptrace.h      |    2
 patches/linux-2.6.16.33/git-4b...1f.patch                          |  375 ++++
 patches/linux-2.6.16.33/linux-2.6.19-rc1-kexec...code-x86_64.patch |  161 ++
 patches/linux-2.6.16.33/linux-2.6.19-rc1-kexec-xen-x86_64.patch    |  219 +++
 patches/linux-2.6.16.33/series                                     |    3
 xen/arch/x86/x86_64/entry.S                                        |    2
 xen/include/asm-x86/x86_64/elf.h                                   |   72 +
 xen/include/asm-x86/x86_64/kexec.h                                 |   23
 13 files changed, 877 insertions(+), 9 deletions(-)
buildconfigs/linux-defconfig_xen_x86_64 +1 -0
@@ -138,6 +138,7 @@ CONFIG_SWIOTLB=y
 CONFIG_PHYSICAL_START=0x100000
 CONFIG_SECCOMP=y
 CONFIG_HZ_100=y
+CONFIG_KEXEC=y
 # CONFIG_HZ_250 is not set
 # CONFIG_HZ_1000 is not set
 CONFIG_HZ=100
linux-2.6-xen-sparse/arch/x86_64/Kconfig +1 -1
@@ -435,7 +435,7 @@ config X86_MCE_AMD
 
 config KEXEC
 	bool "kexec system call (EXPERIMENTAL)"
-	depends on EXPERIMENTAL && !X86_64_XEN
+	depends on EXPERIMENTAL && !XEN_UNPRIVILEGED_GUEST
 	help
 	  kexec is a system call that implements the ability to shutdown your
 	  current kernel, and to start another kernel.  It is like a reboot
linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c +5 -1
@@ -260,7 +260,11 @@ void __init e820_reserve_resources(struc
 			request_resource(res, &data_resource);
 #endif
 #ifdef CONFIG_KEXEC
-			request_resource(res, &crashk_res);
+			if (crashk_res.start != crashk_res.end)
+				request_resource(res, &crashk_res);
+#ifdef CONFIG_XEN
+			xen_machine_kexec_register_resources(res);
+#endif
 #endif
 		}
 	}
linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c +13 -0
@@ -80,6 +80,10 @@
 #include <asm/mach-xen/setup_arch_post.h>
 #include <xen/interface/memory.h>
 
+#ifdef CONFIG_XEN
+#include <xen/interface/kexec.h>
+#endif
+
 extern unsigned long start_pfn;
 extern struct edid_info edid_info;
 
@@ -450,6 +454,7 @@ static __init void parse_cmdline_early (
 		 * after a kernel panic.
 		 */
 		else if (!memcmp(from, "crashkernel=", 12)) {
+#ifndef CONFIG_XEN
 			unsigned long size, base;
 			size = memparse(from+12, &from);
 			if (*from == '@') {
@@ -460,6 +465,10 @@ static __init void parse_cmdline_early (
 				crashk_res.start = base;
 				crashk_res.end   = base + size - 1;
 			}
+#else
+			printk("Ignoring crashkernel command line, "
+			       "parameter will be supplied by xen\n");
+#endif
 		}
 #endif
 
@@ -812,11 +821,15 @@ void __init setup_arch(char **cmdline_p)
 #endif
 #endif	/* !CONFIG_XEN */
 #ifdef CONFIG_KEXEC
+#ifdef CONFIG_XEN
+	xen_machine_kexec_setup_resources();
+#else
 	if (crashk_res.start != crashk_res.end) {
 		reserve_bootmem(crashk_res.start,
 			crashk_res.end - crashk_res.start + 1);
 	}
 #endif
+#endif
 
 	paging_init();
 #ifdef CONFIG_X86_LOCAL_APIC
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h +7 -0
@@ -396,4 +396,11 @@ HYPERVISOR_xenoprof_op(
 	return _hypercall2(int, xenoprof_op, op, arg);
 }
 
+static inline int
+HYPERVISOR_kexec_op(
+	unsigned long op, void *args)
+{
+	return _hypercall2(int, kexec_op, op, args);
+}
+
 #endif /* __HYPERCALL_H__ */
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/ptrace.h +2 -0
@@ -90,6 +90,8 @@ extern unsigned long profile_pc(struct p
 #define profile_pc(regs) instruction_pointer(regs)
 #endif
 
+#include <linux/compiler.h>
+
 void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
 
 struct task_struct;
patches/linux-2.6.16.33/git-4bfaaef01a1badb9e8ffb0c0a37cd2379008d21f.patch new file +375 -0

375 lines not on this page · raw message

patches/linux-2.6.16.33/linux-2.6.19-rc1-kexec-move_segment_code-x86_64.patch new file +161 -0

161 lines not on this page · raw message

patches/linux-2.6.16.33/linux-2.6.19-rc1-kexec-xen-x86_64.patch new file +219 -0

219 lines not on this page · raw message

patches/linux-2.6.16.33/series +3 -0
@@ -4,6 +4,9 @@ git-2a8a3d5b65e86ec1dfef7d268c64a909eab9
 git-3566561bfadffcb5dbc85d576be80c0dbf2cccc9.patch
 linux-2.6.19-rc1-kexec-move_segment_code-i386.patch
 linux-2.6.19-rc1-kexec-xen-i386.patch
+git-4bfaaef01a1badb9e8ffb0c0a37cd2379008d21f.patch
+linux-2.6.19-rc1-kexec-move_segment_code-x86_64.patch
+linux-2.6.19-rc1-kexec-xen-x86_64.patch
 blktap-aio-16_03_06.patch
 device_bind.patch
 fix-hz-suspend.patch
xen/arch/x86/x86_64/entry.S +2 -0
@@ -559,6 +559,7 @@ ENTRY(hypercall_table)
         .quad do_hvm_op
         .quad do_sysctl             /* 35 */
         .quad do_domctl
+        .quad do_kexec_op
         .rept NR_hypercalls-((.-hypercall_table)/8)
         .quad do_ni_hypercall
         .endr
@@ -601,6 +602,7 @@ ENTRY(hypercall_args_table)
         .byte 2 /* do_hvm_op            */
         .byte 1 /* do_sysctl            */  /* 35 */
         .byte 1 /* do_domctl            */
+        .byte 2 /* do_kexec             */
         .rept NR_hypercalls-(.-hypercall_args_table)
         .byte 0 /* do_ni_hypercall      */
         .endr
xen/include/asm-x86/x86_64/elf.h +69 -3

85 lines not on this page · raw message

xen/include/asm-x86/x86_64/kexec.h +19 -4
@@ -1,14 +1,29 @@
+/******************************************************************************
+ * kexec.h
+ * 
+ * Based heavily on machine_kexec.c and kexec.h from Linux 2.6.19-rc1
+ *
+ */
+
 #ifndef __X86_64_KEXEC_H__
 #define __X86_64_KEXEC_H__
-
-#include <xen/lib.h>       /* for printk() used in stub */
+  
 #include <xen/types.h>
-#include <public/xen.h>
 #include <xen/kexec.h>
+#include <asm/fixmap.h>
+
+typedef void (*relocate_new_kernel_t)(
+                unsigned long indirection_page,
+                unsigned long page_list,
+                unsigned long start_address);
 
 static inline void machine_kexec(xen_kexec_image_t *image)
 {
-    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+    relocate_new_kernel_t rnk;
+
+    rnk = (relocate_new_kernel_t) image->page_list[1];
+    (*rnk)(image->indirection_page, (unsigned long)image->page_list, 
+           image->start_address);
 }
 
 #endif /* __X86_64_KEXEC_H__ */