Kexec / Kdump: Release 20061122 (xen-unstable-12502)
cover Kexec / Kdump: Release 20061122 (xen-unstable-12502)
[PATCH 00/04] Kexec / Kdump: Release 20061122 (xen-unstable-12502)
Hi everyone,
Here comes a new version of the Kexec / Kdump patches for x86 Xen. Not much has changed since last release, just a minor fix for kdump on x86_64.
Patches to make kexec-tools Xen aware have recently been sent to the fastboot list. These patches will be merged in the kexec-tools-testing tree in the near future.
Changes:
20061122 - Release 20061122 for xen-unstable-12502
- Minor crash note fix for x86_64
- Use __attribute__ ((packed)) to avoid alignment problems
20061108 - Release 20061108 for xen-unstable-12281
- Minor crash note fixes
- Crash notes are now cleared on non-present cpus.
- Crash notes are now 32-bit aligned - same as Linux.
Thanks,
/ 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-12502.
linux-2.6-xen-sparse/drivers/xen/core/Makefile | 1 linux-2.6-xen-sparse/drivers/xen/core/machine_kexec.c | 171 ++++++++ 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 | 345 +++++++++++++++++ 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 | 127 ++++++ xen/include/xen/hypercall.h | 6 xen/include/xen/kexec.h | 43 ++ xen/include/xen/mm.h | 1 29 files changed, 1394 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 +171 -0
171 lines not on this page · raw message
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 +345 -0
345 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>
@@ -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 +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 +127 -0
127 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-12502.
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 | 3 17 files changed, 550 insertions(+), 41 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>
@@ -1633,6 +1634,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
@@ -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
@@ -105,6 +105,9 @@ typedef struct {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);
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-12502.
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
@@ -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.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
@@ -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 +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-12502.
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
@@ -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.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
@@ -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 +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__ */
Hi Magnus,
Quoted 6 lines · Magnus Damm
Here comes a new version of the Kexec / Kdump patches for x86 Xen. Not much has changed since last release, just a minor fix for kdump on
x86_64.Patches to make kexec-tools Xen aware have recently been sent to the fastboot list. These patches will be merged in the kexec-tools-testing tree in the near future.
I've taken these patches out for a spin. They look pretty good. I've got a couple of comments.
Firstly the patches break native kernel compile. You add usages of kexec_page_to_pfn() and friends to kernel/kexec.c but only include kexec-xen.h ifdef CONFIG_XEN. I fixed it with by removing the ifdef but the preferred way would be to move the native definitions of kexec_* into include/asm-i386/kexec.h and make a xen specific copy in include/asm-i386/mach-xen/asm/kexec.h with the xen versions patched in. Alternatively you could just merge kexec-xen.h into kexec.h.
My second comment is WRT to the ELF notes which you add to the kdump. You include a standard PRSTATUS core ELF note per physical CPU but there is some useful physical processor state which is not included in this structure -- most importantly CR3.
Since the amount of physical CPU state which is not already included in PRSTATUS is pretty small I think you could just include the whole lot in a Xen specific note per PCPU. I'd basically include anything which is in a Xen panic/oops message but not in PRSTATUS, that's C[0,2,3,4]. Including the debug registers might be handy too. If there was some standard extended PRSTATUS note format for these extra things we could use that would be even better but I don't know of one (but then I don't really know about these things ;-)).
You also store dom0's pfn_to_mfn_frame_list_list in a Xen specific note. What is that used for? Given a Xen symbol table it should be possible to locate the shared info for any domain via the xen mappings and hence find the p2m table that way. m2p is at a known virtual address already.
The contents of the h/v taint bitmap would be another interesting thing to include in the Xen note.
Cheers,
Ian.
Hi Ian,
[Added Dave Anderson to the CC list]
Thanks for the comments!
Quoted 13 lines · Ian Campbell
Hi Magnus,
Quoted 6 lines · Magnus Damm
Here comes a new version of the Kexec / Kdump patches for x86 Xen. Not much has changed since last release, just a minor fix for kdump on
x86_64.Patches to make kexec-tools Xen aware have recently been sent to the fastboot list. These patches will be merged in the kexec-tools-testing tree in the near future.
I've taken these patches out for a spin. They look pretty good. I've got a couple of comments.
Quoted 7 lines
Firstly the patches break native kernel compile. You add usages of
kexec_page_to_pfn()and friends tokernel/kexec.cbut only includekexec-xen.hifdefCONFIG_XEN. I fixed it with by removing the ifdef but the preferred way would be to move the native definitions of kexec_* intoinclude/asm-i386/kexec.hand make a xen specific copy ininclude/asm-i386/mach-xen/asm/kexec.hwith the xen versions patched in. Alternatively you could just mergekexec-xen.hintokexec.h.
Sorry about the breakage. I'd like to stay away from duplicating files so I think merging kexec-xen.h into kexec.h sounds good. I plan to add the common non-xen version of the page macros to include/linux/kexec.h and add the xen-specific macros to the per-architecture include/asm/kexec.h.
I'll include a fix in the patchset that I'll send later this week.
Quoted 4 lines
My second comment is WRT to the ELF notes which you add to the kdump. You include a standard PRSTATUS core ELF note per physical CPU but there is some useful physical processor state which is not included in this structure -- most importantly CR3.
This structure is used both for regular Linux kdumps and core dumps so it felt natural to extend it to the Xen case as well. I do however agree with you that it is strange that only certain registers are saved and many system-level processor registers are unsaved.
I've discussed this with Dave Anderson, and he needed CR3 to be able to locate certain mapping tables used for converting between pseudo-physical and machine addresses.
http://www.mail-archive.com/[email protected]/msg00201.html
Quoted 8 lines
Since the amount of physical CPU state which is not already included in PRSTATUS is pretty small I think you could just include the whole lot in a Xen specific note per PCPU. I'd basically include anything which is in a Xen panic/oops message but not in PRSTATUS, that's C[0,2,3,4]. Including the debug registers might be handy too. If there was some standard extended PRSTATUS note format for these extra things we could use that would be even better but I don't know of one (but then I don't really know about these things ;-)).
I'm unfortunately not aware of any standard format.
The current Xen specific note is only written once and it is used to give system-wide information, ie not per cpu information. So maybe it makes sense to create a new per-cpu note for system-level register information?
Quoted 4 lines
You also store dom0's
pfn_to_mfn_frame_list_listin a Xen specific note. What is that used for? Given a Xen symbol table it should be possible to locate the shared info for any domain via the xen mappings and hence find the p2m table that way. m2p is at a known virtual address already.
This is because Dave wanted to be able to parse dom0 kernels easily. I'm not sure if that is the case still with the new xencrash code? Dave, are you listening?
I thought that pointing out pfn_to_mfn_frame_list_list for dom0 was a better, more portable way to provide Dave with this info than just handing out CR3.
Quoted 2 lines
The contents of the h/v taint bitmap would be another interesting thing to include in the Xen note.
This sounds like system-wide information, not per-cpu right?
Thanks,
/ magnus
Quoted 10 lines · Magnus Damm
Quoted 1 line · Ian Campbell
Firstly the patches break native kernel compile. [snip]
Sorry about the breakage. I'd like to stay away from duplicating files so I think merging
kexec-xen.hintokexec.hsounds good. I plan to add the common non-xen version of the page macros toinclude/linux/kexec.hand add the xen-specific macros to the per-architectureinclude/asm/kexec.h.I'll include a fix in the patchset that I'll send later this week.
Great, thanks.
Quoted 7 lines
Quoted 4 lines
My second comment is WRT to the ELF notes which you add to the kdump. You include a standard PRSTATUS core ELF note per physical CPU but there is some useful physical processor state which is not included in this structure -- most importantly CR3.
This structure is used both for regular Linux kdumps and core dumps so it felt natural to extend it to the Xen case as well.
Definitely.
Quoted 3 lines
I do however
agree with you that it is strange that only certain registers are saved and many system-level processor registers are unsaved.
I can see why they were not included since they aren't really useful in the normal core dump case. Perhaps it is worth talking to the native kdump people about defining a new core note type which includes the extended processor state that isn't in the regular core note?
We can go with a Xen specific one for now and transition to a common one later if necessary.
Quoted 4 lines
The current Xen specific note is only written once and it is used to give system-wide information, ie not per cpu information. So maybe it makes sense to create a new per-cpu note for system-level register information?
That makes sense to me.
Could you also #define the note types in a header somewhere. Perhaps xen/include/public/kexec.h or xen/include/public/elfnote.h?
Quoted 5 lines
Quoted 4 lines
You also store dom0's
pfn_to_mfn_frame_list_listin a Xen specific note. What is that used for? Given a Xen symbol table it should be possible to locate the shared info for any domain via the xen mappings and hence find the p2m table that way. m2p is at a known virtual address already.
Quoted 7 lines
This is because Dave wanted to be able to parse dom0 kernels easily. I'm not sure if that is the case still with the new xencrash code? Dave, are you listening?
I thought that pointing out
pfn_to_mfn_frame_list_listfor dom0 was a better, more portable way to provide Dave with this info than just handing out CR3.
Unless you provide this list for all domains[*] the CR3 method will have to be implemented anyway so domains != 0 can be examined. In particular it could be useful to examine the domain which made the hypercall which led to a crash and that might not necessarily be dom0 (although I suppose it is most likely).
[*]If I understand correctly saving per domain information is not possible because the notes need to be created when the kdump kernel is loaded and the number of domains is unknown at that time.
Quoted 4 lines
Quoted 2 lines
The contents of the h/v taint bitmap would be another interesting thing to include in the Xen note.
This sounds like system-wide information, not per-cpu right?
Yep.
Cheers,
Ian.
Quoted 9 lines · Ian Campbell
Quoted 3 lines · Magnus Damm
I do however
agree with you that it is strange that only certain registers are saved and many system-level processor registers are unsaved.I can see why they were not included since they aren't really useful in the normal core dump case. Perhaps it is worth talking to the native kdump people about defining a new core note type which includes the extended processor state that isn't in the regular core note?
That sounds like a good idea, at least in theory. The number of patches-per-year accepted for the kexec kernel code is unfortunately pretty low...
Quoted 2 lines
We can go with a Xen specific one for now and transition to a common one later if necessary.
I think that is better solution, at least for now.
Quoted 9 lines
Quoted 4 lines
The current Xen specific note is only written once and it is used to give system-wide information, ie not per cpu information. So maybe it makes sense to create a new per-cpu note for system-level register information?
That makes sense to me.
Could you also #define the note types in a header somewhere. Perhaps
xen/include/public/kexec.horxen/include/public/elfnote.h?
Do you mean the data structures or the type value used in the elf note header? Part of the data structures are currently dragging in architecture-specific stuff, so I'm not that tempted... The tools that use the data structures duplicate them anyhow, but maybe it's a good idea.
Quoted 13 lines
Quoted 5 lines
Quoted 4 lines
You also store dom0's
pfn_to_mfn_frame_list_listin a Xen specific note. What is that used for? Given a Xen symbol table it should be possible to locate the shared info for any domain via the xen mappings and hence find the p2m table that way. m2p is at a known virtual address already.Quoted 7 lines
This is because Dave wanted to be able to parse dom0 kernels easily. I'm not sure if that is the case still with the new xencrash code? Dave, are you listening?
I thought that pointing out
pfn_to_mfn_frame_list_listfor dom0 was a better, more portable way to provide Dave with this info than just handing out CR3.
Quoted 5 lines
Unless you provide this list for all domains[*] the CR3 method will have to be implemented anyway so domains != 0 can be examined. In particular it could be useful to examine the domain which made the hypercall which led to a crash and that might not necessarily be dom0 (although I suppose it is most likely).
This was just to make it easy to support dom0 only. Extracting other domains are done through backtracking of symbols and data structures which is independent of elf notes.
Quoted 3 lines
[*]If I understand correctly saving per domain information is not possible because the notes need to be created when the kdump kernel is loaded and the number of domains is unknown at that time.
Correct!
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
The contents of the h/v taint bitmap would be another interesting thing to include in the Xen note.
This sounds like system-wide information, not per-cpu right?
I've added that one now. Thanks!
/ magnus
Quoted 11 lines · Magnus Damm
Quoted 9 lines · Ian Campbell
Quoted 3 lines · Magnus Damm
I do however
agree with you that it is strange that only certain registers are saved and many system-level processor registers are unsaved.I can see why they were not included since they aren't really useful in the normal core dump case. Perhaps it is worth talking to the native kdump people about defining a new core note type which includes the extended processor state that isn't in the regular core note?
Quoted 8 lines
That sounds like a good idea, at least in theory. The number of patches-per-year accepted for the kexec kernel code is unfortunately pretty low...
Quoted 2 lines
We can go with a Xen specific one for now and transition to a common one later if necessary.
I think that is better solution, at least for now.
OK.
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
The current Xen specific note is only written once and it is used to give system-wide information, ie not per cpu information. So maybe it makes sense to create a new per-cpu note for system-level register information?
That makes sense to me.
Quoted 8 lines
Quoted 2 lines
Could you also #define the note types in a header somewhere. Perhaps
xen/include/public/kexec.horxen/include/public/elfnote.h?Do you mean the data structures or the type value used in the elf note header? Part of the data structures are currently dragging in architecture-specific stuff, so I'm not that tempted... The tools that use the data structures duplicate them anyhow, but maybe it's a good idea.
I was talking about the note type values but now that you mention it the data structures would be good too ;-) I think it's useful to have shared types & data structures defined in a shared location to avoid confusion.
It's something we can deal with some other time though.
Quoted 10 lines
Quoted 9 lines
Quoted 3 lines
I thought that pointing out
pfn_to_mfn_frame_list_listfor dom0 was a better, more portable way to provide Dave with this info than just handing out CR3.Unless you provide this list for all domains[*] the CR3 method will have to be implemented anyway so domains != 0 can be examined. In particular it could be useful to examine the domain which made the hypercall which led to a crash and that might not necessarily be dom0 (although I suppose it is most likely).
Quoted 3 lines
This was just to make it easy to support dom0 only. Extracting other domains are done through backtracking of symbols and data structures which is independent of elf notes.
It seems to me that once backtracking code exists (it already does?) it can be used for dom0 too and the field becomes unnecessary.
Anyway, I don't feel that strongly about it and it's only one extra field so leave it in if you think it is useful.
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
The contents of the h/v taint bitmap would be another interesting thing to include in the Xen note.
This sounds like system-wide information, not per-cpu right?
I've added that one now. Thanks!
Cheers.
Ian.
Quoted 46 lines · Magnus Damm
Hi Ian,
[Added Dave Anderson to the CC list]
Thanks for the comments!
Quoted 13 lines · Ian Campbell
Hi Magnus,
Quoted 6 lines · Magnus Damm
Here comes a new version of the Kexec / Kdump patches for x86 Xen. Not much has changed since last release, just a minor fix for kdump on
x86_64.Patches to make kexec-tools Xen aware have recently been sent to the fastboot list. These patches will be merged in the kexec-tools-testing tree in the near future.
I've taken these patches out for a spin. They look pretty good. I've got a couple of comments.
Quoted 7 lines
Firstly the patches break native kernel compile. You add usages of
kexec_page_to_pfn()and friends tokernel/kexec.cbut only includekexec-xen.hifdefCONFIG_XEN. I fixed it with by removing the ifdef but the preferred way would be to move the native definitions of kexec_* intoinclude/asm-i386/kexec.hand make a xen specific copy ininclude/asm-i386/mach-xen/asm/kexec.hwith the xen versions patched in. Alternatively you could just mergekexec-xen.hintokexec.h.Sorry about the breakage. I'd like to stay away from duplicating files so I think merging
kexec-xen.hintokexec.hsounds good. I plan to add the common non-xen version of the page macros toinclude/linux/kexec.hand add the xen-specific macros to the per-architectureinclude/asm/kexec.h.I'll include a fix in the patchset that I'll send later this week.
Quoted 4 lines
My second comment is WRT to the ELF notes which you add to the kdump. You include a standard PRSTATUS core ELF note per physical CPU but there is some useful physical processor state which is not included in this structure -- most importantly CR3.
This structure is used both for regular Linux kdumps and core dumps so it felt natural to extend it to the Xen case as well. I do however agree with you that it is strange that only certain registers are saved and many system-level processor registers are unsaved.
Quoted 6 lines
I've discussed this with Dave Anderson, and he needed CR3 to be able to locate certain mapping tables used for converting between pseudo-physical and machine addresses.
The discussion boiled down to this:
If we want to be able to analyze the vmcore file from the dom0's kernel perspective with the crash utility, we need some manner of being able to recreate the dom0 kernel's phys_to_machine_mapping array. In an older prototype, a dom0 CR3 value was passed in an ELF note, hence the essentially obsolete note name "NT_XEN_KDUMP_CR3". In subsequent discussions, it was agreed that the pfn_to_mfn_frame_list_list value was preferable to a dom0 CR3 value.
Quoted 22 lines
Quoted 9 lines
Since the amount of physical CPU state which is not already included in PRSTATUS is pretty small I think you could just include the whole lot in a Xen specific note per PCPU. I'd basically include anything which is in a Xen panic/oops message but not in PRSTATUS, that's C[0,2,3,4]. Including the debug registers might be handy too. If there was some standard extended PRSTATUS note format for these extra things we could use that would be even better but I don't know of one (but then I don't really know about these things ;-)).
I'm unfortunately not aware of any standard format.
The current Xen specific note is only written once and it is used to give system-wide information, ie not per cpu information. So maybe it makes sense to create a new per-cpu note for system-level register information?
Quoted 4 lines
You also store dom0's
pfn_to_mfn_frame_list_listin a Xen specific note. What is that used for? Given a Xen symbol table it should be possible to locate the shared info for any domain via the xen mappings and hence find the p2m table that way. m2p is at a known virtual address already.
Quoted 8 lines
This is because Dave wanted to be able to parse dom0 kernels easily. I'm not sure if that is the case still with the new xencrash code? Dave, are you listening?
I thought that pointing out
pfn_to_mfn_frame_list_listfor dom0 was a better, more portable way to provide Dave with this info than just handing out CR3.
That's correct. With this simple additional note, it will be possible to do any of the following:
$ crash vmlinux vmcore (with the NT_XEN_KDUMP_CR3 note) $ crash xen-syms vmcore (with the new "xencrash" patch) $ gdb xen-syms vmcore
I had originally suggested an array of pfn_to_mfn_frame_list_list values, one for each guest domain, in which case you could execute crash sessions for dom0 or any of the guest domains.
And now with the new xencrash patch, the crash utility can also be run against the xen-syms binary, which means that the session will be run from the perspective of the hypervisor binary, i.e., with its own set of hypervisor-specific commands.
Anyway, we compromised on just the dom0 pfn_to_mfn_frame_list_list value, given that in the majority of dom0/hypervisor crashes, the cause of the crash will most likely be in the dom0 kernel code.
Dave
Quoted 17 lines · Dave Anderson
Quoted 4 lines · Magnus Damm
I thought that pointing out
pfn_to_mfn_frame_list_listfor dom0 was a better, more portable way to provide Dave with this info than just handing out CR3.That's correct. With this simple additional note, it will be possible to do any of the following:
$ crash vmlinux vmcore (with the NT_XEN_KDUMP_CR3 note) $ crash xen-syms vmcore (with the new "xencrash" patch) $ gdb xen-syms vmcoreI had originally suggested an array of
pfn_to_mfn_frame_list_listvalues, one for each guest domain, in which case you could execute crash sessions for dom0 or any of the guest domains.
Quoted 8 lines
And now with the new xencrash patch, the crash utility can also be run against the xen-syms binary, which means that the session will be run from the perspective of the hypervisor binary, i.e., with its own set of hypervisor-specific commands.
Anyway, we compromised on just the dom0
pfn_to_mfn_frame_list_listvalue, given that in the majority of dom0/hypervisor crashes, the cause of the crash will most likely be in the dom0 kernel code.
Thanks for the comments! The value for NT_XEN_KDUMP_CR3, do you have any strong feelings to keep that? We have an unique string now, so I'm tempted to just set it to 0...
/ magnus
Quoted 23 lines · Magnus Damm
Quoted 22 lines · Dave Anderson
Quoted 4 lines · Magnus Damm
I thought that pointing out
pfn_to_mfn_frame_list_listfor dom0 was a better, more portable way to provide Dave with this info than just handing out CR3.That's correct. With this simple additional note, it will be possible to do any of the following:
$ crash vmlinux vmcore (with the NT_XEN_KDUMP_CR3 note) $ crash xen-syms vmcore (with the new "xencrash" patch) $ gdb xen-syms vmcoreI had originally suggested an array of
pfn_to_mfn_frame_list_listvalues, one for each guest domain, in which case you could execute crash sessions for dom0 or any of the guest domains.And now with the new xencrash patch, the crash utility can also be run against the xen-syms binary, which means that the session will be run from the perspective of the hypervisor binary, i.e., with its own set of hypervisor-specific commands.
Quoted 8 lines
Quoted 3 lines
Anyway, we compromised on just the dom0
pfn_to_mfn_frame_list_listvalue, given that in the majority of dom0/hypervisor crashes, the cause of the crash will most likely be in the dom0 kernel code.Thanks for the comments! The value for
NT_XEN_KDUMP_CR3, do you have any strong feelings to keep that? We have an unique string now, so I'm tempted to just set it to 0...
Obviously as long as it doesn't clash with the NT_XXX type #define's in elf.h, it's OK. For diskdump vmcores, they created an un-clashable NT_DISKDUMP type value of 0x70000001, and so the use of 0x10000001 for NT_XEN_KDUMP_CR3 apparently followed that model. But, since you're asking, I don't particularly like the use of 0; it just seems too ambiguous.
Dave
Quoted 34 lines · Dave Anderson
Quoted 23 lines · Magnus Damm
Quoted 22 lines · Dave Anderson
Quoted 4 lines · Magnus Damm
I thought that pointing out
pfn_to_mfn_frame_list_listfor dom0 was a better, more portable way to provide Dave with this info than just handing out CR3.That's correct. With this simple additional note, it will be possible to do any of the following:
$ crash vmlinux vmcore (with the NT_XEN_KDUMP_CR3 note) $ crash xen-syms vmcore (with the new "xencrash" patch) $ gdb xen-syms vmcoreI had originally suggested an array of
pfn_to_mfn_frame_list_listvalues, one for each guest domain, in which case you could execute crash sessions for dom0 or any of the guest domains.And now with the new xencrash patch, the crash utility can also be run against the xen-syms binary, which means that the session will be run from the perspective of the hypervisor binary, i.e., with its own set of hypervisor-specific commands.
Quoted 8 lines
Quoted 3 lines
Anyway, we compromised on just the dom0
pfn_to_mfn_frame_list_listvalue, given that in the majority of dom0/hypervisor crashes, the cause of the crash will most likely be in the dom0 kernel code.Thanks for the comments! The value for
NT_XEN_KDUMP_CR3, do you have any strong feelings to keep that? We have an unique string now, so I'm tempted to just set it to 0...
Quoted 5 lines
Obviously as long as it doesn't clash with the
NT_XXXtype #define's inelf.h, it's OK. For diskdump vmcores, they created an un-clashableNT_DISKDUMPtype value of0x70000001, and so the use of0x10000001forNT_XEN_KDUMP_CR3apparently followed that model. But, since you're asking, I don't particularly like the use of 0; it just seems too ambiguous.
Hm... But doesn't both the string and the type together form an unique identifier?
I think the "CORE" string together with the NT_PRSTATUS type point out a structure of type ELF_Prstatus. In the case of our Xen specific notes we use "XEN CORE" as string and therefore are free to use any type because we are already "unique enough" with our string. So I was kind of questioning having both an unique string and on top of that an unique type.
Thanks,
/ magnus
Quoted 35 lines · Magnus Damm
Quoted 34 lines · Dave Anderson
Quoted 31 lines · Magnus Damm
Quoted 17 lines · Dave Anderson
Quoted 4 lines · Magnus Damm
I thought that pointing out
pfn_to_mfn_frame_list_listfor dom0 was a better, more portable way to provide Dave with this info than just handing out CR3.That's correct. With this simple additional note, it will be possible to do any of the following:
$ crash vmlinux vmcore (with the NT_XEN_KDUMP_CR3 note) $ crash xen-syms vmcore (with the new "xencrash" patch) $ gdb xen-syms vmcoreI had originally suggested an array of
pfn_to_mfn_frame_list_listvalues, one for each guest domain, in which case you could execute crash sessions for dom0 or any of the guest domains.Quoted 8 lines
And now with the new xencrash patch, the crash utility can also be run against the xen-syms binary, which means that the session will be run from the perspective of the hypervisor binary, i.e., with its own set of hypervisor-specific commands.
Anyway, we compromised on just the dom0
pfn_to_mfn_frame_list_listvalue, given that in the majority of dom0/hypervisor crashes, the cause of the crash will most likely be in the dom0 kernel code.Thanks for the comments! The value for
NT_XEN_KDUMP_CR3, do you have any strong feelings to keep that? We have an unique string now, so I'm tempted to just set it to 0...
Quoted 8 lines
Quoted 5 lines
Obviously as long as it doesn't clash with the
NT_XXXtype #define's inelf.h, it's OK. For diskdump vmcores, they created an un-clashableNT_DISKDUMPtype value of0x70000001, and so the use of0x10000001forNT_XEN_KDUMP_CR3apparently followed that model. But, since you're asking, I don't particularly like the use of 0; it just seems too ambiguous.Hm... But doesn't both the string and the type together form an unique identifier?
That's correct. The type of a note only has to be unique vs notes with the same name field. So since the Xen notes have name "XEN CORE" they can't clash with the notes in elf.h which have name "CORE".
If you wanted to you could use a bit of the existing "Xen" namespace. It is currently only used by notes which are consumed by the domain builder. They are defined in xen/include/public/elfnote.h.
Ian.
Quoted 45 lines · Ian Campbell
Quoted 35 lines · Magnus Damm
Quoted 34 lines · Dave Anderson
Quoted 31 lines · Magnus Damm
Quoted 17 lines · Dave Anderson
Quoted 4 lines · Magnus Damm
I thought that pointing out
pfn_to_mfn_frame_list_listfor dom0 was a better, more portable way to provide Dave with this info than just handing out CR3.That's correct. With this simple additional note, it will be possible to do any of the following:
$ crash vmlinux vmcore (with the NT_XEN_KDUMP_CR3 note) $ crash xen-syms vmcore (with the new "xencrash" patch) $ gdb xen-syms vmcoreI had originally suggested an array of
pfn_to_mfn_frame_list_listvalues, one for each guest domain, in which case you could execute crash sessions for dom0 or any of the guest domains.Quoted 8 lines
And now with the new xencrash patch, the crash utility can also be run against the xen-syms binary, which means that the session will be run from the perspective of the hypervisor binary, i.e., with its own set of hypervisor-specific commands.
Anyway, we compromised on just the dom0
pfn_to_mfn_frame_list_listvalue, given that in the majority of dom0/hypervisor crashes, the cause of the crash will most likely be in the dom0 kernel code.Thanks for the comments! The value for
NT_XEN_KDUMP_CR3, do you have any strong feelings to keep that? We have an unique string now, so I'm tempted to just set it to 0...Quoted 8 lines
Quoted 5 lines
Obviously as long as it doesn't clash with the
NT_XXXtype #define's inelf.h, it's OK. For diskdump vmcores, they created an un-clashableNT_DISKDUMPtype value of0x70000001, and so the use of0x10000001forNT_XEN_KDUMP_CR3apparently followed that model. But, since you're asking, I don't particularly like the use of 0; it just seems too ambiguous.Hm... But doesn't both the string and the type together form an unique identifier?
Quoted 7 lines
That's correct. The type of a note only has to be unique vs notes with the same name field. So since the Xen notes have name "XEN CORE" they can't clash with the notes in
elf.hwhich have name "CORE".If you wanted to you could use a bit of the existing "Xen" namespace. It is currently only used by notes which are consumed by the domain builder. They are defined in
xen/include/public/elfnote.h.
Sounds like a good idea. What about:
#define XEN_ELFNOTE_CRASH_INFO 13 /* system information */ #define XEN_ELFNOTE_CRASH_REGS 14 /* per-cpu system registers */
The types will map to data structures instead of single numeric values or strings though, but maybe that is ok.
Thanks,
/ magnus
Quoted 8 lines · Magnus Damm
Quoted 3 lines
If you wanted to you could use a bit of the existing "Xen" namespace. It is currently only used by notes which are consumed by the domain builder. They are defined in
xen/include/public/elfnote.h.Sounds like a good idea. What about:
#define
XEN_ELFNOTE_CRASH_INFO13 /* system information */ #defineXEN_ELFNOTE_CRASH_REGS14 /* per-cpu system registers */
Perhaps use 0x1000001 and 0x1000002 to distinguish the types of notes?
(we could rewrite the existing notes as 0x0000000x to make this clearer)
Quoted 2 lines
The types will map to data structures instead of single numeric values or strings though, but maybe that is ok.
That's fine. Ultimately I'd like to get the data structures in there too but don't worry about that for now.
Ian.
Hi Magnus,
Quoted 1 line · Magnus Damm
[PATCH 00/04] Kexec / Kdump: Release 20061122 (xen-unstable-12502)
I've been playing a bit more and found a problem.
You define a per CPU variable crash_notes and on crash you loop over NR_CPUS and clear the notes for CPUS which don't exist. Unfortunately the percpu regions for CPUs which aren't physically present is returned to the heap on boot (see percpu_free_unused_areas) -- this means that you zero out heap pages on crash :-(
You need to use num_{possible,present,online}_cpus() in machine_crash_kexec() and kexec_get_cpu() instead of NR_CPUS.
Cheers,
Ian.
Quoted 8 lines · Ian Campbell
You define a per CPU variable
crash_notesand on crash you loop overNR_CPUSand clear the notes for CPUS which don't exist. Unfortunately the percpu regions for CPUs which aren't physically present is returned to the heap on boot (seepercpu_free_unused_areas) -- this means that you zero out heap pages on crash :-(You need to use num_{possible,present,online}_cpus() in
machine_crash_kexec()andkexec_get_cpu()instead ofNR_CPUS.
You should use for_each_cpu, for_each_present_cpu, or for_each_online_cpu. Probably the last of those unless you care about dormant CPUs or hotplugged CPU sockets. :-)
-- Keir
Hi Ian,
Quoted 10 lines · Ian Campbell
Quoted 1 line · Magnus Damm
[PATCH 00/04] Kexec / Kdump: Release 20061122 (xen-unstable-12502)
I've been playing a bit more and found a problem.
You define a per CPU variable
crash_notesand on crash you loop overNR_CPUSand clear the notes for CPUS which don't exist. Unfortunately the percpu regions for CPUs which aren't physically present is returned to the heap on boot (seepercpu_free_unused_areas) -- this means that you zero out heap pages on crash :-(
Ouch. Let's not do that then. =) I wondered why the data areas were something else than just zero...
We need unique data areas for each cpu, online or not, and these areas should be zero if the cpus don't exist. This is because we export the machine address and size of each note to dom0 which in turn exports the ranges through /proc/iomem to user space.
In user space the kexec-tool then builds an elf header which points out where the notes are located in machine address space (using /proc/iomem). This header is then passed on to the secondary crash kernel which (for some reason) compacts all per-cpu PT_NOTE program headers into one which will be present in the final vmcore image. At this compacting stage we need to have data present for _all_ cpus, and the data for cpus that are not present should contain just zeros.
This scheme should work for cpu hotplug as well.
Quoted 2 lines
You need to use num_{possible,present,online}_cpus() in
machine_crash_kexec()andkexec_get_cpu()instead ofNR_CPUS.
But wouldn't that leave us with machine address in /proc/iomem that point out heap data instead of notes? I think that using and array in bss is a simple and good solution:
crash_note_t crash_notes[NR_CPUS];
How does that sound? WIth a comment why we are not using per-cpu data of course.
Thanks for reviewing!
/ magnus
Quoted 7 lines · Magnus Damm
In user space the kexec-tool then builds an elf header which points out where the notes are located in machine address space (using
/proc/iomem). This header is then passed on to the secondary crash kernel which (for some reason) compacts all per-cpuPT_NOTEprogram headers into one which will be present in the final vmcore image. At this compacting stage we need to have data present for _all_ cpus, and the data for cpus that are not present should contain just zeros.
How does kexec discover how many cpus is 'all cpus'?
-- Keir
Quoted 10 lines · Keir Fraser
Quoted 7 lines · Magnus Damm
In user space the kexec-tool then builds an elf header which points out where the notes are located in machine address space (using
/proc/iomem). This header is then passed on to the secondary crash kernel which (for some reason) compacts all per-cpuPT_NOTEprogram headers into one which will be present in the final vmcore image. At this compacting stage we need to have data present for _all_ cpus, and the data for cpus that are not present should contain just zeros.How does kexec discover how many cpus is 'all cpus'?
The kexec tool creates (at load time) one PT_NOTE program header per note exported through /proc/iomem. The number of PT_NOTE program headers is the same as the NR_CPUS constant in the hypervisor.
The seconday kernel is not aware of how many cpus that was used by the first kernel, it only expects to find valid data pointed out by the PT_NOTE program headers. Valid data in this case is either ELF note formatted data or zeroed memory which happens to be valid end-of-notes ELF note data as well.
So giving the secondary kernel a pointer to heap does not work very well. =)
/ magnus
Quoted 10 lines · Magnus Damm
Quoted 9 lines · Keir Fraser
Quoted 7 lines · Magnus Damm
In user space the kexec-tool then builds an elf header which points out where the notes are located in machine address space (using
/proc/iomem). This header is then passed on to the secondary crash kernel which (for some reason) compacts all per-cpuPT_NOTEprogram headers into one which will be present in the final vmcore image. At this compacting stage we need to have data present for _all_ cpus, and the data for cpus that are not present should contain just zeros.
Quoted 5 lines
Quoted 1 line
How does kexec discover how many cpus is 'all cpus'?
The kexec tool creates (at load time) one
PT_NOTEprogram header per note exported through/proc/iomem. The number ofPT_NOTEprogram headers is the same as theNR_CPUSconstant in the hypervisor.
The guest kernel creates entries in /proc/iomem by calling kexec_get_cpu(cpu) until it returns EINVAL. This currently happens when cpu>NR_CPUS.
I think this function should return EINVAL for cpu>num_present_cpus() instead. Xen doesn't currently do PCPU hotplug and this wouldn't be the only thing that would need fixing if it ever does (percpu data would be another one I think ;-)).
This would cause the tools to create notes only for CPUs which really exist. That would make the loop in machine_crash_kexec() unnecessary.
Cheers,
Ian.
Quoted 10 lines · Ian Campbell
Quoted 4 lines · Magnus Damm
The kexec tool creates (at load time) one
PT_NOTEprogram header per note exported through/proc/iomem. The number ofPT_NOTEprogram headers is the same as theNR_CPUSconstant in the hypervisor.The guest kernel creates entries in
/proc/iomemby callingkexec_get_cpu(cpu)until it returns EINVAL. This currently happens when cpu>NR_CPUS.
Quoted 7 lines
I think this function should return EINVAL for cpu>num_present_cpus() instead. Xen doesn't currently do PCPU hotplug and this wouldn't be the only thing that would need fixing if it ever does (percpu data would be another one I think ;-)).
This would cause the tools to create notes only for CPUs which really exist. That would make the loop in
machine_crash_kexec()unnecessary.
I feel that using bss instead of per-cpu data is more robust and will make future cpu hotplug support a breeze to implement - at least in the case of kexec. Using bss also makes the loop in machine_crash_kexec() unnecessary.
Using num_present_cpus() will of course work as well, but I'd like to avoid adding code that likely needs to be rewritten in the near future.. But you know the future better than I do, so what do you think? =)
Thanks!
/ magnus
Quoted 24 lines · Magnus Damm
Quoted 10 lines · Ian Campbell
Quoted 4 lines · Magnus Damm
The kexec tool creates (at load time) one
PT_NOTEprogram header per note exported through/proc/iomem. The number ofPT_NOTEprogram headers is the same as theNR_CPUSconstant in the hypervisor.The guest kernel creates entries in
/proc/iomemby callingkexec_get_cpu(cpu)until it returns EINVAL. This currently happens when cpu>NR_CPUS.Quoted 7 lines
I think this function should return EINVAL for cpu>num_present_cpus() instead. Xen doesn't currently do PCPU hotplug and this wouldn't be the only thing that would need fixing if it ever does (percpu data would be another one I think ;-)).
This would cause the tools to create notes only for CPUs which really exist. That would make the loop in
machine_crash_kexec()unnecessary.I feel that using bss instead of per-cpu data is more robust and will make future cpu hotplug support a breeze to implement - at least in the case of kexec. Using bss also makes the loop in
machine_crash_kexec()unnecessary.
Quoted 4 lines
Using
num_present_cpus()will of course work as well, but I'd like to avoid adding code that likely needs to be rewritten in the near future.. But you know the future better than I do, so what do you think? =)
I don't think anyone is planning PCPU hotplug anytime soon (I've not even heard rumours about the distant future ;-)). I do think that using the existing infrastructure is the right way to go though rather than open coding a different per cpu mechanism to solve a problem which doesn't currently exist. If someone implements PCPU hotplug they will no doubt need to update the per cpu infrastructure and if kdump is using it then it can be taken into consideration at that time.
Cheers,
Ian.