Kexec / Kdump: Release 20061030 (xen-unstable-12025)
cover Kexec / Kdump: Release 20061030 (xen-unstable-12025)
[PATCH 00/04] Kexec / Kdump: Release 20061030 (xen-unstable-12025)
This is the 20061030 release of the Kexec / Kdump patches for x86 Xen.
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
The tests were made with version 46ecc6c6c77b1fab20b08286209631a00eb1049e of kexec-tools from the kexec-tools-testing tree which can be found here:
http://www.kernel.org/git/?p=linux/kernel/git/horms/kexec-tools-testing.git
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
Changes:
20061030 - Release 20061030 for xen-unstable-12025
- Rewrote ELF note / register saving code.
- ELF notes are now present in both the hypervisor and dom0.
- ELF notes are always in 64-bit file format under Xen.
- Register contents are no longer copied from dom0 to hypervisor.
- Registers are now saved directly in the ELF notes.
- Removes a lot of hairy register saving code, saves memory.
- The current registers are always saved to keep thing simple.
- It is up to the tools to locate saved registers on the stack.
- Xen-specific ELF note code rewritten.
- Pass version information though ELF notes.
- Fox x86, pass dom0 pfn_to_mfn_frame_list_list.
- Replaced reserve and crash_note hypercalls ops with range hypercall op.
- Machine addresses for ELF notes are now exported through /proc/iomem.
- Original crash.c-file is now used in Linux.
- Added more comments to xen/include/public/kexec.h
- KEXEC_TYPE comments.
- Some description of xen_kexec_image_t.
- Overview of the hypercall ops, hopefully similar to a story board.
20061023 - Release 20061023 for xen-unstable-11856
- Removed disable_IO_APIC() call on guest side.
- Rewrote hypervisor code to support atomic image update.
- Merged load and unload code into one function.
- Replaced locking with spinlocks to avoid xchg() problems.
- Moved image type into per hypercall-op structure.
- Clean ups and minor fixes.
- Updated attribution.
- Header file and comment fixes.
- Reduced the total number of files and hunks.
20061016 - Release 20061016 for xen-unstable-11760
- "Avoid overwriting the current pgd (V4)" patches accepted upstream
- Included in Linux-2.6.19-rc1
- Up-ported Xen code to build on top of merged patches
- Implemented and tested VT-extension support for x86:
- Intel VMX / IVT "Vanderpool" support for x86_32 and x86_64
- AMD SVM / AMD-V "Pacifica" support for x86_32 and x86_64
- Command line parameter is now the same as for Linux:
- For instance, "crashkernel=64M@32M" reserves a 64 MB window at 32 MB
- x86 and ia64 patches are now separated, this release is x86-only
- The x86 port is from this release handled by Magnus Damm
- The ia64 port is handled by Simon Horman
20060931 - Take XIV for xen-unstable-11296 posted by Simon Horman
Enjoy!
/ magnus
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-12025.
linux-2.6-xen-sparse/drivers/xen/core/Makefile | 1 linux-2.6-xen-sparse/drivers/xen/core/machine_kexec.c | 165 ++++++++ linux-2.6-xen-sparse/drivers/xen/core/reboot.c | 4 patches/linux-2.6.16.29/kexec-generic.patch | 224 +++++++++++ patches/linux-2.6.16.29/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 | 335 +++++++++++++++++ xen/common/page_alloc.c | 33 + xen/drivers/char/console.c | 3 xen/include/asm-ia64/elf.h | 25 + xen/include/asm-ia64/kexec.h | 25 + xen/include/asm-powerpc/elf.h | 25 + xen/include/asm-powerpc/kexec.h | 25 + xen/include/asm-x86/elf.h | 25 + xen/include/asm-x86/kexec.h | 24 + xen/include/public/kexec.h | 131 ++++++ xen/include/xen/elf.h | 16 xen/include/xen/elfcore.h | 130 ++++++ xen/include/xen/hypercall.h | 6 xen/include/xen/kexec.h | 43 ++ xen/include/xen/mm.h | 1 30 files changed, 1385 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 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 +165 -0
165 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/core/reboot.c +4 -0
@@ -65,6 +65,10 @@ void machine_power_off(void)HYPERVISOR_shutdown (SHUTDOWN_poweroff); } +#ifdef CONFIG_KEXEC +void machine_shutdown (void ) { } +#endif +int reboot_thru_bios =0 ;/* for dmi_scan.c */ EXPORT_SYMBOL (machine_restart);EXPORT_SYMBOL (machine_halt);
patches/linux-2.6.16.29/kexec-generic.patch new file +224 -0
224 lines not on this page · raw message
patches/linux-2.6.16.29/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 +335 -0
335 lines not on this page · raw message
xen/common/page_alloc.c +22 -11
@@ -216,24 +216,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>
@@ -755,6 +756,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 +25 -0
@@ -0,0 +1,25 @@ +#ifndef __IA64_ELF_H__ +#define __IA64_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 *dst) +{ +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 +25 -0
@@ -0,0 +1,25 @@ +#ifndef _ASM_ELF_H__ +#define _ASM_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 *dst) +{ +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 +25 -0
@@ -0,0 +1,25 @@ +#ifndef __X86_ELF_H__ +#define __X86_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 *dst) +{ +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/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 +130 -0
130 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. */
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-12025.
patches/linux-2.6.16.29/git-2a...f7.patch | 62 ++++ patches/linux-2.6.16.29/git-2e...11.patch | 93 +++++++ patches/linux-2.6.16.29/series | 2 xen/arch/x86/crash.c | 130 +++++++++- 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 | 15 - 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 | 25 + xen/include/asm-x86/x86_32/kexec.h | 24 + xen/include/asm-x86/x86_64/elf.h | 25 + xen/include/asm-x86/x86_64/kexec.h | 24 + xen/include/public/kexec.h | 7 xen/include/xen/elfcore.h | 13 - 17 files changed, 558 insertions(+), 43 deletions(-)
patches/linux-2.6.16.29/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.29/git-2efe55a9cec8418f0e0cde3dc3787a42fddc4411.patch new file +93 -0
93 lines not on this page · raw message
patches/linux-2.6.16.29/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 +127 -3
137 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>
@@ -1601,6 +1602,7 @@ static void unknown_nmi_error(unsigned cprintk ("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 +5 -10
@@ -1,16 +1,11 @@#ifndef __X86_ELF_H__#define __X86_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 *dst) -{ -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 longarch_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 +25 -0
@@ -0,0 +1,25 @@ +#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 *dst) +{ +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 +25 -0
@@ -0,0 +1,25 @@ +#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 *dst) +{ +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
@@ -11,6 +11,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)
@@ -23,6 +27,9 @@#define KEXEC_TYPE_CRASH 1typedef 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 +11 -2
@@ -104,7 +104,16 @@ TYPEDEF_NOTE(crash_note_core_t, CORE_STR#define XEN_STR_LEN 9/* including terminating zero */ typedef struct { -unsigned long dummy; +unsigned long xen_major_version; +unsigned long xen_minor_version; +unsigned long xen_extra_version; +unsigned long xen_changeset; +unsigned long xen_compiler; +unsigned long xen_compile_date; +unsigned long xen_compile_time; +#ifdef CONFIG_X86 +unsigned long dom0_pfn_to_mfn_frame_list_list; +#endif }xen_crash_xen_regs_t ;TYPEDEF_NOTE (crash_note_xen_t,XEN_STR_LEN , xen_crash_xen_regs_t);
@@ -114,7 +123,7 @@ TYPEDEF_END_NOTE(crash_note_final_t);typedef struct {crash_note_core_t core;crash_note_xen_t xen; -crash_note_final_t note; +crash_note_final_t final; }crash_note_t ;#endif /* __ELFCOREC_H__ */
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-12025.
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/kexec-xen.h | 30 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h | 8 patches/linux-2.6.16.29/git-35...c9.patch | 401 +++++++ patches/linux-2.6.16.29/linux-2.6.16.29-crash-xen-i386.patch | 31 patches/linux-2.6.16.29/linux-2.6.19-rc1-kexec..code-i386.patch | 169 ++++ patches/linux-2.6.16.29/linux-2.6.19-rc1-kexec-xen-i386.patch | 54 + patches/linux-2.6.16.29/series | 4 xen/arch/x86/x86_32/entry.S | 2 xen/include/asm-x86/x86_32/elf.h | 38 xen/include/asm-x86/x86_32/kexec.h | 28 13 files changed, 777 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 e820erequest_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/kexec-xen.h new file +30 -0
@@ -0,0 +1,30 @@ +#ifndef _I386_KEXEC_XEN_H +#define _I386_KEXEC_XEN_H + +/* Kexec needs to know about the actual physical addresss. +* But in xen, on some architectures, a physical address is a +* pseudo-physical addresss. */ + +#ifdef CONFIG_XEN +#define kexec_page_to_pfn (page) pfn_to_mfn(page_to_pfn(page)) +#define kexec_pfn_to_page (pfn) pfn_to_page(mfn_to_pfn(pfn)) +#define kexec_virt_to_phys (addr) virt_to_machine(addr) +#define kexec_phys_to_virt (addr) phys_to_virt(machine_to_phys(addr)) +#else +#define kexec_page_to_pfn (page) page_to_pfn(page) +#define kexec_pfn_to_page (pfn) pfn_to_page(pfn) +#define kexec_virt_to_phys (addr) virt_to_phys(addr) +#define kexec_phys_to_virt (addr) phys_to_virt(addr) +#endif + +#endif /* _I386_KEXEC_XEN_H */ + +/* +* Local variables: +* c-file-style: "linux" +* indent-tabs-mode: t +* c-indent-level: 8 +* c-basic-offset: 8 +* tab-width: 8 +* End: +*/
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h +8 -0
@@ -385,5 +385,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.29/git-3566561bfadffcb5dbc85d576be80c0dbf2cccc9.patch new file +401 -0
401 lines not on this page · raw message
patches/linux-2.6.16.29/linux-2.6.16.29-crash-xen-i386.patch new file +31 -0
@@ -0,0 +1,31 @@ +--- 0001/arch/i386/kernel/crash.c ++++ work/arch/i386/kernel/crash.c 2006-10-26 15:45:35.000000000 +0900 +@@ -90,6 +90,7 @@ static void crash_save_self(struct pt_re + crash_save_this_cpu(regs, cpu); + } + ++#ifndef CONFIG_XEN + #ifdef CONFIG_SMP + static atomic_t waiting_for_crash_ipi; + +@@ -158,6 +159,7 @@ static void nmi_shootdown_cpus(void) + /* There are no cpus to shootdown */ + } + #endif ++#endif /* CONFIG_XEN */ + + void machine_crash_shutdown(struct pt_regs *regs) + { +@@ -174,10 +176,12 @@ void machine_crash_shutdown(struct pt_re + + /* Make a note of crashing cpu. Will be used in NMI callback.*/ + crashing_cpu = smp_processor_id(); ++#ifndef CONFIG_XEN + nmi_shootdown_cpus(); + lapic_shutdown(); + #if defined(CONFIG_X86_IO_APIC) + disable_IO_APIC(); + #endif ++#endif /* CONFIG_XEN */ + crash_save_self(regs); + }
patches/linux-2.6.16.29/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.29/linux-2.6.19-rc1-kexec-xen-i386.patch new file +54 -0
54 lines not on this page · raw message
patches/linux-2.6.16.29/series +4 -0
@@ -1,6 +1,10 @@ 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 +linux-2.6.16.29-crash-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
@@ -672,6 +672,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
@@ -714,6 +715,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 +35 -3
@@ -1,15 +1,47 @@#ifndef __X86_32_ELF_H__#define __X86_32_ELF_H__ -#include <xen/lib.h> /* for printk() used in stub */ +#include <asm/processor.h> typedef struct { -unsigned long dummy; +unsigned long ebx; +unsigned long ecx; +unsigned long edx; +unsigned long esi; +unsigned long edi; +unsigned long ebp; +unsigned long eax; +unsigned long ds; +unsigned long es; +unsigned long fs; +unsigned long gs; +unsigned long orig_eax; +unsigned long eip; +unsigned long cs; +unsigned long eflags; +unsigned long esp; +unsigned long ss; }ELF_Gregset ;extern inline void elf_core_save_regs (ELF_Gregset *dst) { -printk ("STUB: " __FILE__": %s: not implemented\n" , __FUNCTION__); + asmvolatile ("movl %%ebx,%0" :"=m" (dst->ebx)); + asmvolatile ("movl %%ecx,%0" :"=m" (dst->ecx)); + asmvolatile ("movl %%edx,%0" :"=m" (dst->edx)); + asmvolatile ("movl %%esi,%0" :"=m" (dst->esi)); + asmvolatile ("movl %%edi,%0" :"=m" (dst->edi)); + asmvolatile ("movl %%ebp,%0" :"=m" (dst->ebp)); + asmvolatile ("movl %%eax,%0" :"=m" (dst->eax)); + asmvolatile ("movw %%ds, %%ax;" :"=a" (dst->ds)); + asmvolatile ("movw %%es, %%ax;" :"=a" (dst->es)); + asmvolatile ("movw %%fs, %%ax;" :"=a" (dst->fs)); + asmvolatile ("movw %%gs, %%ax;" :"=a" (dst->gs)); +/* orig_eax not filled in for now */ + dst->eip = (unsigned long )current_text_addr (); + asmvolatile ("movw %%cs, %%ax;" :"=a" (dst->cs)); + asmvolatile ("pushfl; popl %0" :"=m" (dst->eflags)); + asmvolatile ("movl %%esp,%0" :"=m" (dst->esp)); + asmvolatile ("movw %%ss, %%ax;" :"=a" (dst->ss)); }#endif /* __X86_32_ELF_H__ */
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:
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-12025.
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/kexec-xen.h | 30 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.29/git-4b..1f.patch | 375 +++++ patches/linux-2.6.16.29/linux-2.6.16.29-crash-xen-x86_64.patch | 35 patches/linux-2.6.16.29/linux-2.6.19-rc1-kexec..code-x86_64.patch | 161 +++ patches/linux-2.6.16.29/linux-2.6.19-rc1-kexec-xen-x86_64.patch | 162 +++ patches/linux-2.6.16.29/series | 4 xen/arch/x86/x86_64/entry.S | 2 xen/include/asm-x86/x86_64/elf.h | 58 + xen/include/asm-x86/x86_64/kexec.h | 23 15 files changed, 872 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(strucrequest_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/kexec-xen.h new file +30 -0
@@ -0,0 +1,30 @@ +#ifndef _X86_64_KEXEC_XEN_H +#define _X86_64_KEXEC_XEN_H + +/* Kexec needs to know about the actual physical addresss. +* But in xen, on some architectures, a physical address is a +* pseudo-physical addresss. */ + +#ifdef CONFIG_XEN +#define kexec_page_to_pfn (page) pfn_to_mfn(page_to_pfn(page)) +#define kexec_pfn_to_page (pfn) pfn_to_page(mfn_to_pfn(pfn)) +#define kexec_virt_to_phys (addr) virt_to_machine(addr) +#define kexec_phys_to_virt (addr) phys_to_virt(machine_to_phys(addr)) +#else +#define kexec_page_to_pfn (page) page_to_pfn(page) +#define kexec_pfn_to_page (pfn) pfn_to_page(pfn) +#define kexec_virt_to_phys (addr) virt_to_phys(addr) +#define kexec_phys_to_virt (addr) phys_to_virt(addr) +#endif + +#endif /* _X86_64_KEXEC_XEN_H */ + +/* +* Local variables: +* c-file-style: "linux" +* indent-tabs-mode: t +* c-indent-level: 8 +* c-basic-offset: 8 +* tab-width: 8 +* End: +*/
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h +7 -0
@@ -386,4 +386,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.29/git-4bfaaef01a1badb9e8ffb0c0a37cd2379008d21f.patch new file +375 -0
375 lines not on this page · raw message
patches/linux-2.6.16.29/linux-2.6.16.29-crash-xen-x86_64.patch new file +35 -0
@@ -0,0 +1,35 @@ +--- 0001/arch/x86_64/kernel/crash.c ++++ work/arch/x86_64/kernel/crash.c 2006-10-26 15:44:27.000000000 +0900 +@@ -92,6 +92,7 @@ static void crash_save_self(struct pt_re + crash_save_this_cpu(regs, cpu); + } + ++#ifndef CONFIG_XEN + #ifdef CONFIG_SMP + static atomic_t waiting_for_crash_ipi; + +@@ -156,6 +157,7 @@ static void nmi_shootdown_cpus(void) + /* There are no cpus to shootdown */ + } + #endif ++#endif /* CONFIG_XEN */ + + void machine_crash_shutdown(struct pt_regs *regs) + { +@@ -173,6 +175,8 @@ void machine_crash_shutdown(struct pt_re + + /* Make a note of crashing cpu. Will be used in NMI callback.*/ + crashing_cpu = smp_processor_id(); ++ ++#ifndef CONFIG_XEN + nmi_shootdown_cpus(); + + if(cpu_has_apic) +@@ -181,6 +185,6 @@ void machine_crash_shutdown(struct pt_re + #if defined(CONFIG_X86_IO_APIC) + disable_IO_APIC(); + #endif +- ++#endif /* CONFIG_XEN */ + crash_save_self(regs); + }
patches/linux-2.6.16.29/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.29/linux-2.6.19-rc1-kexec-xen-x86_64.patch new file +162 -0
162 lines not on this page · raw message
patches/linux-2.6.16.29/series +4 -0
@@ -5,6 +5,10 @@ git-3566561bfadffcb5dbc85d576be80c0dbf2c linux-2.6.19-rc1-kexec-move_segment_code-i386.patch linux-2.6.19-rc1-kexec-xen-i386.patch linux-2.6.16.29-crash-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 +linux-2.6.16.29-crash-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
@@ -573,6 +573,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
@@ -615,6 +616,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 +55 -3
70 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__ */