kexec: extended kexec hypercall for use with pv-ops kernels
Subsystems (2)
cover kexec: extended kexec hypercall for use with pv-ops kernels
The series improves the kexec hypercall by making Xen responsible for loading and relocating the image. This allows kexec to be usable by pv-ops kernels and should allow kexec to be usable from a HVM or PVH privileged domain.
The first patch is a simple clean-up.
The second patch allows hypercall structures to be ABI compatible between 32- and 64-bit guests (by reusing stuff present for domctls and sysctls). This seems better than having to keep adding compat handling for new hypercalls etc.
Patch 3 introduces the new ABI.
Patch 4 and 5 nearly completely reimplement the kexec load, unload and exec sub-ops. The old load_v1 sub-op is then implemented on top of the new code.
Patch 6 calls the kexec image when dom0 crashes. This avoids having to alter dom0 kernels to do a exec sub-op call on crash -- an existing SHUTDOWN_crash.
Patches 7 and 8 add the libxc API for the kexec calls.
The required patch series for kexec-tools will be posted shortly.
David
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
PATCH 1/8 x86: give FIX_EFI_MPF its own fixmap entry
From: David Vrabel <[email protected]>
FIX_EFI_MPF was the same as FIX_KEXEC_BASE_0 which is going away. So add its own entry.
--- xen/arch/x86/mpparse.c | 2 -- xen/include/asm-x86/fixmap.h | 1 + 2 files changed, 1 insertions(+), 2 deletions(-)
xen/arch/x86/mpparse.c +0 -2
@@ -538,8 +538,6 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type) } } -#define FIX_EFI_MPF FIX_KEXEC_BASE_0 -static __init void efi_unmap_mpf (void ) {if (efi_enabled)
xen/include/asm-x86/fixmap.h +1 -0
@@ -71,6 +71,7 @@ enum fixed_addresses {FIX_APEI_RANGE_BASE ,FIX_APEI_RANGE_END =FIX_APEI_RANGE_BASE +FIX_APEI_RANGE_MAX -1 ,FIX_IGD_MMIO , +FIX_EFI_MPF , __end_of_fixed_addresses };
Signature · 1 line
1.7.2.5
PATCH 1/8 x86: give FIX_EFI_MPF its own fixmap entry
In reply to David VrabelFrom: David Vrabel <[email protected]>
FIX_EFI_MPF was the same as FIX_KEXEC_BASE_0 which is going away. So add its own entry.
--- xen/arch/x86/mpparse.c | 2 -- xen/include/asm-x86/fixmap.h | 1 + 2 files changed, 1 insertions(+), 2 deletions(-)
xen/arch/x86/mpparse.c +0 -2
@@ -538,8 +538,6 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type) } } -#define FIX_EFI_MPF FIX_KEXEC_BASE_0 -static __init void efi_unmap_mpf (void ) {if (efi_enabled)
xen/include/asm-x86/fixmap.h +1 -0
@@ -71,6 +71,7 @@ enum fixed_addresses {FIX_APEI_RANGE_BASE ,FIX_APEI_RANGE_END =FIX_APEI_RANGE_BASE +FIX_APEI_RANGE_MAX -1 ,FIX_IGD_MMIO , +FIX_EFI_MPF , __end_of_fixed_addresses };
Signature · 7 lines
1.7.2.5 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 2/8 xen: make GUEST_HANDLE_64() and uint64_aligned_t available everywhere
In reply to David VrabelFrom: David Vrabel <[email protected]>
GUEST_HANDLE_64() and uint64_aligned_t allow hypercall ABI structures to be identical (binary compatible) for 32 and 64-bit guests. They are currently limited to only being available for use in sysctls and domctls. Relax this limit so it may be used by any new structures.
There is a minimal cost for 32-bit guests on 64-but hypervisors as set_guest_handle() needs to 0 the whole field on GUEST_HANDLE_64() handles, but this is expected to be less than the overhead of having to translate compat structures.
--- xen/include/public/arch-x86/xen-x86_32.h | 4 +--- xen/include/public/xen.h | 13 ++++++++----- 2 files changed, 9 insertions(+), 8 deletions(-)
xen/include/public/arch-x86/xen-x86_32.h +1 -3
@@ -91,8 +91,7 @@#define machine_to_phys_mapping ((unsigned long *)MACH2PHYS_VIRT_START)#endif -/* 32-/64-bit invariability for control interfaces (domctl/sysctl). */ -#if defined(__XEN__) || defined(__XEN_TOOLS__) +/* 32-/64-bit invariability. */ #undef ___DEFINE_XEN_GUEST_HANDLE#define ___DEFINE_XEN_GUEST_HANDLE (name, type) \ typedef struct { type *p; } \
@@ -107,7 +106,6 @@#define uint64_aligned_t uint64_t __attribute__((aligned(8)))#define __XEN_GUEST_HANDLE_64 (name) __guest_handle_64_ ## name#define XEN_GUEST_HANDLE_64 (name) __XEN_GUEST_HANDLE_64(name) -#endif #ifndef __ASSEMBLY__
xen/include/public/xen.h +8 -5
@@ -840,9 +840,14 @@ __DEFINE_XEN_GUEST_HANDLE(uint64, uint64_t);#endif /* !__ASSEMBLY__ */ -/* Default definitions for macros used by domctl/sysctl. */ -#if defined(__XEN__) || defined(__XEN_TOOLS__) - +/* +* Default definitions for 32/64-bit invariant macros. +* +* Use these in ABI structures that should be identical for 32 and +* 64-bit guests. There is some (very small) overhead in using +* XEN_GUEST_HANDLE_64() instead of XEN_GUEST_HANDLE() so avoid for +* very hot paths. +*/ #ifndef uint64_aligned_t#define uint64_aligned_t uint64_t#endif
@@ -857,8 +862,6 @@ struct xenctl_cpumap { };#endif -#endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */ -#endif /* __XEN_PUBLIC_XEN_H__ */ /*
Signature · 1 line
1.7.2.5
PATCH 2/8 xen: make GUEST_HANDLE_64() and uint64_aligned_t available everywhere
In reply to David VrabelFrom: David Vrabel <[email protected]>
GUEST_HANDLE_64() and uint64_aligned_t allow hypercall ABI structures to be identical (binary compatible) for 32 and 64-bit guests. They are currently limited to only being available for use in sysctls and domctls. Relax this limit so it may be used by any new structures.
There is a minimal cost for 32-bit guests on 64-but hypervisors as set_guest_handle() needs to 0 the whole field on GUEST_HANDLE_64() handles, but this is expected to be less than the overhead of having to translate compat structures.
--- xen/include/public/arch-x86/xen-x86_32.h | 4 +--- xen/include/public/xen.h | 13 ++++++++----- 2 files changed, 9 insertions(+), 8 deletions(-)
xen/include/public/arch-x86/xen-x86_32.h +1 -3
@@ -91,8 +91,7 @@#define machine_to_phys_mapping ((unsigned long *)MACH2PHYS_VIRT_START)#endif -/* 32-/64-bit invariability for control interfaces (domctl/sysctl). */ -#if defined(__XEN__) || defined(__XEN_TOOLS__) +/* 32-/64-bit invariability. */ #undef ___DEFINE_XEN_GUEST_HANDLE#define ___DEFINE_XEN_GUEST_HANDLE (name, type) \ typedef struct { type *p; } \
@@ -107,7 +106,6 @@#define uint64_aligned_t uint64_t __attribute__((aligned(8)))#define __XEN_GUEST_HANDLE_64 (name) __guest_handle_64_ ## name#define XEN_GUEST_HANDLE_64 (name) __XEN_GUEST_HANDLE_64(name) -#endif #ifndef __ASSEMBLY__
xen/include/public/xen.h +8 -5
@@ -840,9 +840,14 @@ __DEFINE_XEN_GUEST_HANDLE(uint64, uint64_t);#endif /* !__ASSEMBLY__ */ -/* Default definitions for macros used by domctl/sysctl. */ -#if defined(__XEN__) || defined(__XEN_TOOLS__) - +/* +* Default definitions for 32/64-bit invariant macros. +* +* Use these in ABI structures that should be identical for 32 and +* 64-bit guests. There is some (very small) overhead in using +* XEN_GUEST_HANDLE_64() instead of XEN_GUEST_HANDLE() so avoid for +* very hot paths. +*/ #ifndef uint64_aligned_t#define uint64_aligned_t uint64_t#endif
@@ -857,8 +862,6 @@ struct xenctl_cpumap { };#endif -#endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */ -#endif /* __XEN_PUBLIC_XEN_H__ */ /*
Signature · 7 lines
1.7.2.5 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 3/8 kexec: add public interface for improved load/unload sub-ops
In reply to David VrabelFrom: David Vrabel <[email protected]>
Add replacement KEXEC_CMD_load and KEXEC_CMD_unload sub-ops to the kexec hypercall. These new sub-ops allow a priviledged guest to provide the image data to be loaded into Xen memory or the crash region instead of guests loading the image data themselves and providing the relocation code and metadata.
The old interface is provided to guests requesting an interface version prior to 4.3.
Signed-off: David Vrabel <[email protected]>
--- xen/common/kexec.c | 12 ++++---- xen/include/public/kexec.h | 66 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 68 insertions(+), 10 deletions(-)
xen/common/kexec.c +6 -6
@@ -732,7 +732,7 @@ static void crash_save_vmcoreinfo(void)#endif } -static int kexec_load_unload_internal (unsigned long op,xen_kexec_load_t *load) +static int kexec_load_unload_internal (unsigned long op,xen_kexec_load_v1_t *load) {xen_kexec_image_t *image;int base, bit, pos;
@@ -779,7 +779,7 @@ static int kexec_load_unload_internal(unsigned long op, xen_kexec_load_t *load)static int kexec_load_unload (unsigned long op,XEN_GUEST_HANDLE_PARAM (void ) uarg) { -xen_kexec_load_t load; +xen_kexec_load_v1_t load;if (unlikely (copy_from_guest (&load, uarg,1 )) )return -EFAULT ;
@@ -791,8 +791,8 @@ static int kexec_load_unload_compat(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) uarg) {#ifdef CONFIG_COMPAT -compat_kexec_load_t compat_load; -xen_kexec_load_t load; +compat_kexec_load_v1_t compat_load; +xen_kexec_load_v1_t load;if (unlikely (copy_from_guest (&compat_load, uarg,1 )) )return -EFAULT ;
@@ -864,8 +864,8 @@ static int do_kexec_op_internal(unsigned long op,else ret =kexec_get_range (uarg);break ; -case KEXEC_CMD_kexec_load: -case KEXEC_CMD_kexec_unload: +case KEXEC_CMD_kexec_load_v1: +case KEXEC_CMD_kexec_unload_v1:spin_lock_irqsave (&kexec_lock, flags);if (!test_bit (KEXEC_FLAG_IN_PROGRESS , &kexec_flags)) {
xen/include/public/kexec.h +62 -4
80 lines not on this page · raw message
Signature · 1 line
1.7.2.5
PATCH 3/8 kexec: add public interface for improved load/unload sub-ops
In reply to David VrabelFrom: David Vrabel <[email protected]>
Add replacement KEXEC_CMD_load and KEXEC_CMD_unload sub-ops to the kexec hypercall. These new sub-ops allow a priviledged guest to provide the image data to be loaded into Xen memory or the crash region instead of guests loading the image data themselves and providing the relocation code and metadata.
The old interface is provided to guests requesting an interface version prior to 4.3.
Signed-off: David Vrabel <[email protected]>
--- xen/common/kexec.c | 12 ++++---- xen/include/public/kexec.h | 66 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 68 insertions(+), 10 deletions(-)
xen/common/kexec.c +6 -6
@@ -732,7 +732,7 @@ static void crash_save_vmcoreinfo(void)#endif } -static int kexec_load_unload_internal (unsigned long op,xen_kexec_load_t *load) +static int kexec_load_unload_internal (unsigned long op,xen_kexec_load_v1_t *load) {xen_kexec_image_t *image;int base, bit, pos;
@@ -779,7 +779,7 @@ static int kexec_load_unload_internal(unsigned long op, xen_kexec_load_t *load)static int kexec_load_unload (unsigned long op,XEN_GUEST_HANDLE_PARAM (void ) uarg) { -xen_kexec_load_t load; +xen_kexec_load_v1_t load;if (unlikely (copy_from_guest (&load, uarg,1 )) )return -EFAULT ;
@@ -791,8 +791,8 @@ static int kexec_load_unload_compat(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) uarg) {#ifdef CONFIG_COMPAT -compat_kexec_load_t compat_load; -xen_kexec_load_t load; +compat_kexec_load_v1_t compat_load; +xen_kexec_load_v1_t load;if (unlikely (copy_from_guest (&compat_load, uarg,1 )) )return -EFAULT ;
@@ -864,8 +864,8 @@ static int do_kexec_op_internal(unsigned long op,else ret =kexec_get_range (uarg);break ; -case KEXEC_CMD_kexec_load: -case KEXEC_CMD_kexec_unload: +case KEXEC_CMD_kexec_load_v1: +case KEXEC_CMD_kexec_unload_v1:spin_lock_irqsave (&kexec_lock, flags);if (!test_bit (KEXEC_FLAG_IN_PROGRESS , &kexec_flags)) {
xen/include/public/kexec.h +62 -4
80 lines not on this page · raw message
Signature · 7 lines
1.7.2.5 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 3/8] kexec: add public interface for improved load/unload sub-ops
Quoted 99 lines · David Vrabel
From: David Vrabel <[email protected]>
Add replacement
KEXEC_CMD_loadandKEXEC_CMD_unloadsub-ops to the kexec hypercall. These new sub-ops allow a priviledged guest to provide the image data to be loaded into Xen memory or the crash region instead of guests loading the image data themselves and providing the relocation code and metadata.The old interface is provided to guests requesting an interface version prior to 4.3.
Signed-off: David Vrabel <[email protected]>
--- xen/common/kexec.c | 12 ++++---- xen/include/public/kexec.h | 66 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 68 insertions(+), 10 deletions(-)xen/common/kexec.c +6
-6@@ -732,7 +732,7 @@ static void crash_save_vmcoreinfo(void)#endif } -static int kexec_load_unload_internal (unsigned long op,xen_kexec_load_t *load) +static int kexec_load_unload_internal (unsigned long op,xen_kexec_load_v1_t *load) {xen_kexec_image_t *image;int base, bit, pos;@@ -779,7 +779,7 @@ static int kexec_load_unload_internal(unsigned long op, xen_kexec_load_t *load)static int kexec_load_unload (unsigned long op,XEN_GUEST_HANDLE_PARAM (void ) uarg) { -xen_kexec_load_t load; +xen_kexec_load_v1_t load;if (unlikely (copy_from_guest (&load, uarg,1 )) )return -EFAULT ;@@ -791,8 +791,8 @@ static int kexec_load_unload_compat(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) uarg) {#ifdef CONFIG_COMPAT -compat_kexec_load_t compat_load; -xen_kexec_load_t load; +compat_kexec_load_v1_t compat_load; +xen_kexec_load_v1_t load;if (unlikely (copy_from_guest (&compat_load, uarg,1 )) )return -EFAULT ;@@ -864,8 +864,8 @@ static int do_kexec_op_internal(unsigned long op,else ret =kexec_get_range (uarg);break ; -case KEXEC_CMD_kexec_load: -case KEXEC_CMD_kexec_unload: +case KEXEC_CMD_kexec_load_v1: +case KEXEC_CMD_kexec_unload_v1:spin_lock_irqsave (&kexec_lock, flags);if (!test_bit (KEXEC_FLAG_IN_PROGRESS , &kexec_flags)) {xen/include/public/kexec.h +17
-4@@ -116,12 +116,12 @@ typedef struct xen_kexec_exec {* type == KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH [in] * image == relocation information for kexec (ignored for unload) [in] */ -#define KEXEC_CMD_kexec_load 1 -#define KEXEC_CMD_kexec_unload 2 -typedef struct xen_kexec_load { +#define KEXEC_CMD_kexec_load_v1 1/* obsolete since 0x00040300 */ +#define KEXEC_CMD_kexec_unload_v1 2/* obsolete since 0x00040300 */ +typedef struct xen_kexec_load_v1 {int type;xen_kexec_image_t image; -}xen_kexec_load_t ; +}xen_kexec_load_v1_t ;#define KEXEC_RANGE_MA_CRASH 0/* machine address and size of crash area */ #define KEXEC_RANGE_MA_XEN 1/* machine address and size of Xen itself */ @@ -152,6 +152,64 @@ typedef struct xen_kexec_range {unsigned long start; } xen_kexec_range_t; +#if __XEN_INTERFACE_VERSION__ >=0x00040300 +/* +* A contiguous chunk of a kexec image and it's destination machine +* address. +*/ +typedef struct xen_kexec_segment { +XEN_GUEST_HANDLE_64 (const_void) buf; +uint64_t buf_size; +uint64_t dest_maddr; +uint64_t dest_size; +}xen_kexec_segment_t ; +DEFINE_XEN_GUEST_HANDLE (xen_kexec_segment_t); +
xen/include/public/kexec.h typedef struct xen_kexec_range { · line 177
Quoted 10 lines
xen/include/public/kexec.h +10
-0+/* +* Load a kexec image into memory. +* +* For KEXEC_TYPE_DEFAULT images, the segments may be anywhere in RAM. +* The image is relocated prior to being executed. +* +* For KEXEC_TYPE_CRASH images, each segment of the image must reside +* in the memory region reserved for kexec (KEXEC_RANGE_MA_CRASH) and +* the entry point must be within the image. The caller is responsible +* for ensuring that multiple images do not overlap.
What do you mean by "The caller is responsible for ensuring that multiple images do not overlap."?
xen/include/public/kexec.h typedef struct xen_kexec_range { · line 184
Quoted 7 lines
xen/include/public/kexec.h +7
-0+*/ + +#define KEXEC_CMD_kexec_load 4 +typedef struct xen_kexec_load { + uint8_t type; /* One of KEXEC_TYPE_* */ + uint16_t arch; /* ELF machine type (EM_*). */ + uint32_t __pad;
Why do you need __pad here?
Quoted 13 lines
xen/include/public/kexec.h +13
-0+uint64_t entry_maddr;/* image entry point machine address. */ +uint32_t nr_segments; +XEN_GUEST_HANDLE_64 (xen_kexec_segment_t) segments; +} xen_kexec_load_t; +DEFINE_XEN_GUEST_HANDLE (xen_kexec_load_t); + +/* +* Unload a kexec image. +* +* Type must be one of KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH. +*/ +#define KEXEC_CMD_kexec_unload 5 +typedef struct xen_kexec_unload {
xen/include/public/kexec.h typedef struct xen_kexec_range { · line 207
Quoted 10 lines
xen/include/public/kexec.h +10
-0+ uint8_t type; +} xen_kexec_unload_t; +DEFINE_XEN_GUEST_HANDLE (xen_kexec_unload_t); + +#else /* __XEN_INTERFACE_VERSION__ < 0x00040300 */ + +#undef KEXEC_CMD_kexec_load +#undef KEXEC_CMD_kexec_unload +#define KEXEC_CMD_kexec_load KEXEC_CMD_kexec_load_v1 +#define KEXEC_CMD_kexec_unload KEXEC_CMD_kexec_unload_v1
Could you define all constants in one place at the beginning of this file? It is very difficult to see what is going on. Especially those undefs are crazy for me.
Daniel
Re: [PATCH 3/8] kexec: add public interface for improved load/unload sub-ops
In reply to David VrabelQuoted 99 lines · David Vrabel
From: David Vrabel <[email protected]>
Add replacement
KEXEC_CMD_loadandKEXEC_CMD_unloadsub-ops to the kexec hypercall. These new sub-ops allow a priviledged guest to provide the image data to be loaded into Xen memory or the crash region instead of guests loading the image data themselves and providing the relocation code and metadata.The old interface is provided to guests requesting an interface version prior to 4.3.
Signed-off: David Vrabel <[email protected]>
--- xen/common/kexec.c | 12 ++++---- xen/include/public/kexec.h | 66 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 68 insertions(+), 10 deletions(-)xen/common/kexec.c +6
-6@@ -732,7 +732,7 @@ static void crash_save_vmcoreinfo(void)#endif } -static int kexec_load_unload_internal (unsigned long op,xen_kexec_load_t *load) +static int kexec_load_unload_internal (unsigned long op,xen_kexec_load_v1_t *load) {xen_kexec_image_t *image;int base, bit, pos;@@ -779,7 +779,7 @@ static int kexec_load_unload_internal(unsigned long op, xen_kexec_load_t *load)static int kexec_load_unload (unsigned long op,XEN_GUEST_HANDLE_PARAM (void ) uarg) { -xen_kexec_load_t load; +xen_kexec_load_v1_t load;if (unlikely (copy_from_guest (&load, uarg,1 )) )return -EFAULT ;@@ -791,8 +791,8 @@ static int kexec_load_unload_compat(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) uarg) {#ifdef CONFIG_COMPAT -compat_kexec_load_t compat_load; -xen_kexec_load_t load; +compat_kexec_load_v1_t compat_load; +xen_kexec_load_v1_t load;if (unlikely (copy_from_guest (&compat_load, uarg,1 )) )return -EFAULT ;@@ -864,8 +864,8 @@ static int do_kexec_op_internal(unsigned long op,else ret =kexec_get_range (uarg);break ; -case KEXEC_CMD_kexec_load: -case KEXEC_CMD_kexec_unload: +case KEXEC_CMD_kexec_load_v1: +case KEXEC_CMD_kexec_unload_v1:spin_lock_irqsave (&kexec_lock, flags);if (!test_bit (KEXEC_FLAG_IN_PROGRESS , &kexec_flags)) {xen/include/public/kexec.h +17
-4@@ -116,12 +116,12 @@ typedef struct xen_kexec_exec {* type == KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH [in] * image == relocation information for kexec (ignored for unload) [in] */ -#define KEXEC_CMD_kexec_load 1 -#define KEXEC_CMD_kexec_unload 2 -typedef struct xen_kexec_load { +#define KEXEC_CMD_kexec_load_v1 1/* obsolete since 0x00040300 */ +#define KEXEC_CMD_kexec_unload_v1 2/* obsolete since 0x00040300 */ +typedef struct xen_kexec_load_v1 {int type;xen_kexec_image_t image; -}xen_kexec_load_t ; +}xen_kexec_load_v1_t ;#define KEXEC_RANGE_MA_CRASH 0/* machine address and size of crash area */ #define KEXEC_RANGE_MA_XEN 1/* machine address and size of Xen itself */ @@ -152,6 +152,64 @@ typedef struct xen_kexec_range {unsigned long start; } xen_kexec_range_t; +#if __XEN_INTERFACE_VERSION__ >=0x00040300 +/* +* A contiguous chunk of a kexec image and it's destination machine +* address. +*/ +typedef struct xen_kexec_segment { +XEN_GUEST_HANDLE_64 (const_void) buf; +uint64_t buf_size; +uint64_t dest_maddr; +uint64_t dest_size; +}xen_kexec_segment_t ; +DEFINE_XEN_GUEST_HANDLE (xen_kexec_segment_t); +
xen/include/public/kexec.h typedef struct xen_kexec_range { · line 177
Quoted 10 lines
xen/include/public/kexec.h +10
-0+/* +* Load a kexec image into memory. +* +* For KEXEC_TYPE_DEFAULT images, the segments may be anywhere in RAM. +* The image is relocated prior to being executed. +* +* For KEXEC_TYPE_CRASH images, each segment of the image must reside +* in the memory region reserved for kexec (KEXEC_RANGE_MA_CRASH) and +* the entry point must be within the image. The caller is responsible +* for ensuring that multiple images do not overlap.
What do you mean by "The caller is responsible for ensuring that multiple images do not overlap."?
xen/include/public/kexec.h typedef struct xen_kexec_range { · line 184
Quoted 7 lines
xen/include/public/kexec.h +7
-0+*/ + +#define KEXEC_CMD_kexec_load 4 +typedef struct xen_kexec_load { + uint8_t type; /* One of KEXEC_TYPE_* */ + uint16_t arch; /* ELF machine type (EM_*). */ + uint32_t __pad;
Why do you need __pad here?
Quoted 13 lines
xen/include/public/kexec.h +13
-0+uint64_t entry_maddr;/* image entry point machine address. */ +uint32_t nr_segments; +XEN_GUEST_HANDLE_64 (xen_kexec_segment_t) segments; +} xen_kexec_load_t; +DEFINE_XEN_GUEST_HANDLE (xen_kexec_load_t); + +/* +* Unload a kexec image. +* +* Type must be one of KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH. +*/ +#define KEXEC_CMD_kexec_unload 5 +typedef struct xen_kexec_unload {
xen/include/public/kexec.h typedef struct xen_kexec_range { · line 207
Quoted 10 lines
xen/include/public/kexec.h +10
-0+ uint8_t type; +} xen_kexec_unload_t; +DEFINE_XEN_GUEST_HANDLE (xen_kexec_unload_t); + +#else /* __XEN_INTERFACE_VERSION__ < 0x00040300 */ + +#undef KEXEC_CMD_kexec_load +#undef KEXEC_CMD_kexec_unload +#define KEXEC_CMD_kexec_load KEXEC_CMD_kexec_load_v1 +#define KEXEC_CMD_kexec_unload KEXEC_CMD_kexec_unload_v1
Could you define all constants in one place at the beginning of this file? It is very difficult to see what is going on. Especially those undefs are crazy for me.
Daniel
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 3/8] kexec: add public interface for improved load/unload sub-ops
Quoted 12 lines · Daniel Kiper
Quoted 11 lines · David Vrabel
From: David Vrabel <[email protected]>
Add replacement
KEXEC_CMD_loadandKEXEC_CMD_unloadsub-ops to the kexec hypercall. These new sub-ops allow a priviledged guest to provide the image data to be loaded into Xen memory or the crash region instead of guests loading the image data themselves and providing the relocation code and metadata.The old interface is provided to guests requesting an interface version prior to 4.3.
[...]
Quoted 11 lines
Quoted 10 lines
+/*
+ * Load a kexec image into memory.
+ *
+ * ForKEXEC_TYPE_DEFAULTimages, the segments may be anywhere in RAM.
+ * The image is relocated prior to being executed.
+ *
+ * ForKEXEC_TYPE_CRASHimages, each segment of the image must reside
+ * in the memory region reserved for kexec (KEXEC_RANGE_MA_CRASH) and
+ * the entry point must be within the image. The caller is responsible
+ * for ensuring that multiple images do not overlap.
Quoted 2 lines
What do you mean by "The caller is responsible for ensuring that multiple images do not overlap."?
The intention here is to allow for safe replacement of a crash image by loading the second image at a different location in the crash region.
This won't actually work however, as the control pages (also allocated from the crash region) will conflict.
This is the behaviour of the Linux implementation. It's less than ideal and something I plan to look at later on (it's low priority as replacing crash images isn't an interesting use case).
Quoted 9 lines
xen/include/public/kexec.h typedef struct xen_kexec_range { · line 184
Quoted 7 lines
+ */
xen/include/public/kexec.h +6
-0+ +#define KEXEC_CMD_kexec_load 4 +typedef struct xen_kexec_load { + uint8_t type; /* One of KEXEC_TYPE_* */ + uint16_t arch; /* ELF machine type (EM_*). */ + uint32_t __pad;Why do you need
__padhere?
To ensure that the following uint64_t is aligned to 8 bytes in both 32 and 64-bit.
Annoyingly uint64_t only has 4 byte alignment on 32-bit architectures.
Quoted 20 lines
Quoted 20 lines
xen/include/public/kexec.h +20
-0+uint64_t entry_maddr;/* image entry point machine address. */ +uint32_t nr_segments; + XEN_GUEST_HANDLE_64(xen_kexec_segment_t) segments; +} xen_kexec_load_t; +DEFINE_XEN_GUEST_HANDLE (xen_kexec_load_t); + +/* +* Unload a kexec image. +* +* Type must be one of KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH. +*/ +#define KEXEC_CMD_kexec_unload 5 +typedef struct xen_kexec_unload { +uint8_t type; +}xen_kexec_unload_t ; +DEFINE_XEN_GUEST_HANDLE (xen_kexec_unload_t); + +#else /* __XEN_INTERFACE_VERSION__ < 0x00040300 */ + +#undef KEXEC_CMD_kexec_load
Quoted 8 lines
xen/include/public/kexec.h typedef struct xen_kexec_range { · line 207
Quoted 3 lines
xen/include/public/kexec.h +3
-0+#undef KEXEC_CMD_kexec_unload +#define KEXEC_CMD_kexec_load KEXEC_CMD_kexec_load_v1 +#define KEXEC_CMD_kexec_unload KEXEC_CMD_kexec_unload_v1Could you define all constants in one place at the beginning of this file? It is very difficult to see what is going on. Especially those undefs are crazy for me.
I was copying the style used for sched_op_compat.
David
Re: [PATCH 3/8] kexec: add public interface for improved load/unload sub-ops
In reply to Daniel KiperQuoted 12 lines · Daniel Kiper
Quoted 11 lines · David Vrabel
From: David Vrabel <[email protected]>
Add replacement
KEXEC_CMD_loadandKEXEC_CMD_unloadsub-ops to the kexec hypercall. These new sub-ops allow a priviledged guest to provide the image data to be loaded into Xen memory or the crash region instead of guests loading the image data themselves and providing the relocation code and metadata.The old interface is provided to guests requesting an interface version prior to 4.3.
[...]
Quoted 11 lines
Quoted 10 lines
+/*
+ * Load a kexec image into memory.
+ *
+ * ForKEXEC_TYPE_DEFAULTimages, the segments may be anywhere in RAM.
+ * The image is relocated prior to being executed.
+ *
+ * ForKEXEC_TYPE_CRASHimages, each segment of the image must reside
+ * in the memory region reserved for kexec (KEXEC_RANGE_MA_CRASH) and
+ * the entry point must be within the image. The caller is responsible
+ * for ensuring that multiple images do not overlap.
Quoted 2 lines
What do you mean by "The caller is responsible for ensuring that multiple images do not overlap."?
The intention here is to allow for safe replacement of a crash image by loading the second image at a different location in the crash region.
This won't actually work however, as the control pages (also allocated from the crash region) will conflict.
This is the behaviour of the Linux implementation. It's less than ideal and something I plan to look at later on (it's low priority as replacing crash images isn't an interesting use case).
Quoted 9 lines
xen/include/public/kexec.h typedef struct xen_kexec_range { · line 184
Quoted 7 lines
+ */
xen/include/public/kexec.h +6
-0+ +#define KEXEC_CMD_kexec_load 4 +typedef struct xen_kexec_load { + uint8_t type; /* One of KEXEC_TYPE_* */ + uint16_t arch; /* ELF machine type (EM_*). */ + uint32_t __pad;Why do you need
__padhere?
To ensure that the following uint64_t is aligned to 8 bytes in both 32 and 64-bit.
Annoyingly uint64_t only has 4 byte alignment on 32-bit architectures.
Quoted 20 lines
Quoted 20 lines
xen/include/public/kexec.h +20
-0+uint64_t entry_maddr;/* image entry point machine address. */ +uint32_t nr_segments; + XEN_GUEST_HANDLE_64(xen_kexec_segment_t) segments; +} xen_kexec_load_t; +DEFINE_XEN_GUEST_HANDLE (xen_kexec_load_t); + +/* +* Unload a kexec image. +* +* Type must be one of KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH. +*/ +#define KEXEC_CMD_kexec_unload 5 +typedef struct xen_kexec_unload { +uint8_t type; +}xen_kexec_unload_t ; +DEFINE_XEN_GUEST_HANDLE (xen_kexec_unload_t); + +#else /* __XEN_INTERFACE_VERSION__ < 0x00040300 */ + +#undef KEXEC_CMD_kexec_load
Quoted 8 lines
xen/include/public/kexec.h typedef struct xen_kexec_range { · line 207
Quoted 3 lines
xen/include/public/kexec.h +3
-0+#undef KEXEC_CMD_kexec_unload +#define KEXEC_CMD_kexec_load KEXEC_CMD_kexec_load_v1 +#define KEXEC_CMD_kexec_unload KEXEC_CMD_kexec_unload_v1Could you define all constants in one place at the beginning of this file? It is very difficult to see what is going on. Especially those undefs are crazy for me.
I was copying the style used for sched_op_compat.
David
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [Xen-devel] [PATCH 3/8] kexec: add public interface for improved load/unload sub-ops
In reply to David VrabelQuoted 7 lines
Quoted 1 line
Quoted 1 line · David Vrabel
xen/include/public/kexec.h +0
-0@@ -116,12 +116,12 @@ typedef struct xen_kexec_exec {* type == KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH [in] * image == relocation information for kexec (ignored for unload) [in] */
xen/include/public/kexec.h typedef struct xen_kexec_exec { · line 124
Quoted 10 lines
xen/include/public/kexec.h +4
-4-#define KEXEC_CMD_kexec_load 1 -#define KEXEC_CMD_kexec_unload 2 -typedef struct xen_kexec_load { +#define KEXEC_CMD_kexec_load_v1 1/* obsolete since 0x00040300 */ +#define KEXEC_CMD_kexec_unload_v1 2/* obsolete since 0x00040300 */ +typedef struct xen_kexec_load_v1 {int type;xen_kexec_image_t image; -}xen_kexec_load_t ; +}xen_kexec_load_v1_t ;
You can't change type names like this without also guarding them with a __XEN_INTERFACE_VERSION__ conditional or providing backward compatibility #define-s.
Quoted 25 lines
xen/include/public/kexec.h +18
-0#define KEXEC_RANGE_MA_CRASH 0/* machine address and size of crash area */ #define KEXEC_RANGE_MA_XEN 1/* machine address and size of Xen itself */ @@ -152,6 +152,64 @@ typedef struct xen_kexec_range {unsigned long start; } xen_kexec_range_t; +#if __XEN_INTERFACE_VERSION__ >=0x00040300 +/* +* A contiguous chunk of a kexec image and it's destination machine +* address. +*/ +typedef struct xen_kexec_segment { +XEN_GUEST_HANDLE_64 (const_void) buf; +uint64_t buf_size; +uint64_t dest_maddr; +uint64_t dest_size; +}xen_kexec_segment_t ; +DEFINE_XEN_GUEST_HANDLE (xen_kexec_segment_t); + +/* +* Load a kexec image into memory. +* +* For KEXEC_TYPE_DEFAULT images, the segments may be anywhere in RAM. +* The image is relocated prior to being executed.
xen/include/public/kexec.h typedef struct xen_kexec_range { · line 182
Quoted 10 lines
xen/include/public/kexec.h +10
-0+* +* For KEXEC_TYPE_CRASH images, each segment of the image must reside +* in the memory region reserved for kexec (KEXEC_RANGE_MA_CRASH) and +* the entry point must be within the image. The caller is responsible +* for ensuring that multiple images do not overlap. +*/ + +#define KEXEC_CMD_kexec_load 4 +typedef struct xen_kexec_load { + uint8_t type; /* One of KEXEC_TYPE_* */
uint8_t __pad1;
xen/include/public/kexec.h typedef struct xen_kexec_range { · line 184
Quoted 2 lines
xen/include/public/kexec.h +2
-0+uint16_t arch;/* ELF machine type (EM_*). */ +uint32_t __pad;
Put nr_segments here instead?
xen/include/public/kexec.h typedef struct xen_kexec_range { · line 189
Quoted 5 lines
xen/include/public/kexec.h +5
-0+uint64_t entry_maddr;/* image entry point machine address. */ +uint32_t nr_segments; +XEN_GUEST_HANDLE_64 (xen_kexec_segment_t) segments; +} xen_kexec_load_t; +DEFINE_XEN_GUEST_HANDLE (xen_kexec_load_t);
Jan
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 3/8] kexec: add public interface for improved load/unload sub-ops
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · David Vrabel
xen/include/public/kexec.h +3
-3@@ -116,12 +116,12 @@ typedef struct xen_kexec_exec {* type == KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH [in] * image == relocation information for kexec (ignored for unload) [in] */ -#define KEXEC_CMD_kexec_load 1 -#define KEXEC_CMD_kexec_unload 2 -typedef struct xen_kexec_load { +#define KEXEC_CMD_kexec_load_v1 1/* obsolete since 0x00040300 */ +#define KEXEC_CMD_kexec_unload_v1 2/* obsolete since 0x00040300 */ +typedef struct xen_kexec_load_v1 {
Quoted 8 lines
xen/include/public/kexec.h typedef struct xen_kexec_exec { · line 124
Quoted 4 lines
xen/include/public/kexec.h +1
-1int type;xen_kexec_image_t image; -} xen_kexec_load_t; +} xen_kexec_load_v1_t;You can't change type names like this without also guarding them with a
__XEN_INTERFACE_VERSION__conditional or providing backward compatibility #define-s.
There are backward compatible definitions provided at the end of the header file.
I will probably refactor this as it confused Daniel as well.
David
Re: [Xen-devel] [PATCH 3/8] kexec: add public interface for improved load/unload sub-ops
In reply to Jan BeulichQuoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · David Vrabel
xen/include/public/kexec.h +3
-3@@ -116,12 +116,12 @@ typedef struct xen_kexec_exec {* type == KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH [in] * image == relocation information for kexec (ignored for unload) [in] */ -#define KEXEC_CMD_kexec_load 1 -#define KEXEC_CMD_kexec_unload 2 -typedef struct xen_kexec_load { +#define KEXEC_CMD_kexec_load_v1 1/* obsolete since 0x00040300 */ +#define KEXEC_CMD_kexec_unload_v1 2/* obsolete since 0x00040300 */ +typedef struct xen_kexec_load_v1 {
Quoted 8 lines
xen/include/public/kexec.h typedef struct xen_kexec_exec { · line 124
Quoted 4 lines
xen/include/public/kexec.h +1
-1int type;xen_kexec_image_t image; -} xen_kexec_load_t; +} xen_kexec_load_v1_t;You can't change type names like this without also guarding them with a
__XEN_INTERFACE_VERSION__conditional or providing backward compatibility #define-s.
There are backward compatible definitions provided at the end of the header file.
I will probably refactor this as it confused Daniel as well.
David
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [Xen-devel] [PATCH 3/8] kexec: add public interface for improved load/unload sub-ops
Quoted 24 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · David Vrabel
xen/include/public/kexec.h +3
-3@@ -116,12 +116,12 @@ typedef struct xen_kexec_exec {* type == KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH [in] * image == relocation information for kexec (ignored for unload) [in] */ -#define KEXEC_CMD_kexec_load 1 -#define KEXEC_CMD_kexec_unload 2 -typedef struct xen_kexec_load { +#define KEXEC_CMD_kexec_load_v1 1/* obsolete since 0x00040300 */ +#define KEXEC_CMD_kexec_unload_v1 2/* obsolete since 0x00040300 */ +typedef struct xen_kexec_load_v1 {Quoted 8 lines
xen/include/public/kexec.h typedef struct xen_kexec_exec { · line 124
Quoted 4 lines
xen/include/public/kexec.h +1
-1int type;xen_kexec_image_t image; -} xen_kexec_load_t; +} xen_kexec_load_v1_t;You can't change type names like this without also guarding them with a
__XEN_INTERFACE_VERSION__conditional or providing backward compatibility #define-s.
Quoted 2 lines
There are backward compatible definitions provided at the end of the header file.
There's a typedef producing xen_kexec_load_t, but there's no way for a consumer to use struct xen_kexec_load afaics.
Jan
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 3/8] kexec: add public interface for improved load/unload sub-ops
In reply to David VrabelQuoted 24 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · David Vrabel
xen/include/public/kexec.h +3
-3@@ -116,12 +116,12 @@ typedef struct xen_kexec_exec {* type == KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH [in] * image == relocation information for kexec (ignored for unload) [in] */ -#define KEXEC_CMD_kexec_load 1 -#define KEXEC_CMD_kexec_unload 2 -typedef struct xen_kexec_load { +#define KEXEC_CMD_kexec_load_v1 1/* obsolete since 0x00040300 */ +#define KEXEC_CMD_kexec_unload_v1 2/* obsolete since 0x00040300 */ +typedef struct xen_kexec_load_v1 {Quoted 8 lines
xen/include/public/kexec.h typedef struct xen_kexec_exec { · line 124
Quoted 4 lines
xen/include/public/kexec.h +1
-1int type;xen_kexec_image_t image; -} xen_kexec_load_t; +} xen_kexec_load_v1_t;You can't change type names like this without also guarding them with a
__XEN_INTERFACE_VERSION__conditional or providing backward compatibility #define-s.
Quoted 2 lines
There are backward compatible definitions provided at the end of the header file.
There's a typedef producing xen_kexec_load_t, but there's no way for a consumer to use struct xen_kexec_load afaics.
Jan
Re: [PATCH 3/8] kexec: add public interface for improved load/unload sub-ops
In reply to David VrabelQuoted 7 lines
Quoted 1 line
Quoted 1 line · David Vrabel
xen/include/public/kexec.h +0
-0@@ -116,12 +116,12 @@ typedef struct xen_kexec_exec {* type == KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH [in] * image == relocation information for kexec (ignored for unload) [in] */
xen/include/public/kexec.h typedef struct xen_kexec_exec { · line 124
Quoted 10 lines
xen/include/public/kexec.h +4
-4-#define KEXEC_CMD_kexec_load 1 -#define KEXEC_CMD_kexec_unload 2 -typedef struct xen_kexec_load { +#define KEXEC_CMD_kexec_load_v1 1/* obsolete since 0x00040300 */ +#define KEXEC_CMD_kexec_unload_v1 2/* obsolete since 0x00040300 */ +typedef struct xen_kexec_load_v1 {int type;xen_kexec_image_t image; -}xen_kexec_load_t ; +}xen_kexec_load_v1_t ;
You can't change type names like this without also guarding them with a __XEN_INTERFACE_VERSION__ conditional or providing backward compatibility #define-s.
Quoted 25 lines
xen/include/public/kexec.h +18
-0#define KEXEC_RANGE_MA_CRASH 0/* machine address and size of crash area */ #define KEXEC_RANGE_MA_XEN 1/* machine address and size of Xen itself */ @@ -152,6 +152,64 @@ typedef struct xen_kexec_range {unsigned long start; } xen_kexec_range_t; +#if __XEN_INTERFACE_VERSION__ >=0x00040300 +/* +* A contiguous chunk of a kexec image and it's destination machine +* address. +*/ +typedef struct xen_kexec_segment { +XEN_GUEST_HANDLE_64 (const_void) buf; +uint64_t buf_size; +uint64_t dest_maddr; +uint64_t dest_size; +}xen_kexec_segment_t ; +DEFINE_XEN_GUEST_HANDLE (xen_kexec_segment_t); + +/* +* Load a kexec image into memory. +* +* For KEXEC_TYPE_DEFAULT images, the segments may be anywhere in RAM. +* The image is relocated prior to being executed.
xen/include/public/kexec.h typedef struct xen_kexec_range { · line 182
Quoted 10 lines
xen/include/public/kexec.h +10
-0+* +* For KEXEC_TYPE_CRASH images, each segment of the image must reside +* in the memory region reserved for kexec (KEXEC_RANGE_MA_CRASH) and +* the entry point must be within the image. The caller is responsible +* for ensuring that multiple images do not overlap. +*/ + +#define KEXEC_CMD_kexec_load 4 +typedef struct xen_kexec_load { + uint8_t type; /* One of KEXEC_TYPE_* */
uint8_t __pad1;
xen/include/public/kexec.h typedef struct xen_kexec_range { · line 184
Quoted 2 lines
xen/include/public/kexec.h +2
-0+uint16_t arch;/* ELF machine type (EM_*). */ +uint32_t __pad;
Put nr_segments here instead?
xen/include/public/kexec.h typedef struct xen_kexec_range { · line 189
Quoted 5 lines
xen/include/public/kexec.h +5
-0+uint64_t entry_maddr;/* image entry point machine address. */ +uint32_t nr_segments; +XEN_GUEST_HANDLE_64 (xen_kexec_segment_t) segments; +} xen_kexec_load_t; +DEFINE_XEN_GUEST_HANDLE (xen_kexec_load_t);
Jan
Re: [PATCH 3/8] kexec: add public interface for improved load/unload sub-ops
In reply to David VrabelQuoted 12 lines · David Vrabel
From: David Vrabel <[email protected]>
Add replacement
KEXEC_CMD_loadandKEXEC_CMD_unloadsub-ops to the kexec hypercall. These new sub-ops allow a priviledged guest to provide the image data to be loaded into Xen memory or the crash region instead of guests loading the image data themselves and providing the relocation code and metadata.The old interface is provided to guests requesting an interface version prior to 4.3.
Signed-off: David Vrabel <[email protected]>
[...]
Quoted 8 lines
xen/include/public/kexec.h +0
-0@@ -116,12 +116,12 @@ typedef struct xen_kexec_exec {* type == KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH [in] * image == relocation information for kexec (ignored for unload) [in] */
xen/include/public/kexec.h typedef struct xen_kexec_exec { · line 124
Quoted 10 lines
xen/include/public/kexec.h +4
-4-#define KEXEC_CMD_kexec_load 1 -#define KEXEC_CMD_kexec_unload 2 -typedef struct xen_kexec_load { +#define KEXEC_CMD_kexec_load_v1 1/* obsolete since 0x00040300 */ +#define KEXEC_CMD_kexec_unload_v1 2/* obsolete since 0x00040300 */ +typedef struct xen_kexec_load_v1 {int type;xen_kexec_image_t image; -}xen_kexec_load_t ; +}xen_kexec_load_v1_t ;
I think that this is not good idea to redefine meaning of constants, types, structures, etc. IMO it is comparable to redefining meaning of words in any laguage (e.g. English). It will be very confusing and may easily lead to stupid bugs. I think that old interface should stay as is (with its bad behavior). New interface should be introduced with "_v2" suffix, e.g. KEXEC_CMD_kexec_load_v2, ...
This would not confuse our descendants.
Daniel
Re: [PATCH 3/8] kexec: add public interface for improved load/unload sub-ops
In reply to David VrabelQuoted 12 lines · David Vrabel
From: David Vrabel <[email protected]>
Add replacement
KEXEC_CMD_loadandKEXEC_CMD_unloadsub-ops to the kexec hypercall. These new sub-ops allow a priviledged guest to provide the image data to be loaded into Xen memory or the crash region instead of guests loading the image data themselves and providing the relocation code and metadata.The old interface is provided to guests requesting an interface version prior to 4.3.
Signed-off: David Vrabel <[email protected]>
[...]
Quoted 8 lines
xen/include/public/kexec.h +0
-0@@ -116,12 +116,12 @@ typedef struct xen_kexec_exec {* type == KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH [in] * image == relocation information for kexec (ignored for unload) [in] */
xen/include/public/kexec.h typedef struct xen_kexec_exec { · line 124
Quoted 10 lines
xen/include/public/kexec.h +4
-4-#define KEXEC_CMD_kexec_load 1 -#define KEXEC_CMD_kexec_unload 2 -typedef struct xen_kexec_load { +#define KEXEC_CMD_kexec_load_v1 1/* obsolete since 0x00040300 */ +#define KEXEC_CMD_kexec_unload_v1 2/* obsolete since 0x00040300 */ +typedef struct xen_kexec_load_v1 {int type;xen_kexec_image_t image; -}xen_kexec_load_t ; +}xen_kexec_load_v1_t ;
I think that this is not good idea to redefine meaning of constants, types, structures, etc. IMO it is comparable to redefining meaning of words in any laguage (e.g. English). It will be very confusing and may easily lead to stupid bugs. I think that old interface should stay as is (with its bad behavior). New interface should be introduced with "_v2" suffix, e.g. KEXEC_CMD_kexec_load_v2, ...
This would not confuse our descendants.
Daniel
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 3/8] kexec: add public interface for improved load/unload sub-ops
Quoted 35 lines · Daniel Kiper
Quoted 12 lines · David Vrabel
From: David Vrabel <[email protected]>
Add replacement
KEXEC_CMD_loadandKEXEC_CMD_unloadsub-ops to the kexec hypercall. These new sub-ops allow a priviledged guest to provide the image data to be loaded into Xen memory or the crash region instead of guests loading the image data themselves and providing the relocation code and metadata.The old interface is provided to guests requesting an interface version prior to 4.3.
Signed-off: David Vrabel <[email protected]>
[...]
Quoted 8 lines
xen/include/public/kexec.h +0
-0@@ -116,12 +116,12 @@ typedef struct xen_kexec_exec {* type == KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH [in] * image == relocation information for kexec (ignored for unload) [in] */ xen/include/public/kexec.h typedef struct xen_kexec_exec { · line 124
Quoted 10 lines
xen/include/public/kexec.h +4
-4-#define KEXEC_CMD_kexec_load 1 -#define KEXEC_CMD_kexec_unload 2 -typedef struct xen_kexec_load { +#define KEXEC_CMD_kexec_load_v1 1/* obsolete since 0x00040300 */ +#define KEXEC_CMD_kexec_unload_v1 2/* obsolete since 0x00040300 */ +typedef struct xen_kexec_load_v1 {int type;xen_kexec_image_t image; -}xen_kexec_load_t ; +}xen_kexec_load_v1_t ;
Quoted 7 lines
I think that this is not good idea to redefine meaning of constants, types, structures, etc. IMO it is comparable to redefining meaning of words in any laguage (e.g. English). It will be very confusing and may easily lead to stupid bugs. I think that old interface should stay as is (with its bad behavior). New interface should be introduced with "
_v2" suffix, e.g.KEXEC_CMD_kexec_load_v2, ...
This would not confuse our descendants.
This is something that was requested (by Ian C) as the Xen way of doing it.
David
Re: [PATCH 3/8] kexec: add public interface for improved load/unload sub-ops
In reply to Daniel KiperQuoted 35 lines · Daniel Kiper
Quoted 12 lines · David Vrabel
From: David Vrabel <[email protected]>
Add replacement
KEXEC_CMD_loadandKEXEC_CMD_unloadsub-ops to the kexec hypercall. These new sub-ops allow a priviledged guest to provide the image data to be loaded into Xen memory or the crash region instead of guests loading the image data themselves and providing the relocation code and metadata.The old interface is provided to guests requesting an interface version prior to 4.3.
Signed-off: David Vrabel <[email protected]>
[...]
Quoted 8 lines
xen/include/public/kexec.h +0
-0@@ -116,12 +116,12 @@ typedef struct xen_kexec_exec {* type == KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH [in] * image == relocation information for kexec (ignored for unload) [in] */ xen/include/public/kexec.h typedef struct xen_kexec_exec { · line 124
Quoted 10 lines
xen/include/public/kexec.h +4
-4-#define KEXEC_CMD_kexec_load 1 -#define KEXEC_CMD_kexec_unload 2 -typedef struct xen_kexec_load { +#define KEXEC_CMD_kexec_load_v1 1/* obsolete since 0x00040300 */ +#define KEXEC_CMD_kexec_unload_v1 2/* obsolete since 0x00040300 */ +typedef struct xen_kexec_load_v1 {int type;xen_kexec_image_t image; -}xen_kexec_load_t ; +}xen_kexec_load_v1_t ;
Quoted 7 lines
I think that this is not good idea to redefine meaning of constants, types, structures, etc. IMO it is comparable to redefining meaning of words in any laguage (e.g. English). It will be very confusing and may easily lead to stupid bugs. I think that old interface should stay as is (with its bad behavior). New interface should be introduced with "
_v2" suffix, e.g.KEXEC_CMD_kexec_load_v2, ...
This would not confuse our descendants.
This is something that was requested (by Ian C) as the Xen way of doing it.
David
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 3/8] kexec: add public interface for improved load/unload sub-ops
Quoted 44 lines · David Vrabel
Quoted 35 lines · Daniel Kiper
Quoted 12 lines · David Vrabel
From: David Vrabel <[email protected]>
Add replacement
KEXEC_CMD_loadandKEXEC_CMD_unloadsub-ops to the kexec hypercall. These new sub-ops allow a priviledged guest to provide the image data to be loaded into Xen memory or the crash region instead of guests loading the image data themselves and providing the relocation code and metadata.The old interface is provided to guests requesting an interface version prior to 4.3.
Signed-off: David Vrabel <[email protected]>
[...]
Quoted 8 lines
xen/include/public/kexec.h +0
-0@@ -116,12 +116,12 @@ typedef struct xen_kexec_exec {* type == KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH [in] * image == relocation information for kexec (ignored for unload) [in] */ xen/include/public/kexec.h typedef struct xen_kexec_exec { · line 124
Quoted 10 lines
xen/include/public/kexec.h +4
-4-#define KEXEC_CMD_kexec_load 1 -#define KEXEC_CMD_kexec_unload 2 -typedef struct xen_kexec_load { +#define KEXEC_CMD_kexec_load_v1 1/* obsolete since 0x00040300 */ +#define KEXEC_CMD_kexec_unload_v1 2/* obsolete since 0x00040300 */ +typedef struct xen_kexec_load_v1 {int type;xen_kexec_image_t image; -}xen_kexec_load_t ; +}xen_kexec_load_v1_t ;Quoted 7 lines
I think that this is not good idea to redefine meaning of constants, types, structures, etc. IMO it is comparable to redefining meaning of words in any laguage (e.g. English). It will be very confusing and may easily lead to stupid bugs. I think that old interface should stay as is (with its bad behavior). New interface should be introduced with "
_v2" suffix, e.g.KEXEC_CMD_kexec_load_v2, ...
This would not confuse our descendants.
Quoted 1 line
This is something that was requested (by Ian C) as the Xen way of doing it.
Yes, I remember but still do not agree with that idea in general. Maybe discussion on kexec interface is good point to change that Xen community behavior? Ian?
Daniel
Re: [PATCH 3/8] kexec: add public interface for improved load/unload sub-ops
In reply to David VrabelQuoted 44 lines · David Vrabel
Quoted 35 lines · Daniel Kiper
Quoted 12 lines · David Vrabel
From: David Vrabel <[email protected]>
Add replacement
KEXEC_CMD_loadandKEXEC_CMD_unloadsub-ops to the kexec hypercall. These new sub-ops allow a priviledged guest to provide the image data to be loaded into Xen memory or the crash region instead of guests loading the image data themselves and providing the relocation code and metadata.The old interface is provided to guests requesting an interface version prior to 4.3.
Signed-off: David Vrabel <[email protected]>
[...]
Quoted 8 lines
xen/include/public/kexec.h +0
-0@@ -116,12 +116,12 @@ typedef struct xen_kexec_exec {* type == KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH [in] * image == relocation information for kexec (ignored for unload) [in] */ xen/include/public/kexec.h typedef struct xen_kexec_exec { · line 124
Quoted 10 lines
xen/include/public/kexec.h +4
-4-#define KEXEC_CMD_kexec_load 1 -#define KEXEC_CMD_kexec_unload 2 -typedef struct xen_kexec_load { +#define KEXEC_CMD_kexec_load_v1 1/* obsolete since 0x00040300 */ +#define KEXEC_CMD_kexec_unload_v1 2/* obsolete since 0x00040300 */ +typedef struct xen_kexec_load_v1 {int type;xen_kexec_image_t image; -}xen_kexec_load_t ; +}xen_kexec_load_v1_t ;Quoted 7 lines
I think that this is not good idea to redefine meaning of constants, types, structures, etc. IMO it is comparable to redefining meaning of words in any laguage (e.g. English). It will be very confusing and may easily lead to stupid bugs. I think that old interface should stay as is (with its bad behavior). New interface should be introduced with "
_v2" suffix, e.g.KEXEC_CMD_kexec_load_v2, ...
This would not confuse our descendants.
Quoted 1 line
This is something that was requested (by Ian C) as the Xen way of doing it.
Yes, I remember but still do not agree with that idea in general. Maybe discussion on kexec interface is good point to change that Xen community behavior? Ian?
Daniel
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [Xen-devel] [PATCH 3/8] kexec: add public interface for improved load/unload sub-ops
Quoted 46 lines
Quoted 1 line
Quoted 1 line · Daniel Kiper
Quoted 44 lines · David Vrabel
Quoted 42 lines · Daniel Kiper
Quoted 12 lines · David Vrabel
From: David Vrabel <[email protected]>
Add replacement
KEXEC_CMD_loadandKEXEC_CMD_unloadsub-ops to the kexec hypercall. These new sub-ops allow a priviledged guest to provide the image data to be loaded into Xen memory or the crash region instead of guests loading the image data themselves and providing the relocation code and metadata.The old interface is provided to guests requesting an interface version prior to 4.3.
Signed-off: David Vrabel <[email protected]>
[...]
Quoted 8 lines
xen/include/public/kexec.h +0
-0@@ -116,12 +116,12 @@ typedef struct xen_kexec_exec {* type == KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH [in] * image == relocation information for kexec (ignored for unload) [in] */ xen/include/public/kexec.h typedef struct xen_kexec_exec { · line 124
Quoted 10 lines
xen/include/public/kexec.h +4
-4-#define KEXEC_CMD_kexec_load 1 -#define KEXEC_CMD_kexec_unload 2 -typedef struct xen_kexec_load { +#define KEXEC_CMD_kexec_load_v1 1/* obsolete since 0x00040300 */ +#define KEXEC_CMD_kexec_unload_v1 2/* obsolete since 0x00040300 */ +typedef struct xen_kexec_load_v1 {int type;xen_kexec_image_t image; -}xen_kexec_load_t ; +}xen_kexec_load_v1_t ;I think that this is not good idea to redefine meaning of constants, types, structures, etc. IMO it is comparable to redefining meaning of words in any laguage (e.g. English). It will be very confusing and may easily lead to stupid bugs. I think that old interface should stay as is (with its bad behavior). New interface should be introduced with "
_v2" suffix, e.g.KEXEC_CMD_kexec_load_v2, ...
This would not confuse our descendants.
Quoted 5 lines
Quoted 1 line
This is something that was requested (by Ian C) as the Xen way of doing it.
Yes, I remember but still do not agree with that idea in general. Maybe discussion on kexec interface is good point to change that Xen community behavior? Ian?
Together with all consumers being expected to properly make use of __XEN_INTERFACE_VERSION__ (or else they get the lowest possible definitions), I don't think there's a big issue here as long as all old definitions retain their meaning when said symbol is set low enough.
Jan
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 3/8] kexec: add public interface for improved load/unload sub-ops
Quoted 52 lines · Jan Beulich
Quoted 46 lines
Quoted 1 line
Quoted 1 line · Daniel Kiper
Quoted 44 lines · David Vrabel
Quoted 42 lines · Daniel Kiper
Quoted 12 lines · David Vrabel
From: David Vrabel <[email protected]>
Add replacement
KEXEC_CMD_loadandKEXEC_CMD_unloadsub-ops to the kexec hypercall. These new sub-ops allow a priviledged guest to provide the image data to be loaded into Xen memory or the crash region instead of guests loading the image data themselves and providing the relocation code and metadata.The old interface is provided to guests requesting an interface version prior to 4.3.
Signed-off: David Vrabel <[email protected]>
[...]
Quoted 8 lines
xen/include/public/kexec.h +0
-0@@ -116,12 +116,12 @@ typedef struct xen_kexec_exec {* type == KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH [in] * image == relocation information for kexec (ignored for unload) [in] */ xen/include/public/kexec.h typedef struct xen_kexec_exec { · line 124
Quoted 10 lines
xen/include/public/kexec.h +4
-4-#define KEXEC_CMD_kexec_load 1 -#define KEXEC_CMD_kexec_unload 2 -typedef struct xen_kexec_load { +#define KEXEC_CMD_kexec_load_v1 1/* obsolete since 0x00040300 */ +#define KEXEC_CMD_kexec_unload_v1 2/* obsolete since 0x00040300 */ +typedef struct xen_kexec_load_v1 {int type;xen_kexec_image_t image; -}xen_kexec_load_t ; +}xen_kexec_load_v1_t ;I think that this is not good idea to redefine meaning of constants, types, structures, etc. IMO it is comparable to redefining meaning of words in any laguage (e.g. English). It will be very confusing and may easily lead to stupid bugs. I think that old interface should stay as is (with its bad behavior). New interface should be introduced with "
_v2" suffix, e.g.KEXEC_CMD_kexec_load_v2, ...
This would not confuse our descendants.Quoted 5 lines
Quoted 1 line
This is something that was requested (by Ian C) as the Xen way of doing it.
Yes, I remember but still do not agree with that idea in general. Maybe discussion on kexec interface is good point to change that Xen community behavior? Ian?
Quoted 5 lines
Together with all consumers being expected to properly make use of
__XEN_INTERFACE_VERSION__(or else they get the lowest possible definitions), I don't think there's a big issue here as long as all old definitions retain their meaning when said symbol is set low enough.
It is good for dropping or adding some functionalities. However, I still do not agree that it is sufficient solution in this case. Here we are redefining interface. I know that was done many times but it does not mean this is good. Additionally, compilter does not care. It reads everything. However, for me (I suppose at least) it is difficult read code which have same "words" with meaning depending only on placement. I would like to read sources without thinking where I am. That is all.
Daniel
Re: [Xen-devel] [PATCH 3/8] kexec: add public interface for improved load/unload sub-ops
In reply to Jan BeulichQuoted 52 lines · Jan Beulich
Quoted 46 lines
Quoted 1 line
Quoted 1 line · Daniel Kiper
Quoted 44 lines · David Vrabel
Quoted 42 lines · Daniel Kiper
Quoted 12 lines · David Vrabel
From: David Vrabel <[email protected]>
Add replacement
KEXEC_CMD_loadandKEXEC_CMD_unloadsub-ops to the kexec hypercall. These new sub-ops allow a priviledged guest to provide the image data to be loaded into Xen memory or the crash region instead of guests loading the image data themselves and providing the relocation code and metadata.The old interface is provided to guests requesting an interface version prior to 4.3.
Signed-off: David Vrabel <[email protected]>
[...]
Quoted 8 lines
xen/include/public/kexec.h +0
-0@@ -116,12 +116,12 @@ typedef struct xen_kexec_exec {* type == KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH [in] * image == relocation information for kexec (ignored for unload) [in] */ xen/include/public/kexec.h typedef struct xen_kexec_exec { · line 124
Quoted 10 lines
xen/include/public/kexec.h +4
-4-#define KEXEC_CMD_kexec_load 1 -#define KEXEC_CMD_kexec_unload 2 -typedef struct xen_kexec_load { +#define KEXEC_CMD_kexec_load_v1 1/* obsolete since 0x00040300 */ +#define KEXEC_CMD_kexec_unload_v1 2/* obsolete since 0x00040300 */ +typedef struct xen_kexec_load_v1 {int type;xen_kexec_image_t image; -}xen_kexec_load_t ; +}xen_kexec_load_v1_t ;I think that this is not good idea to redefine meaning of constants, types, structures, etc. IMO it is comparable to redefining meaning of words in any laguage (e.g. English). It will be very confusing and may easily lead to stupid bugs. I think that old interface should stay as is (with its bad behavior). New interface should be introduced with "
_v2" suffix, e.g.KEXEC_CMD_kexec_load_v2, ...
This would not confuse our descendants.Quoted 5 lines
Quoted 1 line
This is something that was requested (by Ian C) as the Xen way of doing it.
Yes, I remember but still do not agree with that idea in general. Maybe discussion on kexec interface is good point to change that Xen community behavior? Ian?
Quoted 5 lines
Together with all consumers being expected to properly make use of
__XEN_INTERFACE_VERSION__(or else they get the lowest possible definitions), I don't think there's a big issue here as long as all old definitions retain their meaning when said symbol is set low enough.
It is good for dropping or adding some functionalities. However, I still do not agree that it is sufficient solution in this case. Here we are redefining interface. I know that was done many times but it does not mean this is good. Additionally, compilter does not care. It reads everything. However, for me (I suppose at least) it is difficult read code which have same "words" with meaning depending only on placement. I would like to read sources without thinking where I am. That is all.
Daniel
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 3/8] kexec: add public interface for improved load/unload sub-ops
In reply to Daniel KiperQuoted 46 lines
Quoted 1 line
Quoted 1 line · Daniel Kiper
Quoted 44 lines · David Vrabel
Quoted 42 lines · Daniel Kiper
Quoted 12 lines · David Vrabel
From: David Vrabel <[email protected]>
Add replacement
KEXEC_CMD_loadandKEXEC_CMD_unloadsub-ops to the kexec hypercall. These new sub-ops allow a priviledged guest to provide the image data to be loaded into Xen memory or the crash region instead of guests loading the image data themselves and providing the relocation code and metadata.The old interface is provided to guests requesting an interface version prior to 4.3.
Signed-off: David Vrabel <[email protected]>
[...]
Quoted 8 lines
xen/include/public/kexec.h +0
-0@@ -116,12 +116,12 @@ typedef struct xen_kexec_exec {* type == KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH [in] * image == relocation information for kexec (ignored for unload) [in] */ xen/include/public/kexec.h typedef struct xen_kexec_exec { · line 124
Quoted 10 lines
xen/include/public/kexec.h +4
-4-#define KEXEC_CMD_kexec_load 1 -#define KEXEC_CMD_kexec_unload 2 -typedef struct xen_kexec_load { +#define KEXEC_CMD_kexec_load_v1 1/* obsolete since 0x00040300 */ +#define KEXEC_CMD_kexec_unload_v1 2/* obsolete since 0x00040300 */ +typedef struct xen_kexec_load_v1 {int type;xen_kexec_image_t image; -}xen_kexec_load_t ; +}xen_kexec_load_v1_t ;I think that this is not good idea to redefine meaning of constants, types, structures, etc. IMO it is comparable to redefining meaning of words in any laguage (e.g. English). It will be very confusing and may easily lead to stupid bugs. I think that old interface should stay as is (with its bad behavior). New interface should be introduced with "
_v2" suffix, e.g.KEXEC_CMD_kexec_load_v2, ...
This would not confuse our descendants.
Quoted 5 lines
Quoted 1 line
This is something that was requested (by Ian C) as the Xen way of doing it.
Yes, I remember but still do not agree with that idea in general. Maybe discussion on kexec interface is good point to change that Xen community behavior? Ian?
Together with all consumers being expected to properly make use of __XEN_INTERFACE_VERSION__ (or else they get the lowest possible definitions), I don't think there's a big issue here as long as all old definitions retain their meaning when said symbol is set low enough.
Jan
PATCH 4/8 kexec: add infrastructure for handling kexec images
In reply to David VrabelFrom: David Vrabel <[email protected]>
Add the code needed to handle and load kexec images into Xen memory or into the crash region. This is needed for the new KEXEC_CMD_load and KEXEC_CMD_unload hypercall sub-ops.
Much of this code is derived from the Linux kernel.
--- xen/common/Makefile | 1 + xen/common/kimage.c | 887 ++++++++++++++++++++++++++++++++++++++++++++++ xen/include/xen/kimage.h | 64 ++++ 3 files changed, 952 insertions(+), 0 deletions(-) create mode 100644 xen/common/kimage.c create mode 100644 xen/include/xen/kimage.h
xen/common/Makefile +1 -0
@@ -11,6 +11,7 @@ obj-y += irq.o obj-y += kernel.o obj-y += keyhandler.o obj-$(HAS_KEXEC) += kexec.o +obj-$(HAS_KEXEC) += kimage.o obj-y += lib.o obj-y += memory.o obj-y += multicall.o
xen/common/kimage.c new file +887 -0
887 lines not on this page · raw message
xen/include/xen/kimage.h new file +64 -0
64 lines not on this page · raw message
Signature · 1 line
1.7.2.5
PATCH 4/8 kexec: add infrastructure for handling kexec images
In reply to David VrabelFrom: David Vrabel <[email protected]>
Add the code needed to handle and load kexec images into Xen memory or into the crash region. This is needed for the new KEXEC_CMD_load and KEXEC_CMD_unload hypercall sub-ops.
Much of this code is derived from the Linux kernel.
--- xen/common/Makefile | 1 + xen/common/kimage.c | 887 ++++++++++++++++++++++++++++++++++++++++++++++ xen/include/xen/kimage.h | 64 ++++ 3 files changed, 952 insertions(+), 0 deletions(-) create mode 100644 xen/common/kimage.c create mode 100644 xen/include/xen/kimage.h
xen/common/Makefile +1 -0
@@ -11,6 +11,7 @@ obj-y += irq.o obj-y += kernel.o obj-y += keyhandler.o obj-$(HAS_KEXEC) += kexec.o +obj-$(HAS_KEXEC) += kimage.o obj-y += lib.o obj-y += memory.o obj-y += multicall.o
xen/common/kimage.c new file +887 -0
887 lines not on this page · raw message
xen/include/xen/kimage.h new file +64 -0
64 lines not on this page · raw message
Signature · 7 lines
1.7.2.5 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 4/8] kexec: add infrastructure for handling kexec images
Quoted 9 lines · David Vrabel
From: David Vrabel <[email protected]>
Add the code needed to handle and load kexec images into Xen memory or into the crash region. This is needed for the new
KEXEC_CMD_loadandKEXEC_CMD_unloadhypercall sub-ops.Much of this code is derived from the Linux kernel.
Signed-off-by David Vrabel <[email protected]>
[...]
Quoted 1 line
xen/common/kimage.c +0
-0
[...]
xen/common/kimage.c line 824
Quoted 3 lines
xen/common/kimage.c +3
-0+static int kimage_load_segment (struct kexec_image *image,xen_kexec_segment_t *segment) +{ +int result = -ENOMEM ;
Somewhere should be a check that arhitecture of loaded image is compatible with arhitecture on which we currently running.
xen/common/kimage.c line 837
Quoted 12 lines
xen/common/kimage.c +12
-0+switch ( image->type ) + { +case KEXEC_TYPE_DEFAULT : + result =kimage_load_normal_segment (image, segment); +break ; +case KEXEC_TYPE_CRASH : + result =kimage_load_crash_segment (image, segment); +break ; + } + +return result; +}
Daniel
Re: [PATCH 4/8] kexec: add infrastructure for handling kexec images
In reply to David VrabelQuoted 9 lines · David Vrabel
From: David Vrabel <[email protected]>
Add the code needed to handle and load kexec images into Xen memory or into the crash region. This is needed for the new
KEXEC_CMD_loadandKEXEC_CMD_unloadhypercall sub-ops.Much of this code is derived from the Linux kernel.
Signed-off-by David Vrabel <[email protected]>
[...]
Quoted 1 line
xen/common/kimage.c +0
-0
[...]
xen/common/kimage.c line 824
Quoted 3 lines
xen/common/kimage.c +3
-0+static int kimage_load_segment (struct kexec_image *image,xen_kexec_segment_t *segment) +{ +int result = -ENOMEM ;
Somewhere should be a check that arhitecture of loaded image is compatible with arhitecture on which we currently running.
xen/common/kimage.c line 837
Quoted 12 lines
xen/common/kimage.c +12
-0+switch ( image->type ) + { +case KEXEC_TYPE_DEFAULT : + result =kimage_load_normal_segment (image, segment); +break ; +case KEXEC_TYPE_CRASH : + result =kimage_load_crash_segment (image, segment); +break ; + } + +return result; +}
Daniel
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 4/8] kexec: add infrastructure for handling kexec images
Quoted 17 lines · Daniel Kiper
Quoted 9 lines · David Vrabel
From: David Vrabel <[email protected]>
Add the code needed to handle and load kexec images into Xen memory or into the crash region. This is needed for the new
KEXEC_CMD_loadandKEXEC_CMD_unloadhypercall sub-ops.Much of this code is derived from the Linux kernel.
Signed-off-by David Vrabel <[email protected]>[...]
Quoted 1 line
xen/common/kimage.c +0
-0[...]
Quoted 6 lines
xen/common/kimage.c line 824
Quoted 3 lines
xen/common/kimage.c +3
-0+static int kimage_load_segment (struct kexec_image *image,xen_kexec_segment_t *segment) +{ +int result = -ENOMEM ;Somewhere should be a check that arhitecture of loaded image is compatible with arhitecture on which we currently running.
See machine_kexec_load() in patch 5.
David
Re: [PATCH 4/8] kexec: add infrastructure for handling kexec images
In reply to Daniel KiperQuoted 17 lines · Daniel Kiper
Quoted 9 lines · David Vrabel
From: David Vrabel <[email protected]>
Add the code needed to handle and load kexec images into Xen memory or into the crash region. This is needed for the new
KEXEC_CMD_loadandKEXEC_CMD_unloadhypercall sub-ops.Much of this code is derived from the Linux kernel.
Signed-off-by David Vrabel <[email protected]>[...]
Quoted 1 line
xen/common/kimage.c +0
-0[...]
Quoted 6 lines
xen/common/kimage.c line 824
Quoted 3 lines
xen/common/kimage.c +3
-0+static int kimage_load_segment (struct kexec_image *image,xen_kexec_segment_t *segment) +{ +int result = -ENOMEM ;Somewhere should be a check that arhitecture of loaded image is compatible with arhitecture on which we currently running.
See machine_kexec_load() in patch 5.
David
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 4/8] kexec: add infrastructure for handling kexec images
Quoted 18 lines · David Vrabel
Quoted 17 lines · Daniel Kiper
Quoted 9 lines · David Vrabel
From: David Vrabel <[email protected]>
Add the code needed to handle and load kexec images into Xen memory or into the crash region. This is needed for the new
KEXEC_CMD_loadandKEXEC_CMD_unloadhypercall sub-ops.Much of this code is derived from the Linux kernel.
Signed-off-by David Vrabel <[email protected]>[...]
Quoted 1 line
xen/common/kimage.c +0
-0[...]
Quoted 8 lines
Quoted 6 lines
xen/common/kimage.c line 824
Quoted 3 lines
xen/common/kimage.c +3
-0+static int kimage_load_segment (struct kexec_image *image,xen_kexec_segment_t *segment) +{ +int result = -ENOMEM ;Somewhere should be a check that arhitecture of loaded image is compatible with arhitecture on which we currently running.
See
machine_kexec_load()in patch 5.
Thanks. I missed that.
Daniel
Re: [PATCH 4/8] kexec: add infrastructure for handling kexec images
In reply to David VrabelQuoted 18 lines · David Vrabel
Quoted 17 lines · Daniel Kiper
Quoted 9 lines · David Vrabel
From: David Vrabel <[email protected]>
Add the code needed to handle and load kexec images into Xen memory or into the crash region. This is needed for the new
KEXEC_CMD_loadandKEXEC_CMD_unloadhypercall sub-ops.Much of this code is derived from the Linux kernel.
Signed-off-by David Vrabel <[email protected]>[...]
Quoted 1 line
xen/common/kimage.c +0
-0[...]
Quoted 8 lines
Quoted 6 lines
xen/common/kimage.c line 824
Quoted 3 lines
xen/common/kimage.c +3
-0+static int kimage_load_segment (struct kexec_image *image,xen_kexec_segment_t *segment) +{ +int result = -ENOMEM ;Somewhere should be a check that arhitecture of loaded image is compatible with arhitecture on which we currently running.
See
machine_kexec_load()in patch 5.
Thanks. I missed that.
Daniel
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
PATCH 5/8 kexec: extend hypercall with improved load/unload ops
In reply to David VrabelFrom: David Vrabel <[email protected]>
In the existing kexec hypercall, the load and unload ops depend on internals of the Linux kernel (the page list and code page provided by the kernel). The code page is used to transition between Xen context and the image so using kernel code doesn't make sense and will not work for PVH guests.
Add replacement KEXEC_CMD_kexec_load and KEXEC_CMD_kexec_unload ops that no longer require a code page to be provided by the guest -- Xen now provides the code for calling the image directly.
The new load op looks similar to the Linux kexec_load system call and allows the guest to provide the image data to be loaded. The guest specifies the architecture of the image which may be a 32-bit subarch of the hypervisor's architecture (i.e., an EM_386 image on an EM_X86_64 hypervisor).
The toolstack can now load images without kernel involvement. This is required for supporting kexec when using a dom0 with an upstream kernel.
Crash images are copied directly into the crash region on load. Default images are copied into Xen heap pages and a list of source and destination machine addresses is created. This is list is used in kexec_reloc() to relocate the image to its destination.
The old load and unload sub-ops are still available (as KEXEC_CMD_load_v1 and KEXEC_CMD_unload_v1) and are implemented on top of the new infrastructure.
--- xen/arch/x86/machine_kexec.c | 261 ++++++++++++++++++------- xen/arch/x86/x86_64/Makefile | 2 +- xen/arch/x86/x86_64/compat_kexec.S | 187 ----------------- xen/arch/x86/x86_64/kexec_reloc.S | 229 +++++++++++++++++++++ xen/common/kexec.c | 377 +++++++++++++++++++++++++++++------ xen/include/asm-x86/fixmap.h | 3 - xen/include/asm-x86/machine_kexec.h | 14 ++ xen/include/xen/kexec.h | 14 +- 8 files changed, 755 insertions(+), 332 deletions(-) delete mode 100644 xen/arch/x86/x86_64/compat_kexec.S create mode 100644 xen/arch/x86/x86_64/kexec_reloc.S create mode 100644 xen/include/asm-x86/machine_kexec.h
xen/arch/x86/machine_kexec.c +191 -70
@@ -1,9 +1,18 @@/****************************************************************************** * machine_kexec.c * +* Copyright (C) 2013 Citrix Systems R&D Ltd. +* +* Portions derived from Linux's arch/x86/kernel/machine_kexec_64.c. +* +* Copyright (C) 2002-2005 Eric Biederman <[email protected]> +* * Xen port written by: * - Simon 'Horms' Horman <[email protected]> * - Magnus Damm <[email protected]> +* +* This source code is licensed under the GNU General Public License, +* Version 2. See the file COPYING for more details. */ #include <xen/types.h>
@@ -11,63 +20,195 @@#include <xen/guest_access.h> #include <asm/fixmap.h> #include <asm/hpet.h> +#include <asm/page.h> +#include <asm/machine_kexec.h> + +static void init_level2_page (l2_pgentry_t *l2,unsigned long addr) +{ +unsigned long end_addr; + + addr &=PAGE_MASK ; + end_addr = addr +L2_PAGETABLE_ENTRIES * (1ul <<L2_PAGETABLE_SHIFT ); + +while ( addr < end_addr ) + { +l2e_write (l2++,l2e_from_paddr (addr, __PAGE_HYPERVISOR | _PAGE_PSE)); -typedef void (*relocate_new_kernel_t )( -unsigned long indirection_page, -unsigned long *page_list, -unsigned long start_address, -unsigned int preserve_context); + addr +=1ul <<L2_PAGETABLE_SHIFT ; + } +} -int machine_kexec_load (int type,int slot,xen_kexec_image_t *image) +static int init_level3_page (struct kexec_image *image,l3_pgentry_t *l3, +unsigned long addr,unsigned long last_addr) { -unsigned long prev_ma =0 ; -int fix_base =FIX_KEXEC_BASE_0 + (slot * (KEXEC_XEN_NO_PAGES >>1 )); -int k; +unsigned long end_addr; -/* setup fixmap to point to our pages and record the virtual address -* in every odd index in page_list[]. -*/ + addr &=PAGE_MASK ; + end_addr = addr +L3_PAGETABLE_ENTRIES * (1ul <<L3_PAGETABLE_SHIFT ); + +while ( (addr < last_addr) && (addr < end_addr) ) + { +struct page_info *l2_page; +l2_pgentry_t *l2; + + l2_page =kimage_alloc_control_page (image); +if ( !l2_page ) +return -ENOMEM ; + l2 =page_to_virt (l2_page); + +init_level2_page (l2, addr); +l3e_write (l3++,l3e_from_page (l2_page, __PAGE_HYPERVISOR)); + + addr +=1ul <<L3_PAGETABLE_SHIFT ; + } + +return 0 ; +} + +/* +* Build a complete page table to identity map [addr, last_addr). +* +* Control pages are used so they do not overlap with the image source +* or destination. +*/ +static int init_level4_page (struct kexec_image *image,l4_pgentry_t *l4, +unsigned long addr,unsigned long last_addr) +{ +unsigned long end_addr; +int result; + + addr &=PAGE_MASK ; + end_addr = addr +L4_PAGETABLE_ENTRIES * (1ul <<L4_PAGETABLE_SHIFT ); + +while ( (addr < last_addr) && (addr < end_addr) ) + { +struct page_info *l3_page; +l3_pgentry_t *l3; + + l3_page =kimage_alloc_control_page (image); +if ( !l3_page ) +return -ENOMEM ; + l3 =page_to_virt (l3_page); + + result =init_level3_page (image, l3, addr, last_addr); +if (result) +return result; +l4e_write (l4++,l4e_from_page (l3_page, __PAGE_HYPERVISOR)); + + addr +=1ul <<L4_PAGETABLE_SHIFT ; + } + +return 0 ; +} -for ( k =0 ; k <KEXEC_XEN_NO_PAGES ; k++ ) +/* +* Add a mapping for the control code page to the same virtual address +* as kexec_reloc. This allows us to keep running after these page +* tables are loaded in kexec_reloc. +* +* We don't really need to allocate control pages here as these +* entries won't be used while the kexec image is being copied, but it +* makes clean-up easier. +*/ +static int init_transition_pgtable (struct kexec_image *image,l4_pgentry_t *l4) +{ +struct page_info *l3_page; +struct page_info *l2_page; +struct page_info *l1_page; +unsigned long vaddr, paddr; +l3_pgentry_t *l3; +l2_pgentry_t *l2; +l1_pgentry_t *l1; + + vaddr = (unsigned long )kexec_reloc; + paddr =page_to_maddr (image->control_code_page); + + l4 +=l4_table_offset (vaddr); +if ( !(l4e_get_flags (*l4) & _PAGE_PRESENT) ) + { + l3_page =kimage_alloc_control_page (image); +if ( !l3_page ) +return -ENOMEM ; +l4e_write (l4,l4e_from_page (l3_page, __PAGE_HYPERVISOR)); + } + + l3 =l4e_to_l3e (*l4) +l3_table_offset (vaddr); +if ( !(l3e_get_flags (*l3) & _PAGE_PRESENT) ) + { + l2_page =kimage_alloc_control_page (image); +if ( !l2_page ) +return -ENOMEM ; +l3e_write (l3,l3e_from_page (l2_page, __PAGE_HYPERVISOR)); + } + + l2 =l3e_to_l2e (*l3) +l2_table_offset (vaddr); +if ( !(l2e_get_flags (*l2) & _PAGE_PRESENT) ) + { + l1_page =kimage_alloc_control_page (image); +if ( !l1_page ) +return -ENOMEM ; +l2e_write (l2,l2e_from_page (l1_page, __PAGE_HYPERVISOR)); + } + + l1 =l2e_to_l1e (*l2) +l1_table_offset (vaddr); +l1e_write (l1,l1e_from_pfn (paddr >>PAGE_SHIFT , __PAGE_HYPERVISOR)); +return 0 ; +} + + +static int build_reloc_page_table (struct kexec_image *image) +{ +struct page_info *l4_page; +l4_pgentry_t *l4; +int result; + + l4_page =kimage_alloc_control_page (image); +if ( !l4_page ) +return -ENOMEM ; + + l4 =page_to_virt (l4_page); + result =init_level4_page (image, l4,0 , max_page <<PAGE_SHIFT ); +if ( result ) +return result; + + result =init_transition_pgtable (image, l4); +if ( result ) +return result; + + image->aux_page = l4_page; +return 0 ; +} + +int machine_kexec_load (struct kexec_image *image) +{ +void *code_page; +int ret; + +switch ( image->arch ) { -if ( (k &1 ) ==0 ) - { -/* Even pages: machine address. */ - prev_ma = image->page_list[k]; - } -else - { -/* Odd pages: va for previous ma. */ -if (is_pv_32on64_domain (dom0) ) - { -/* -* The compatability bounce code sets up a page table -* with a 1-1 mapping of the first 1G of memory so -* VA==PA here. -* -* This Linux purgatory code still sets up separate -* high and low mappings on the control page (entries -* 0 and 1) but it is harmless if they are equal since -* that PT is not live at the time. -*/ - image->page_list[k] = prev_ma; - } -else - { -set_fixmap (fix_base + (k >>1 ), prev_ma); - image->page_list[k] =fix_to_virt (fix_base + (k >>1 )); - } - } +case EM_386 : +case EM_X86_64 : +break ; +default : +return -EINVAL ; } + code_page =page_to_virt (image->control_code_page); +memcpy (code_page, kexec_reloc,PAGE_SIZE ); + + ret =build_reloc_page_table (image); +if ( ret <0 ) +return ret; +return 0 ; } -void machine_kexec_unload (int type,int slot,xen_kexec_image_t *image) +void machine_kexec_unload (struct kexec_image *image) { +/* no-op. kimage_free() frees all control pages. */ } -void machine_reboot_kexec (xen_kexec_image_t *image) +void machine_reboot_kexec (struct kexec_image *image) {BUG_ON (smp_processor_id () !=0 );smp_send_stop ();
@@ -75,13 +216,10 @@ void machine_reboot_kexec(xen_kexec_image_t *image)BUG (); } -void machine_kexec (xen_kexec_image_t *image) +void machine_kexec (struct kexec_image *image) { -struct desc_ptr gdt_desc = { - .base = (unsigned long )(boot_cpu_gdt_table -FIRST_RESERVED_GDT_ENTRY ), - .limit =LAST_RESERVED_GDT_BYTE - };int i; +unsigned long reloc_flags =0 ;/* We are about to permenantly jump out of the Xen context into the kexec * purgatory code. We really dont want to be still servicing interupts.
@@ -109,29 +247,12 @@ void machine_kexec(xen_kexec_image_t *image)* not like running with NMIs disabled. */ enable_nmis (); -/* -* compat_machine_kexec() returns to idle pagetables, which requires us -* to be running on a static GDT mapping (idle pagetables have no GDT -* mappings in their per-domain mapping area). -*/ - asmvolatile ("lgdt %0" : :"m" (gdt_desc) ); +if ( image->arch ==EM_386 ) + reloc_flags |=KEXEC_RELOC_FLAG_COMPAT ; -if (is_pv_32on64_domain (dom0) ) - { -compat_machine_kexec (image->page_list[1 ], - image->indirection_page, - image->page_list, - image->start_address); - } -else - { -relocate_new_kernel_t rnk; - - rnk = (relocate_new_kernel_t ) image->page_list[1 ]; - (*rnk)(image->indirection_page, image->page_list, - image->start_address, -0 /* preserve_context */ ); - } +kexec_reloc (page_to_maddr (image->control_code_page), +page_to_maddr (image->aux_page), + image->head, image->entry_maddr, reloc_flags); }int machine_kexec_get (xen_kexec_range_t *range)
xen/arch/x86/x86_64/Makefile +1 -1
@@ -11,11 +11,11 @@ obj-y += mmconf-fam10h.o obj-y += mmconfig_64.o obj-y += mmconfig-shared.o obj-y += compat.o -obj-bin-y += compat_kexec.o obj-y += domain.o obj-y += physdev.o obj-y += platform_hypercall.o obj-y += cpu_idle.o obj-y += cpufreq.o +obj-bin-y += kexec_reloc.o obj-$(crash_debug) += gdbstub.o
xen/arch/x86/x86_64/compat_kexec.S deleted +0 -187
187 lines not on this page · raw message
xen/arch/x86/x86_64/kexec_reloc.S new file +229 -0
229 lines not on this page · raw message
xen/common/kexec.c +315 -62
474 lines not on this page · raw message
xen/include/asm-x86/fixmap.h +0 -3
@@ -57,9 +57,6 @@ 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 ,FIX_IOMMU_REGS_BASE_0 ,FIX_IOMMU_REGS_END =FIX_IOMMU_REGS_BASE_0 +MAX_IOMMUS -1 , FIX_IOMMU_MMIO_BASE_0,
xen/include/asm-x86/machine_kexec.h new file +14 -0
@@ -0,0 +1,14 @@ +#ifndef __X86_MACHINE_KEXEC_H__ +#define __X86_MACHINE_KEXEC_H__ + +#define KEXEC_RELOC_FLAG_COMPAT 0x1/* 32-bit image */ + +#ifndef __ASSEMBLY__ + +extern void kexec_reloc (unsigned long reloc_code,unsigned long reloc_pt, +unsigned long ind_maddr,unsigned long entry_maddr, +unsigned long flags); + +#endif + +#endif /* __X86_MACHINE_KEXEC_H__ */
xen/include/xen/kexec.h +5 -9
@@ -6,6 +6,7 @@#include <public/kexec.h> #include <asm/percpu.h> #include <xen/elfcore.h> +#include <xen/kimage.h> typedef struct xen_kexec_reserve { unsigned long size;
@@ -40,11 +41,11 @@ extern enum low_crashinfo low_crashinfo_mode;extern paddr_t crashinfo_maxaddr_bits;void kexec_early_calculations (void ); -int machine_kexec_load (int type,int slot,xen_kexec_image_t *image); -void machine_kexec_unload (int type,int slot,xen_kexec_image_t *image); +int machine_kexec_load (struct kexec_image *image); +void machine_kexec_unload (struct kexec_image *image);void machine_kexec_reserved (xen_kexec_reserve_t *reservation); -void machine_reboot_kexec (xen_kexec_image_t *image); -void machine_kexec (xen_kexec_image_t *image); +void machine_reboot_kexec (struct kexec_image *image); +void machine_kexec (struct kexec_image *image);void kexec_crash (void );void kexec_crash_save_cpu (void );crash_xen_info_t *kexec_crash_save_info (void );
@@ -52,11 +53,6 @@ void machine_crash_shutdown(void);int machine_kexec_get (xen_kexec_range_t *range);int machine_kexec_get_xen (xen_kexec_range_t *range); -void compat_machine_kexec (unsigned long rnk, -unsigned long indirection_page, -unsigned long *page_list, -unsigned long start_address); -/* vmcoreinfo stuff */ #define VMCOREINFO_BYTES (4096)#define VMCOREINFO_NOTE_NAME "VMCOREINFO_XEN"
Signature · 1 line
1.7.2.5
PATCH 5/8 kexec: extend hypercall with improved load/unload ops
In reply to David VrabelFrom: David Vrabel <[email protected]>
In the existing kexec hypercall, the load and unload ops depend on internals of the Linux kernel (the page list and code page provided by the kernel). The code page is used to transition between Xen context and the image so using kernel code doesn't make sense and will not work for PVH guests.
Add replacement KEXEC_CMD_kexec_load and KEXEC_CMD_kexec_unload ops that no longer require a code page to be provided by the guest -- Xen now provides the code for calling the image directly.
The new load op looks similar to the Linux kexec_load system call and allows the guest to provide the image data to be loaded. The guest specifies the architecture of the image which may be a 32-bit subarch of the hypervisor's architecture (i.e., an EM_386 image on an EM_X86_64 hypervisor).
The toolstack can now load images without kernel involvement. This is required for supporting kexec when using a dom0 with an upstream kernel.
Crash images are copied directly into the crash region on load. Default images are copied into Xen heap pages and a list of source and destination machine addresses is created. This is list is used in kexec_reloc() to relocate the image to its destination.
The old load and unload sub-ops are still available (as KEXEC_CMD_load_v1 and KEXEC_CMD_unload_v1) and are implemented on top of the new infrastructure.
--- xen/arch/x86/machine_kexec.c | 261 ++++++++++++++++++------- xen/arch/x86/x86_64/Makefile | 2 +- xen/arch/x86/x86_64/compat_kexec.S | 187 ----------------- xen/arch/x86/x86_64/kexec_reloc.S | 229 +++++++++++++++++++++ xen/common/kexec.c | 377 +++++++++++++++++++++++++++++------ xen/include/asm-x86/fixmap.h | 3 - xen/include/asm-x86/machine_kexec.h | 14 ++ xen/include/xen/kexec.h | 14 +- 8 files changed, 755 insertions(+), 332 deletions(-) delete mode 100644 xen/arch/x86/x86_64/compat_kexec.S create mode 100644 xen/arch/x86/x86_64/kexec_reloc.S create mode 100644 xen/include/asm-x86/machine_kexec.h
xen/arch/x86/machine_kexec.c +191 -70
@@ -1,9 +1,18 @@/****************************************************************************** * machine_kexec.c * +* Copyright (C) 2013 Citrix Systems R&D Ltd. +* +* Portions derived from Linux's arch/x86/kernel/machine_kexec_64.c. +* +* Copyright (C) 2002-2005 Eric Biederman <[email protected]> +* * Xen port written by: * - Simon 'Horms' Horman <[email protected]> * - Magnus Damm <[email protected]> +* +* This source code is licensed under the GNU General Public License, +* Version 2. See the file COPYING for more details. */ #include <xen/types.h>
@@ -11,63 +20,195 @@#include <xen/guest_access.h> #include <asm/fixmap.h> #include <asm/hpet.h> +#include <asm/page.h> +#include <asm/machine_kexec.h> + +static void init_level2_page (l2_pgentry_t *l2,unsigned long addr) +{ +unsigned long end_addr; + + addr &=PAGE_MASK ; + end_addr = addr +L2_PAGETABLE_ENTRIES * (1ul <<L2_PAGETABLE_SHIFT ); + +while ( addr < end_addr ) + { +l2e_write (l2++,l2e_from_paddr (addr, __PAGE_HYPERVISOR | _PAGE_PSE)); -typedef void (*relocate_new_kernel_t )( -unsigned long indirection_page, -unsigned long *page_list, -unsigned long start_address, -unsigned int preserve_context); + addr +=1ul <<L2_PAGETABLE_SHIFT ; + } +} -int machine_kexec_load (int type,int slot,xen_kexec_image_t *image) +static int init_level3_page (struct kexec_image *image,l3_pgentry_t *l3, +unsigned long addr,unsigned long last_addr) { -unsigned long prev_ma =0 ; -int fix_base =FIX_KEXEC_BASE_0 + (slot * (KEXEC_XEN_NO_PAGES >>1 )); -int k; +unsigned long end_addr; -/* setup fixmap to point to our pages and record the virtual address -* in every odd index in page_list[]. -*/ + addr &=PAGE_MASK ; + end_addr = addr +L3_PAGETABLE_ENTRIES * (1ul <<L3_PAGETABLE_SHIFT ); + +while ( (addr < last_addr) && (addr < end_addr) ) + { +struct page_info *l2_page; +l2_pgentry_t *l2; + + l2_page =kimage_alloc_control_page (image); +if ( !l2_page ) +return -ENOMEM ; + l2 =page_to_virt (l2_page); + +init_level2_page (l2, addr); +l3e_write (l3++,l3e_from_page (l2_page, __PAGE_HYPERVISOR)); + + addr +=1ul <<L3_PAGETABLE_SHIFT ; + } + +return 0 ; +} + +/* +* Build a complete page table to identity map [addr, last_addr). +* +* Control pages are used so they do not overlap with the image source +* or destination. +*/ +static int init_level4_page (struct kexec_image *image,l4_pgentry_t *l4, +unsigned long addr,unsigned long last_addr) +{ +unsigned long end_addr; +int result; + + addr &=PAGE_MASK ; + end_addr = addr +L4_PAGETABLE_ENTRIES * (1ul <<L4_PAGETABLE_SHIFT ); + +while ( (addr < last_addr) && (addr < end_addr) ) + { +struct page_info *l3_page; +l3_pgentry_t *l3; + + l3_page =kimage_alloc_control_page (image); +if ( !l3_page ) +return -ENOMEM ; + l3 =page_to_virt (l3_page); + + result =init_level3_page (image, l3, addr, last_addr); +if (result) +return result; +l4e_write (l4++,l4e_from_page (l3_page, __PAGE_HYPERVISOR)); + + addr +=1ul <<L4_PAGETABLE_SHIFT ; + } + +return 0 ; +} -for ( k =0 ; k <KEXEC_XEN_NO_PAGES ; k++ ) +/* +* Add a mapping for the control code page to the same virtual address +* as kexec_reloc. This allows us to keep running after these page +* tables are loaded in kexec_reloc. +* +* We don't really need to allocate control pages here as these +* entries won't be used while the kexec image is being copied, but it +* makes clean-up easier. +*/ +static int init_transition_pgtable (struct kexec_image *image,l4_pgentry_t *l4) +{ +struct page_info *l3_page; +struct page_info *l2_page; +struct page_info *l1_page; +unsigned long vaddr, paddr; +l3_pgentry_t *l3; +l2_pgentry_t *l2; +l1_pgentry_t *l1; + + vaddr = (unsigned long )kexec_reloc; + paddr =page_to_maddr (image->control_code_page); + + l4 +=l4_table_offset (vaddr); +if ( !(l4e_get_flags (*l4) & _PAGE_PRESENT) ) + { + l3_page =kimage_alloc_control_page (image); +if ( !l3_page ) +return -ENOMEM ; +l4e_write (l4,l4e_from_page (l3_page, __PAGE_HYPERVISOR)); + } + + l3 =l4e_to_l3e (*l4) +l3_table_offset (vaddr); +if ( !(l3e_get_flags (*l3) & _PAGE_PRESENT) ) + { + l2_page =kimage_alloc_control_page (image); +if ( !l2_page ) +return -ENOMEM ; +l3e_write (l3,l3e_from_page (l2_page, __PAGE_HYPERVISOR)); + } + + l2 =l3e_to_l2e (*l3) +l2_table_offset (vaddr); +if ( !(l2e_get_flags (*l2) & _PAGE_PRESENT) ) + { + l1_page =kimage_alloc_control_page (image); +if ( !l1_page ) +return -ENOMEM ; +l2e_write (l2,l2e_from_page (l1_page, __PAGE_HYPERVISOR)); + } + + l1 =l2e_to_l1e (*l2) +l1_table_offset (vaddr); +l1e_write (l1,l1e_from_pfn (paddr >>PAGE_SHIFT , __PAGE_HYPERVISOR)); +return 0 ; +} + + +static int build_reloc_page_table (struct kexec_image *image) +{ +struct page_info *l4_page; +l4_pgentry_t *l4; +int result; + + l4_page =kimage_alloc_control_page (image); +if ( !l4_page ) +return -ENOMEM ; + + l4 =page_to_virt (l4_page); + result =init_level4_page (image, l4,0 , max_page <<PAGE_SHIFT ); +if ( result ) +return result; + + result =init_transition_pgtable (image, l4); +if ( result ) +return result; + + image->aux_page = l4_page; +return 0 ; +} + +int machine_kexec_load (struct kexec_image *image) +{ +void *code_page; +int ret; + +switch ( image->arch ) { -if ( (k &1 ) ==0 ) - { -/* Even pages: machine address. */ - prev_ma = image->page_list[k]; - } -else - { -/* Odd pages: va for previous ma. */ -if (is_pv_32on64_domain (dom0) ) - { -/* -* The compatability bounce code sets up a page table -* with a 1-1 mapping of the first 1G of memory so -* VA==PA here. -* -* This Linux purgatory code still sets up separate -* high and low mappings on the control page (entries -* 0 and 1) but it is harmless if they are equal since -* that PT is not live at the time. -*/ - image->page_list[k] = prev_ma; - } -else - { -set_fixmap (fix_base + (k >>1 ), prev_ma); - image->page_list[k] =fix_to_virt (fix_base + (k >>1 )); - } - } +case EM_386 : +case EM_X86_64 : +break ; +default : +return -EINVAL ; } + code_page =page_to_virt (image->control_code_page); +memcpy (code_page, kexec_reloc,PAGE_SIZE ); + + ret =build_reloc_page_table (image); +if ( ret <0 ) +return ret; +return 0 ; } -void machine_kexec_unload (int type,int slot,xen_kexec_image_t *image) +void machine_kexec_unload (struct kexec_image *image) { +/* no-op. kimage_free() frees all control pages. */ } -void machine_reboot_kexec (xen_kexec_image_t *image) +void machine_reboot_kexec (struct kexec_image *image) {BUG_ON (smp_processor_id () !=0 );smp_send_stop ();
@@ -75,13 +216,10 @@ void machine_reboot_kexec(xen_kexec_image_t *image)BUG (); } -void machine_kexec (xen_kexec_image_t *image) +void machine_kexec (struct kexec_image *image) { -struct desc_ptr gdt_desc = { - .base = (unsigned long )(boot_cpu_gdt_table -FIRST_RESERVED_GDT_ENTRY ), - .limit =LAST_RESERVED_GDT_BYTE - };int i; +unsigned long reloc_flags =0 ;/* We are about to permenantly jump out of the Xen context into the kexec * purgatory code. We really dont want to be still servicing interupts.
@@ -109,29 +247,12 @@ void machine_kexec(xen_kexec_image_t *image)* not like running with NMIs disabled. */ enable_nmis (); -/* -* compat_machine_kexec() returns to idle pagetables, which requires us -* to be running on a static GDT mapping (idle pagetables have no GDT -* mappings in their per-domain mapping area). -*/ - asmvolatile ("lgdt %0" : :"m" (gdt_desc) ); +if ( image->arch ==EM_386 ) + reloc_flags |=KEXEC_RELOC_FLAG_COMPAT ; -if (is_pv_32on64_domain (dom0) ) - { -compat_machine_kexec (image->page_list[1 ], - image->indirection_page, - image->page_list, - image->start_address); - } -else - { -relocate_new_kernel_t rnk; - - rnk = (relocate_new_kernel_t ) image->page_list[1 ]; - (*rnk)(image->indirection_page, image->page_list, - image->start_address, -0 /* preserve_context */ ); - } +kexec_reloc (page_to_maddr (image->control_code_page), +page_to_maddr (image->aux_page), + image->head, image->entry_maddr, reloc_flags); }int machine_kexec_get (xen_kexec_range_t *range)
xen/arch/x86/x86_64/Makefile +1 -1
@@ -11,11 +11,11 @@ obj-y += mmconf-fam10h.o obj-y += mmconfig_64.o obj-y += mmconfig-shared.o obj-y += compat.o -obj-bin-y += compat_kexec.o obj-y += domain.o obj-y += physdev.o obj-y += platform_hypercall.o obj-y += cpu_idle.o obj-y += cpufreq.o +obj-bin-y += kexec_reloc.o obj-$(crash_debug) += gdbstub.o
xen/arch/x86/x86_64/compat_kexec.S deleted +0 -187
187 lines not on this page · raw message
xen/arch/x86/x86_64/kexec_reloc.S new file +229 -0
229 lines not on this page · raw message
xen/common/kexec.c +315 -62
474 lines not on this page · raw message
xen/include/asm-x86/fixmap.h +0 -3
@@ -57,9 +57,6 @@ 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 ,FIX_IOMMU_REGS_BASE_0 ,FIX_IOMMU_REGS_END =FIX_IOMMU_REGS_BASE_0 +MAX_IOMMUS -1 , FIX_IOMMU_MMIO_BASE_0,
xen/include/asm-x86/machine_kexec.h new file +14 -0
@@ -0,0 +1,14 @@ +#ifndef __X86_MACHINE_KEXEC_H__ +#define __X86_MACHINE_KEXEC_H__ + +#define KEXEC_RELOC_FLAG_COMPAT 0x1/* 32-bit image */ + +#ifndef __ASSEMBLY__ + +extern void kexec_reloc (unsigned long reloc_code,unsigned long reloc_pt, +unsigned long ind_maddr,unsigned long entry_maddr, +unsigned long flags); + +#endif + +#endif /* __X86_MACHINE_KEXEC_H__ */
xen/include/xen/kexec.h +5 -9
@@ -6,6 +6,7 @@#include <public/kexec.h> #include <asm/percpu.h> #include <xen/elfcore.h> +#include <xen/kimage.h> typedef struct xen_kexec_reserve { unsigned long size;
@@ -40,11 +41,11 @@ extern enum low_crashinfo low_crashinfo_mode;extern paddr_t crashinfo_maxaddr_bits;void kexec_early_calculations (void ); -int machine_kexec_load (int type,int slot,xen_kexec_image_t *image); -void machine_kexec_unload (int type,int slot,xen_kexec_image_t *image); +int machine_kexec_load (struct kexec_image *image); +void machine_kexec_unload (struct kexec_image *image);void machine_kexec_reserved (xen_kexec_reserve_t *reservation); -void machine_reboot_kexec (xen_kexec_image_t *image); -void machine_kexec (xen_kexec_image_t *image); +void machine_reboot_kexec (struct kexec_image *image); +void machine_kexec (struct kexec_image *image);void kexec_crash (void );void kexec_crash_save_cpu (void );crash_xen_info_t *kexec_crash_save_info (void );
@@ -52,11 +53,6 @@ void machine_crash_shutdown(void);int machine_kexec_get (xen_kexec_range_t *range);int machine_kexec_get_xen (xen_kexec_range_t *range); -void compat_machine_kexec (unsigned long rnk, -unsigned long indirection_page, -unsigned long *page_list, -unsigned long start_address); -/* vmcoreinfo stuff */ #define VMCOREINFO_BYTES (4096)#define VMCOREINFO_NOTE_NAME "VMCOREINFO_XEN"
Signature · 7 lines
1.7.2.5 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
Quoted 32 lines · David Vrabel
From: David Vrabel <[email protected]>
In the existing kexec hypercall, the load and unload ops depend on internals of the Linux kernel (the page list and code page provided by the kernel). The code page is used to transition between Xen context and the image so using kernel code doesn't make sense and will not work for PVH guests.
Add replacement
KEXEC_CMD_kexec_loadandKEXEC_CMD_kexec_unloadops that no longer require a code page to be provided by the guest -- Xen now provides the code for calling the image directly.The new load op looks similar to the Linux
kexec_loadsystem call and allows the guest to provide the image data to be loaded. The guest specifies the architecture of the image which may be a 32-bit subarch of the hypervisor's architecture (i.e., anEM_386image on anEM_X86_64hypervisor).The toolstack can now load images without kernel involvement. This is required for supporting kexec when using a dom0 with an upstream kernel.
Crash images are copied directly into the crash region on load. Default images are copied into Xen heap pages and a list of source and destination machine addresses is created. This is list is used in
kexec_reloc()to relocate the image to its destination.The old load and unload sub-ops are still available (as
KEXEC_CMD_load_v1andKEXEC_CMD_unload_v1) and are implemented on top of the new infrastructure.Signed-off-by David Vrabel <[email protected]>
[...]
Quoted 30 lines
xen/arch/x86/x86_64/kexec_reloc.S new file +24
-0@@ -0,0 +1,229 @@ +/* + * Relocate a kexec_image to its destination and call it. + * + * Copyright (C) 2013 Citrix Systems R&D Ltd. + * + * Portions derived from Linux's arch/x86/kernel/relocate_kernel_64.S. + * + * Copyright (C) 2002-2005 Eric Biederman <[email protected]> + * + * This source code is licensed under the GNU General Public License, + * Version 2. See the file COPYING for more details. + */ +#include <xen/config.h> + +#include <asm/asm_defns.h> +#include <asm/msr.h> +#include <asm/page.h> +#include <asm/machine_kexec.h> + +/* The unrelocated physical address of a symbol. */ +#define SYM_PHYS(sym) ((sym) - __XEN_VIRT_START) + +/* Load physical address of symbol into register and relocate it. */ +#define RELOCATE_SYM(sym,reg) mov $SYM_PHYS(sym), reg ; \
xen/arch/x86/x86_64/kexec_reloc.S line 34
Quoted 10 lines
xen/arch/x86/x86_64/kexec_reloc.S new file +10
-0+ add xen_phys_start(%rip), reg + +#define DBG(c) \ +1: mov $0x3f8+5, %dx ; \ + inb %dx, %al ; \ + test $0x20, %al ; \ + je 1b ; \ + mov $0x3f8, %dx ; \ + mov $c, %al ; \ + outb %al, %dx ;
Nice feature but I think that it is dangerous to write to serial port unconditionally. There are a lot of machines in the wild which do not have coms these days. Maybe it should be enabled if Xen is compiled with debug feature. Then serial port address should be established on the base of console argument.
Daniel
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
In reply to David VrabelQuoted 32 lines · David Vrabel
From: David Vrabel <[email protected]>
In the existing kexec hypercall, the load and unload ops depend on internals of the Linux kernel (the page list and code page provided by the kernel). The code page is used to transition between Xen context and the image so using kernel code doesn't make sense and will not work for PVH guests.
Add replacement
KEXEC_CMD_kexec_loadandKEXEC_CMD_kexec_unloadops that no longer require a code page to be provided by the guest -- Xen now provides the code for calling the image directly.The new load op looks similar to the Linux
kexec_loadsystem call and allows the guest to provide the image data to be loaded. The guest specifies the architecture of the image which may be a 32-bit subarch of the hypervisor's architecture (i.e., anEM_386image on anEM_X86_64hypervisor).The toolstack can now load images without kernel involvement. This is required for supporting kexec when using a dom0 with an upstream kernel.
Crash images are copied directly into the crash region on load. Default images are copied into Xen heap pages and a list of source and destination machine addresses is created. This is list is used in
kexec_reloc()to relocate the image to its destination.The old load and unload sub-ops are still available (as
KEXEC_CMD_load_v1andKEXEC_CMD_unload_v1) and are implemented on top of the new infrastructure.Signed-off-by David Vrabel <[email protected]>
[...]
Quoted 30 lines
xen/arch/x86/x86_64/kexec_reloc.S new file +24
-0@@ -0,0 +1,229 @@ +/* + * Relocate a kexec_image to its destination and call it. + * + * Copyright (C) 2013 Citrix Systems R&D Ltd. + * + * Portions derived from Linux's arch/x86/kernel/relocate_kernel_64.S. + * + * Copyright (C) 2002-2005 Eric Biederman <[email protected]> + * + * This source code is licensed under the GNU General Public License, + * Version 2. See the file COPYING for more details. + */ +#include <xen/config.h> + +#include <asm/asm_defns.h> +#include <asm/msr.h> +#include <asm/page.h> +#include <asm/machine_kexec.h> + +/* The unrelocated physical address of a symbol. */ +#define SYM_PHYS(sym) ((sym) - __XEN_VIRT_START) + +/* Load physical address of symbol into register and relocate it. */ +#define RELOCATE_SYM(sym,reg) mov $SYM_PHYS(sym), reg ; \
xen/arch/x86/x86_64/kexec_reloc.S line 34
Quoted 10 lines
xen/arch/x86/x86_64/kexec_reloc.S new file +10
-0+ add xen_phys_start(%rip), reg + +#define DBG(c) \ +1: mov $0x3f8+5, %dx ; \ + inb %dx, %al ; \ + test $0x20, %al ; \ + je 1b ; \ + mov $0x3f8, %dx ; \ + mov $c, %al ; \ + outb %al, %dx ;
Nice feature but I think that it is dangerous to write to serial port unconditionally. There are a lot of machines in the wild which do not have coms these days. Maybe it should be enabled if Xen is compiled with debug feature. Then serial port address should be established on the base of console argument.
Daniel
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [Xen-devel] [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
In reply to David VrabelQuoted 5 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Crash images are copied directly into the crash region on load. Default images are copied into Xen heap pages and a list of source and destination machine addresses is created. This is list is used in
kexec_reloc()to relocate the image to its destination.
Did you carefully consider the implications of using Xen heap pages here as opposed to domain heap ones? On huge systems, this may prevent kexec from working, as you're not just trying to allocate a handful of pages. IOW, is the less complex code really worth the increased likelihood of a failure here?
Jan
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
Quoted 11 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Crash images are copied directly into the crash region on load. Default images are copied into Xen heap pages and a list of source and destination machine addresses is created. This is list is used in
kexec_reloc()to relocate the image to its destination.Did you carefully consider the implications of using Xen heap pages here as opposed to domain heap ones? On huge systems, this may prevent kexec from working, as you're not just trying to allocate a handful of pages. IOW, is the less complex code really worth the increased likelihood of a failure here?
I wouldn't say carefully considered... I thought about using dom heap briefly and took the lazy route.
I take your point though and will change it to use the dom heap. Is there a way to verify that all the map/unmaps are correctly done and it isn't just working by chance? Some sort of debug option?
David
Re: [Xen-devel] [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
In reply to Jan BeulichQuoted 11 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Crash images are copied directly into the crash region on load. Default images are copied into Xen heap pages and a list of source and destination machine addresses is created. This is list is used in
kexec_reloc()to relocate the image to its destination.Did you carefully consider the implications of using Xen heap pages here as opposed to domain heap ones? On huge systems, this may prevent kexec from working, as you're not just trying to allocate a handful of pages. IOW, is the less complex code really worth the increased likelihood of a failure here?
I wouldn't say carefully considered... I thought about using dom heap briefly and took the lazy route.
I take your point though and will change it to use the dom heap. Is there a way to verify that all the map/unmaps are correctly done and it isn't just working by chance? Some sort of debug option?
David
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [Xen-devel] [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
Quoted 4 lines
Quoted 1 line
Quoted 1 line · David Vrabel
I take your point though and will change it to use the dom heap. Is there a way to verify that all the map/unmaps are correctly done and it isn't just working by chance? Some sort of debug option?
Not currently (other than running out of map space at some point, resulting in a BUG_ON() to trigger).
Jan
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
In reply to David VrabelQuoted 4 lines
Quoted 1 line
Quoted 1 line · David Vrabel
I take your point though and will change it to use the dom heap. Is there a way to verify that all the map/unmaps are correctly done and it isn't just working by chance? Some sort of debug option?
Not currently (other than running out of map space at some point, resulting in a BUG_ON() to trigger).
Jan
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
In reply to David VrabelQuoted 5 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Crash images are copied directly into the crash region on load. Default images are copied into Xen heap pages and a list of source and destination machine addresses is created. This is list is used in
kexec_reloc()to relocate the image to its destination.
Did you carefully consider the implications of using Xen heap pages here as opposed to domain heap ones? On huge systems, this may prevent kexec from working, as you're not just trying to allocate a handful of pages. IOW, is the less complex code really worth the increased likelihood of a failure here?
Jan
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
In reply to David VrabelQuoted 32 lines · David Vrabel
From: David Vrabel <[email protected]>
In the existing kexec hypercall, the load and unload ops depend on internals of the Linux kernel (the page list and code page provided by the kernel). The code page is used to transition between Xen context and the image so using kernel code doesn't make sense and will not work for PVH guests.
Add replacement
KEXEC_CMD_kexec_loadandKEXEC_CMD_kexec_unloadops that no longer require a code page to be provided by the guest -- Xen now provides the code for calling the image directly.The new load op looks similar to the Linux
kexec_loadsystem call and allows the guest to provide the image data to be loaded. The guest specifies the architecture of the image which may be a 32-bit subarch of the hypervisor's architecture (i.e., anEM_386image on anEM_X86_64hypervisor).The toolstack can now load images without kernel involvement. This is required for supporting kexec when using a dom0 with an upstream kernel.
Crash images are copied directly into the crash region on load. Default images are copied into Xen heap pages and a list of source and destination machine addresses is created. This is list is used in
kexec_reloc()to relocate the image to its destination.The old load and unload sub-ops are still available (as
KEXEC_CMD_load_v1andKEXEC_CMD_unload_v1) and are implemented on top of the new infrastructure.Signed-off-by David Vrabel <[email protected]>
[...]
Quoted 91 lines
xen/arch/x86/x86_64/kexec_reloc.S new file +85
-0@@ -0,0 +1,229 @@ +/* + * Relocate a kexec_image to its destination and call it. + * + * Copyright (C) 2013 Citrix Systems R&D Ltd. + * + * Portions derived from Linux's arch/x86/kernel/relocate_kernel_64.S. + * + * Copyright (C) 2002-2005 Eric Biederman <[email protected]> + * + * This source code is licensed under the GNU General Public License, + * Version 2. See the file COPYING for more details. + */ +#include <xen/config.h> + +#include <asm/asm_defns.h> +#include <asm/msr.h> +#include <asm/page.h> +#include <asm/machine_kexec.h> + +/* The unrelocated physical address of a symbol. */ +#define SYM_PHYS(sym) ((sym) - __XEN_VIRT_START) + +/* Load physical address of symbol into register and relocate it. */ +#define RELOCATE_SYM(sym,reg) mov $SYM_PHYS(sym), reg ; \ + add xen_phys_start(%rip), reg + +#define DBG(c) \ +1: mov $0x3f8+5, %dx ; \ + inb %dx, %al ; \ + test $0x20, %al ; \ + je 1b ; \ + mov $0x3f8, %dx ; \ + mov $c, %al ; \ + outb %al, %dx ; + + .text + .align PAGE_SIZE + .code64 + +ENTRY(kexec_reloc) + /* %rdi - code_page maddr */ + /* %rsi - page table maddr */ + /* %rdx - indirection page maddr */ + /* %rcx - entry maddr */ + /* %r8 - flags */ + + mov %rdx, %rbx + + DBG('A') + + /* Setup stack. */ + RELOCATE_SYM(reloc_stack, %rax) + mov %rax, %rsp + + DBG('B') + + wbinvd + movq %cr4, %rax + andq $~(X86_CR4_PGE|X86_CR4_PCE|X86_CR4_MCE), %rax + movq %rax, %cr4 + + /* Load reloc page table. */ + movq %rsi, %cr3 + + DBG('C') + + /* Jump to identity mapped code. */ + movq %rdi, %r9 + addq $(identity_mapped - kexec_reloc), %r9 + + DBG('D') + + jmp *%r9 + +identity_mapped: + DBG('E') + + pushq %rcx + pushq %rbx + pushq %rsi + pushq %rdi + + movq %rbx, %rdi + call swap_pages +
xen/arch/x86/x86_64/kexec_reloc.S line 95
Quoted 10 lines
xen/arch/x86/x86_64/kexec_reloc.S new file +10
-0+ popq %rdi + popq %rsi + popq %rbx + popq %rcx + + DBG('F') + + /* Need to switch to 32-bit mode? */ + testq $KEXEC_RELOC_FLAG_COMPAT, %r8 + jnz call_32_bit
Why do you need that? This is not needed because purgatory code from kexec-tools always switches to 32-bit mode. Please check kexec-tools/purgatory/arch/x86_64/entry64.S.
Daniel
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
In reply to David VrabelQuoted 32 lines · David Vrabel
From: David Vrabel <[email protected]>
In the existing kexec hypercall, the load and unload ops depend on internals of the Linux kernel (the page list and code page provided by the kernel). The code page is used to transition between Xen context and the image so using kernel code doesn't make sense and will not work for PVH guests.
Add replacement
KEXEC_CMD_kexec_loadandKEXEC_CMD_kexec_unloadops that no longer require a code page to be provided by the guest -- Xen now provides the code for calling the image directly.The new load op looks similar to the Linux
kexec_loadsystem call and allows the guest to provide the image data to be loaded. The guest specifies the architecture of the image which may be a 32-bit subarch of the hypervisor's architecture (i.e., anEM_386image on anEM_X86_64hypervisor).The toolstack can now load images without kernel involvement. This is required for supporting kexec when using a dom0 with an upstream kernel.
Crash images are copied directly into the crash region on load. Default images are copied into Xen heap pages and a list of source and destination machine addresses is created. This is list is used in
kexec_reloc()to relocate the image to its destination.The old load and unload sub-ops are still available (as
KEXEC_CMD_load_v1andKEXEC_CMD_unload_v1) and are implemented on top of the new infrastructure.Signed-off-by David Vrabel <[email protected]>
[...]
Quoted 91 lines
xen/arch/x86/x86_64/kexec_reloc.S new file +85
-0@@ -0,0 +1,229 @@ +/* + * Relocate a kexec_image to its destination and call it. + * + * Copyright (C) 2013 Citrix Systems R&D Ltd. + * + * Portions derived from Linux's arch/x86/kernel/relocate_kernel_64.S. + * + * Copyright (C) 2002-2005 Eric Biederman <[email protected]> + * + * This source code is licensed under the GNU General Public License, + * Version 2. See the file COPYING for more details. + */ +#include <xen/config.h> + +#include <asm/asm_defns.h> +#include <asm/msr.h> +#include <asm/page.h> +#include <asm/machine_kexec.h> + +/* The unrelocated physical address of a symbol. */ +#define SYM_PHYS(sym) ((sym) - __XEN_VIRT_START) + +/* Load physical address of symbol into register and relocate it. */ +#define RELOCATE_SYM(sym,reg) mov $SYM_PHYS(sym), reg ; \ + add xen_phys_start(%rip), reg + +#define DBG(c) \ +1: mov $0x3f8+5, %dx ; \ + inb %dx, %al ; \ + test $0x20, %al ; \ + je 1b ; \ + mov $0x3f8, %dx ; \ + mov $c, %al ; \ + outb %al, %dx ; + + .text + .align PAGE_SIZE + .code64 + +ENTRY(kexec_reloc) + /* %rdi - code_page maddr */ + /* %rsi - page table maddr */ + /* %rdx - indirection page maddr */ + /* %rcx - entry maddr */ + /* %r8 - flags */ + + mov %rdx, %rbx + + DBG('A') + + /* Setup stack. */ + RELOCATE_SYM(reloc_stack, %rax) + mov %rax, %rsp + + DBG('B') + + wbinvd + movq %cr4, %rax + andq $~(X86_CR4_PGE|X86_CR4_PCE|X86_CR4_MCE), %rax + movq %rax, %cr4 + + /* Load reloc page table. */ + movq %rsi, %cr3 + + DBG('C') + + /* Jump to identity mapped code. */ + movq %rdi, %r9 + addq $(identity_mapped - kexec_reloc), %r9 + + DBG('D') + + jmp *%r9 + +identity_mapped: + DBG('E') + + pushq %rcx + pushq %rbx + pushq %rsi + pushq %rdi + + movq %rbx, %rdi + call swap_pages +
xen/arch/x86/x86_64/kexec_reloc.S line 95
Quoted 10 lines
xen/arch/x86/x86_64/kexec_reloc.S new file +10
-0+ popq %rdi + popq %rsi + popq %rbx + popq %rcx + + DBG('F') + + /* Need to switch to 32-bit mode? */ + testq $KEXEC_RELOC_FLAG_COMPAT, %r8 + jnz call_32_bit
Why do you need that? This is not needed because purgatory code from kexec-tools always switches to 32-bit mode. Please check kexec-tools/purgatory/arch/x86_64/entry64.S.
Daniel
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
Quoted 9 lines · Daniel Kiper
xen/arch/x86/x86_64/kexec_reloc.S line 95
Quoted 4 lines · David Vrabel
xen/arch/x86/x86_64/kexec_reloc.S new file +3
-0+ /* Need to switch to 32-bit mode? */ + testq $KEXEC_RELOC_FLAG_COMPAT, %r8 + jnz call_32_bitWhy do you need that? This is not needed because purgatory code from kexec-tools always switches to 32-bit mode. Please check
kexec-tools/purgatory/arch/x86_64/entry64.S.
The sub-architecture is a property of the image. Why should the tool know or care about the sub-architecture of the hypervisor?
The ABI isn't designed only for kexec-tools.
David
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
In reply to Daniel KiperQuoted 9 lines · Daniel Kiper
xen/arch/x86/x86_64/kexec_reloc.S line 95
Quoted 4 lines · David Vrabel
xen/arch/x86/x86_64/kexec_reloc.S new file +3
-0+ /* Need to switch to 32-bit mode? */ + testq $KEXEC_RELOC_FLAG_COMPAT, %r8 + jnz call_32_bitWhy do you need that? This is not needed because purgatory code from kexec-tools always switches to 32-bit mode. Please check
kexec-tools/purgatory/arch/x86_64/entry64.S.
The sub-architecture is a property of the image. Why should the tool know or care about the sub-architecture of the hypervisor?
The ABI isn't designed only for kexec-tools.
David
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
Quoted 7 lines · David Vrabel
Quoted 6 lines · Daniel Kiper
Quoted 4 lines · David Vrabel
xen/arch/x86/x86_64/kexec_reloc.S new file +3
-0+ /* Need to switch to 32-bit mode? */ + testq $KEXEC_RELOC_FLAG_COMPAT, %r8 + jnz call_32_bit
Quoted 8 lines
Quoted 3 lines
Why do you need that? This is not needed because purgatory code from kexec-tools always switches to 32-bit mode. Please check
kexec-tools/purgatory/arch/x86_64/entry64.S.The sub-architecture is a property of the image. Why should the tool know or care about the sub-architecture of the hypervisor?
The ABI isn't designed only for kexec-tools.
OK, but I think it is much easier to assume that machine state is not changed by kexec syscall/hypercall and move out this task to separate module (in this case purgatory code) which does all needed things (in this case sets it to "native" mode which is close to machine state after BIOS initialization; as I know this assumption is common for other architectures too). This way you could get what you need (e.g. 64-bit -> 64-bit, 64-bit -> 32-bit, ...) without changing a single instruction in hypervisor or kernel. Just do changes in purgatory (it could be called differently in your private kexec-tool) and voila.
Additionally, you duplicate code which exists and works well.
Daniel
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
In reply to David VrabelQuoted 7 lines · David Vrabel
Quoted 6 lines · Daniel Kiper
Quoted 4 lines · David Vrabel
xen/arch/x86/x86_64/kexec_reloc.S new file +3
-0+ /* Need to switch to 32-bit mode? */ + testq $KEXEC_RELOC_FLAG_COMPAT, %r8 + jnz call_32_bit
Quoted 8 lines
Quoted 3 lines
Why do you need that? This is not needed because purgatory code from kexec-tools always switches to 32-bit mode. Please check
kexec-tools/purgatory/arch/x86_64/entry64.S.The sub-architecture is a property of the image. Why should the tool know or care about the sub-architecture of the hypervisor?
The ABI isn't designed only for kexec-tools.
OK, but I think it is much easier to assume that machine state is not changed by kexec syscall/hypercall and move out this task to separate module (in this case purgatory code) which does all needed things (in this case sets it to "native" mode which is close to machine state after BIOS initialization; as I know this assumption is common for other architectures too). This way you could get what you need (e.g. 64-bit -> 64-bit, 64-bit -> 32-bit, ...) without changing a single instruction in hypervisor or kernel. Just do changes in purgatory (it could be called differently in your private kexec-tool) and voila.
Additionally, you duplicate code which exists and works well.
Daniel
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
Quoted 12 lines · Daniel Kiper
Quoted 11 lines · David Vrabel
Quoted 9 lines · Daniel Kiper
xen/arch/x86/x86_64/kexec_reloc.S line 95
Quoted 4 lines · David Vrabel
xen/arch/x86/x86_64/kexec_reloc.S new file +3
-0+ /* Need to switch to 32-bit mode? */ + testq $KEXEC_RELOC_FLAG_COMPAT, %r8 + jnz call_32_bitWhy do you need that? This is not needed because purgatory code from kexec-tools always switches to 32-bit mode. Please check
kexec-tools/purgatory/arch/x86_64/entry64.S.
Quoted 7 lines
Quoted 4 lines
The sub-architecture is a property of the image. Why should the tool know or care about the sub-architecture of the hypervisor?
The ABI isn't designed only for kexec-tools.
OK, but I think it is much easier to assume that machine state is not changed by kexec syscall/hypercall
What machine state is that? The one seen by the tools or the guest kernel or by the hypervisor?
The tools know what mode the image must be called it and it can tell the hypervisor and the hypervisor can trivial setup the correct mode.
I propose:
* Tools say: "here's an image, call it in mode X".
You suggest:
* Hypervisor implicitly says through some unspecified side channel: "I only call images in mode Y".
* Tools says: "here's an image. I set it up for mode Y. I hope that works for you."
Finally, the v1 interface will call images loaded by a 32-bit dom0 kernel in 32-bit mode and we need to do continue to do the same.
Quoted 1 line
Additionally, you duplicate code which exists and works well.
It's only 17 instructions and 6 bytes of data.
David
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
In reply to Daniel KiperQuoted 12 lines · Daniel Kiper
Quoted 11 lines · David Vrabel
Quoted 9 lines · Daniel Kiper
xen/arch/x86/x86_64/kexec_reloc.S line 95
Quoted 4 lines · David Vrabel
xen/arch/x86/x86_64/kexec_reloc.S new file +3
-0+ /* Need to switch to 32-bit mode? */ + testq $KEXEC_RELOC_FLAG_COMPAT, %r8 + jnz call_32_bitWhy do you need that? This is not needed because purgatory code from kexec-tools always switches to 32-bit mode. Please check
kexec-tools/purgatory/arch/x86_64/entry64.S.
Quoted 7 lines
Quoted 4 lines
The sub-architecture is a property of the image. Why should the tool know or care about the sub-architecture of the hypervisor?
The ABI isn't designed only for kexec-tools.
OK, but I think it is much easier to assume that machine state is not changed by kexec syscall/hypercall
What machine state is that? The one seen by the tools or the guest kernel or by the hypervisor?
The tools know what mode the image must be called it and it can tell the hypervisor and the hypervisor can trivial setup the correct mode.
I propose:
* Tools say: "here's an image, call it in mode X".
You suggest:
* Hypervisor implicitly says through some unspecified side channel: "I only call images in mode Y".
* Tools says: "here's an image. I set it up for mode Y. I hope that works for you."
Finally, the v1 interface will call images loaded by a 32-bit dom0 kernel in 32-bit mode and we need to do continue to do the same.
Quoted 1 line
Additionally, you duplicate code which exists and works well.
It's only 17 instructions and 6 bytes of data.
David
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
Quoted 16 lines · David Vrabel
Quoted 15 lines · Daniel Kiper
Quoted 14 lines · David Vrabel
Quoted 9 lines · Daniel Kiper
xen/arch/x86/x86_64/kexec_reloc.S line 95
Quoted 4 lines · David Vrabel
xen/arch/x86/x86_64/kexec_reloc.S new file +3
-0+ /* Need to switch to 32-bit mode? */ + testq $KEXEC_RELOC_FLAG_COMPAT, %r8 + jnz call_32_bitWhy do you need that? This is not needed because purgatory code from kexec-tools always switches to 32-bit mode. Please check
kexec-tools/purgatory/arch/x86_64/entry64.S.The sub-architecture is a property of the image. Why should the tool know or care about the sub-architecture of the hypervisor?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
The ABI isn't designed only for kexec-tools.
OK, but I think it is much easier to assume that machine state is not changed by kexec syscall/hypercall
What machine state is that? The one seen by the tools or the guest kernel or by the hypervisor?
State of machine set by hypervisor before purgatory call.
Quoted 11 lines
The tools know what mode the image must be called it and it can tell the hypervisor and the hypervisor can trivial setup the correct mode.
I propose:
* Tools say: "here's an image, call it in mode X".
You suggest:
* Hypervisor implicitly says through some unspecified side channel: "I only call images in mode Y".
Purgatory is clearly defined. Please look into kexec-tools/purgatory. It is integral part of kexec infrastructure.
Quoted 2 lines
* Tools says: "here's an image. I set it up for mode Y. I hope that works for you."
New kernel is never called directly by old kernel in current kexec implementations. New system is always started in following way:
old_kernel -> purgatory -> new_kernel
What purgatory does I described earlier more or less.
Why do you want change that? It works on many architectures. Why do we need something different for Xen (and Xen only)? If we choose existing solution we do not lose any flexiblity. Additionally, we could maintain compatibilty at least with Linux for nothing.
Quoted 2 lines
Finally, the v1 interface will call images loaded by a 32-bit dom0 kernel in 32-bit mode and we need to do continue to do the same.
Purgatory does it. It is used even with current
Xen kexec implementation.
Quoted 3 lines
Quoted 1 line
Additionally, you duplicate code which exists and works well.
It's only 17 instructions and 6 bytes of data.
For me it is always worth to optimize code. In this case too. However, to be precise, if you remove this unneeded code then you could gain PAGE_SIZE - 1 bytes in worst case. Just remove .align PAGE_SIZE in xen/xen/arch/x86/x86_64/kexec_reloc.S.
Daniel
Re: [Xen-devel] [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
<snip>
Quoted 5 lines
Quoted 5 lines
The tools know what mode the image must be called it and it can tell the hypervisor and the hypervisor can trivial setup the correct mode.
I propose:
Quoted 8 lines
Quoted 6 lines
* Tools say: "here's an image, call it in mode X".
You suggest:
* Hypervisor implicitly says through some unspecified side channel: "I only call images in mode Y".
Purgatory is clearly defined. Please look into kexec-tools/purgatory. It is integral part of kexec infrastructure.
Purgatory might be well defined, but that is not relevant here.
The kexec syscall and hypercall basically amount to "Here is a blob. Its architecture is $X and its entry point is $Y" (Give or take some reconstruction)
Xen should not be making any assumptions about these things.
As it currently stands, Xen will assume that KEXEC_load from a pv_32on64 domain is an i386 image, while a KEXEC_load from a 64bit PV domain is an x86_64 image.
The fact that this currently works in the common case of having the crash kernel with the same architecture as the dom0 kernel is by luck rather than good guidance.
Furthmore, the design of the interface should not be deliberately crippled because the common user of it "can deal with it like this"; kexec-tools is not the only potential consumer of this interface.
~Andrew
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
Quoted 12 lines · Andrew Cooper
<snip>
Quoted 11 lines
Quoted 11 lines
The tools know what mode the image must be called it and it can tell the hypervisor and the hypervisor can trivial setup the correct mode.
I propose:
* Tools say: "here's an image, call it in mode X".
You suggest:
* Hypervisor implicitly says through some unspecified side channel: "I only call images in mode Y".
Quoted 7 lines
Quoted 2 lines
Purgatory is clearly defined. Please look into kexec-tools/purgatory. It is integral part of kexec infrastructure.
Purgatory might be well defined, but that is not relevant here.
The kexec syscall and hypercall basically amount to "Here is a blob. Its architecture is $X and its entry point is $Y"
kexec syscall use architecture information to check that given image could be executed on given platform. That is all.
Quoted 1 line
(Give or take some reconstruction)
What does this reconstruction? Hypervisor?
Quoted 5 lines
Xen should not be making any assumptions about these things.
As it currently stands, Xen will assume that
KEXEC_loadfrom apv_32on64domain is an i386 image, while aKEXEC_loadfrom a 64bit PV domain is anx86_64image.
I do not understand. First you write that "Xen should not be making any assumptions about these things" and in the next sentence you state that "Xen will assume that...". What do you mean by that?
And why do you force users to use image for one architecture (in this case subarchitecture)? I (as a user) would like to have a choice.
Quoted 3 lines
The fact that this currently works in the common case of having the crash kernel with the same architecture as the dom0 kernel is by luck rather than good guidance.
OK, I agree but in this case following part of patch 5/8:
if ( image->arch == EM_386 )
reloc_flags |= KEXEC_RELOC_FLAG_COMPAT;
should be change to:
if ( is_pv_32on64_domain(dom0) )
reloc_flags |= KEXEC_RELOC_FLAG_COMPAT;
Quoted 2 lines
Furthmore, the design of the interface should not be deliberately crippled because the common user of it "can deal with it like this";
If something is good and tested in many ways, on many architectures, very long time, why not use it? What is the difference between Xen and other architectures?
Quoted 1 line
kexec-tools is not the only potential consumer of this interface.
Potentialy yes but as I know (correct me if I am wrong) kexec-tools is only one tool, until now, which uses kexec syscall/hypercall. If we use this tool we should align to widely accepted rules. If we do not like them then we should convince maintainers that our approach is better or write our own tool with our own rules. But then we should not call it kexec.
Daniel
Re: [Xen-devel] [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
In reply to Andrew CooperQuoted 12 lines · Andrew Cooper
<snip>
Quoted 11 lines
Quoted 11 lines
The tools know what mode the image must be called it and it can tell the hypervisor and the hypervisor can trivial setup the correct mode.
I propose:
* Tools say: "here's an image, call it in mode X".
You suggest:
* Hypervisor implicitly says through some unspecified side channel: "I only call images in mode Y".
Quoted 7 lines
Quoted 2 lines
Purgatory is clearly defined. Please look into kexec-tools/purgatory. It is integral part of kexec infrastructure.
Purgatory might be well defined, but that is not relevant here.
The kexec syscall and hypercall basically amount to "Here is a blob. Its architecture is $X and its entry point is $Y"
kexec syscall use architecture information to check that given image could be executed on given platform. That is all.
Quoted 1 line
(Give or take some reconstruction)
What does this reconstruction? Hypervisor?
Quoted 5 lines
Xen should not be making any assumptions about these things.
As it currently stands, Xen will assume that
KEXEC_loadfrom apv_32on64domain is an i386 image, while aKEXEC_loadfrom a 64bit PV domain is anx86_64image.
I do not understand. First you write that "Xen should not be making any assumptions about these things" and in the next sentence you state that "Xen will assume that...". What do you mean by that?
And why do you force users to use image for one architecture (in this case subarchitecture)? I (as a user) would like to have a choice.
Quoted 3 lines
The fact that this currently works in the common case of having the crash kernel with the same architecture as the dom0 kernel is by luck rather than good guidance.
OK, I agree but in this case following part of patch 5/8:
if ( image->arch == EM_386 )
reloc_flags |= KEXEC_RELOC_FLAG_COMPAT;
should be change to:
if ( is_pv_32on64_domain(dom0) )
reloc_flags |= KEXEC_RELOC_FLAG_COMPAT;
Quoted 2 lines
Furthmore, the design of the interface should not be deliberately crippled because the common user of it "can deal with it like this";
If something is good and tested in many ways, on many architectures, very long time, why not use it? What is the difference between Xen and other architectures?
Quoted 1 line
kexec-tools is not the only potential consumer of this interface.
Potentialy yes but as I know (correct me if I am wrong) kexec-tools is only one tool, until now, which uses kexec syscall/hypercall. If we use this tool we should align to widely accepted rules. If we do not like them then we should convince maintainers that our approach is better or write our own tool with our own rules. But then we should not call it kexec.
Daniel
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
Quoted 13 lines · Daniel Kiper
Quoted 12 lines · Andrew Cooper
<snip>
Quoted 11 lines
Quoted 11 lines
The tools know what mode the image must be called it and it can tell the hypervisor and the hypervisor can trivial setup the correct mode.
I propose:
* Tools say: "here's an image, call it in mode X".
You suggest:
* Hypervisor implicitly says through some unspecified side channel: "I only call images in mode Y".
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Purgatory is clearly defined. Please look into kexec-tools/purgatory. It is integral part of kexec infrastructure.
Purgatory might be well defined, but that is not relevant here.
The kexec syscall and hypercall basically amount to "Here is a blob. Its architecture is $X and its entry point is $Y"
kexec syscall use architecture information to check that given image could be executed on given platform. That is all.
And how is 'could' distinguished?
A basic sanity check at load time of "is $X an operating mode I can get to at some point in the future" is fine, and useful to eliminate the case of trying to load something claiming to be an ARM blob on an x86 machine.
However, the entry point given can only possibly work in one operating mode. If $X is i386 and Xen jumps to it with long mode enabled, then it will crash very quickly. Conversely, if $X is x86_64 and Xen jumps to it in protected mode, another crash will occur.
Quoted 3 lines
Quoted 2 lines
(Give or take some reconstruction)
What does this reconstruction? Hypervisor?
Under the current implementation, the dom0 kernel. Under the new planned implementation, Xen.
Quoted 9 lines
Quoted 6 lines
Xen should not be making any assumptions about these things.
As it currently stands, Xen will assume that
KEXEC_loadfrom apv_32on64domain is an i386 image, while aKEXEC_loadfrom a 64bit PV domain is anx86_64image.I do not understand. First you write that "Xen should not be making any assumptions about these things" and in the next sentence you state that "Xen will assume that...". What do you mean by that?
Sorry for the confustion - That is what happens in the current implementation.
Quoted 3 lines
And why do you force users to use image for one architecture (in this case subarchitecture)? I (as a user) would like to have a choice.
The image can do whatever it wants once it is running.
Quoted 6 lines
Quoted 4 lines
The fact that this currently works in the common case of having the crash kernel with the same architecture as the dom0 kernel is by luck rather than good guidance.
OK, I agree but in this case following part of patch 5/8:
Quoted 7 lines
if (
image->arch==EM_386)
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;should be change to:
if (
is_pv_32on64_domain(dom0))
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;
No - specifically not. This is the whole problem we are trying to avoid.
The current running architecture of dom0 has no place trying to second-guess the intended architecture of the blob.
What happens if I as the user am currently running a 32bit dom0 on 64 bit Xen, and want to load a 64bit blob to jump to?
Under your suggestion, I as the user have to declare it to be a 32bit blob and write a 32->64 shim at the beginning of it. Under Davids suggestion, all I as the user have to do is to tell Xen that it is indeed a 64bit image.
Quoted 6 lines
Quoted 3 lines
Furthmore, the design of the interface should not be deliberately crippled because the common user of it "can deal with it like this";
If something is good and tested in many ways, on many architectures, very long time, why not use it? What is the difference between Xen and other architectures?
argumentum ad antiquitatem
Not that I wish to jibe at kexec-tools, but to point out the fallacy of an argument on that basis.
About "good and tested", the current kexec handover mechanism is insane, and is frankly a miracle it ever worked in the first place.
Lets take the example of a 32bit dom0 on 64bit Xen and a 32bit crash kernel
(The following is to the best of my understanding, so apologies if I have misunderstood bits)
1) /sbin/kexec bundles a 32bit kernel and initrd, along with purgatory etc and makes a kexec system call
2) dom0 copies the segments into regular kalloc()'d chunks
3) dom0 constructs a control page, bundles some control state together and makes a kexec hypercall
4) Xen saves the control data and overwrites the dom0 provided virtual addresses
In the case of a crash
1) Xen writes crash notes and shuts down as fast as possible
2) Because dom0 is 32bit, Xen sets up 32bit mode non-pae 1:1mapped and 3a) might die there and then because the control page living in dom0 kalloc()'d space might now be above the 4GB boundary
3b) be lucky that the control page is below the 4GB and
4) Execute the control page which sets up 32bit mode non-pae 1:1mapped (on a different set of pagetables/GDT etc)
5) Works to reconstruct the image in the crash region which 6a) might copy in the wrong block because of 32bit truncation issues
7) Jump to the beginning of purgatory which sets up 32bit mode
And amongst all of that, I am still unsure of whether there are other issues because of an "unsigned long page_list[]" in the 64bit hypervisor being different from the "unsigned long page_list[]" used by the 32bit control page. In machine_kexec_load() in the hypervisor, we make no sanity checks against the assertions of the comments.
In the proposed new interface, we do not need to set up the correct state for purgatory, jump into the dom0 control page which re-sets up different equivalent state, just to reconstruct the image and jump to it.
As for the different architecture of Xen, I hope the above shows exacly why it is different, and why it is dangerous to use assumptions based on is_pv_32on64_domain(dom0)
Quoted 10 lines
Quoted 2 lines
kexec-tools is not the only potential consumer of this interface.
Potentialy yes but as I know (correct me if I am wrong) kexec-tools is only one tool, until now, which uses kexec syscall/hypercall. If we use this tool we should align to widely accepted rules. If we do not like them then we should convince maintainers that our approach is better or write our own tool with our own rules. But then we should not call it kexec.
Daniel
I see no reason why Davids proposed interface is incompatible with kexec-tools. Do you?
~Andrew
Re: [Xen-devel] [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
In reply to Daniel KiperQuoted 13 lines · Daniel Kiper
Quoted 12 lines · Andrew Cooper
<snip>
Quoted 11 lines
Quoted 11 lines
The tools know what mode the image must be called it and it can tell the hypervisor and the hypervisor can trivial setup the correct mode.
I propose:
* Tools say: "here's an image, call it in mode X".
You suggest:
* Hypervisor implicitly says through some unspecified side channel: "I only call images in mode Y".
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Purgatory is clearly defined. Please look into kexec-tools/purgatory. It is integral part of kexec infrastructure.
Purgatory might be well defined, but that is not relevant here.
The kexec syscall and hypercall basically amount to "Here is a blob. Its architecture is $X and its entry point is $Y"
kexec syscall use architecture information to check that given image could be executed on given platform. That is all.
And how is 'could' distinguished?
A basic sanity check at load time of "is $X an operating mode I can get to at some point in the future" is fine, and useful to eliminate the case of trying to load something claiming to be an ARM blob on an x86 machine.
However, the entry point given can only possibly work in one operating mode. If $X is i386 and Xen jumps to it with long mode enabled, then it will crash very quickly. Conversely, if $X is x86_64 and Xen jumps to it in protected mode, another crash will occur.
Quoted 3 lines
Quoted 2 lines
(Give or take some reconstruction)
What does this reconstruction? Hypervisor?
Under the current implementation, the dom0 kernel. Under the new planned implementation, Xen.
Quoted 9 lines
Quoted 6 lines
Xen should not be making any assumptions about these things.
As it currently stands, Xen will assume that
KEXEC_loadfrom apv_32on64domain is an i386 image, while aKEXEC_loadfrom a 64bit PV domain is anx86_64image.I do not understand. First you write that "Xen should not be making any assumptions about these things" and in the next sentence you state that "Xen will assume that...". What do you mean by that?
Sorry for the confustion - That is what happens in the current implementation.
Quoted 3 lines
And why do you force users to use image for one architecture (in this case subarchitecture)? I (as a user) would like to have a choice.
The image can do whatever it wants once it is running.
Quoted 6 lines
Quoted 4 lines
The fact that this currently works in the common case of having the crash kernel with the same architecture as the dom0 kernel is by luck rather than good guidance.
OK, I agree but in this case following part of patch 5/8:
Quoted 7 lines
if (
image->arch==EM_386)
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;should be change to:
if (
is_pv_32on64_domain(dom0))
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;
No - specifically not. This is the whole problem we are trying to avoid.
The current running architecture of dom0 has no place trying to second-guess the intended architecture of the blob.
What happens if I as the user am currently running a 32bit dom0 on 64 bit Xen, and want to load a 64bit blob to jump to?
Under your suggestion, I as the user have to declare it to be a 32bit blob and write a 32->64 shim at the beginning of it. Under Davids suggestion, all I as the user have to do is to tell Xen that it is indeed a 64bit image.
Quoted 6 lines
Quoted 3 lines
Furthmore, the design of the interface should not be deliberately crippled because the common user of it "can deal with it like this";
If something is good and tested in many ways, on many architectures, very long time, why not use it? What is the difference between Xen and other architectures?
argumentum ad antiquitatem
Not that I wish to jibe at kexec-tools, but to point out the fallacy of an argument on that basis.
About "good and tested", the current kexec handover mechanism is insane, and is frankly a miracle it ever worked in the first place.
Lets take the example of a 32bit dom0 on 64bit Xen and a 32bit crash kernel
(The following is to the best of my understanding, so apologies if I have misunderstood bits)
1) /sbin/kexec bundles a 32bit kernel and initrd, along with purgatory etc and makes a kexec system call
2) dom0 copies the segments into regular kalloc()'d chunks
3) dom0 constructs a control page, bundles some control state together and makes a kexec hypercall
4) Xen saves the control data and overwrites the dom0 provided virtual addresses
In the case of a crash
1) Xen writes crash notes and shuts down as fast as possible
2) Because dom0 is 32bit, Xen sets up 32bit mode non-pae 1:1mapped and 3a) might die there and then because the control page living in dom0 kalloc()'d space might now be above the 4GB boundary
3b) be lucky that the control page is below the 4GB and
4) Execute the control page which sets up 32bit mode non-pae 1:1mapped (on a different set of pagetables/GDT etc)
5) Works to reconstruct the image in the crash region which 6a) might copy in the wrong block because of 32bit truncation issues
7) Jump to the beginning of purgatory which sets up 32bit mode
And amongst all of that, I am still unsure of whether there are other issues because of an "unsigned long page_list[]" in the 64bit hypervisor being different from the "unsigned long page_list[]" used by the 32bit control page. In machine_kexec_load() in the hypervisor, we make no sanity checks against the assertions of the comments.
In the proposed new interface, we do not need to set up the correct state for purgatory, jump into the dom0 control page which re-sets up different equivalent state, just to reconstruct the image and jump to it.
As for the different architecture of Xen, I hope the above shows exacly why it is different, and why it is dangerous to use assumptions based on is_pv_32on64_domain(dom0)
Quoted 10 lines
Quoted 2 lines
kexec-tools is not the only potential consumer of this interface.
Potentialy yes but as I know (correct me if I am wrong) kexec-tools is only one tool, until now, which uses kexec syscall/hypercall. If we use this tool we should align to widely accepted rules. If we do not like them then we should convince maintainers that our approach is better or write our own tool with our own rules. But then we should not call it kexec.
Daniel
I see no reason why Davids proposed interface is incompatible with kexec-tools. Do you?
~Andrew
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
Quoted 30 lines · Andrew Cooper
Quoted 13 lines · Daniel Kiper
Quoted 12 lines · Andrew Cooper
<snip>
Quoted 11 lines
Quoted 11 lines
The tools know what mode the image must be called it and it can tell the hypervisor and the hypervisor can trivial setup the correct mode.
I propose:
* Tools say: "here's an image, call it in mode X".
You suggest:
* Hypervisor implicitly says through some unspecified side channel: "I only call images in mode Y".
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Purgatory is clearly defined. Please look into kexec-tools/purgatory. It is integral part of kexec infrastructure.
Purgatory might be well defined, but that is not relevant here.
The kexec syscall and hypercall basically amount to "Here is a blob. Its architecture is $X and its entry point is $Y"
kexec syscall use architecture information to check that given image could be executed on given platform. That is all.
And how is 'could' distinguished?
A basic sanity check at load time of "is $X an operating mode I can get to at some point in the future" is fine, and useful to eliminate the case of trying to load something claiming to be an ARM blob on an x86 machine.
Quoted 4 lines
However, the entry point given can only possibly work in one operating mode. If $X is i386 and Xen jumps to it with long mode enabled, then it will crash very quickly. Conversely, if $X is
x86_64and Xen jumps to it in protected mode, another crash will occur.
It always works because purgatory sets "native mode". It means that machine before execution of new kernel is in state like it would be after BIOS initialization. It is assumption for all architectures and it is always done by purgatory.
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
(Give or take some reconstruction)
What does this reconstruction? Hypervisor?
Under the current implementation, the dom0 kernel. Under the new planned implementation, Xen.
What do you mean by reconstruction? Setting to "native mode"?
[...]
Quoted 18 lines
Quoted 5 lines
Quoted 3 lines
The fact that this currently works in the common case of having the crash kernel with the same architecture as the dom0 kernel is by luck rather than good guidance.
OK, I agree but in this case following part of patch 5/8:
Quoted 7 lines
if (
image->arch==EM_386)
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;should be change to:
if (
is_pv_32on64_domain(dom0))
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;No - specifically not. This is the whole problem we are trying to avoid.
The current running architecture of dom0 has no place trying to second-guess the intended architecture of the blob.
Quoted 7 lines
What happens if I as the user am currently running a 32bit dom0 on 64 bit Xen, and want to load a 64bit blob to jump to?
Under your suggestion, I as the user have to declare it to be a 32bit blob and write a 32->64 shim at the beginning of it. Under Davids suggestion, all I as the user have to do is to tell Xen that it is indeed a 64bit image.
You forgot about purgatory code. Just reminder:
old_kernel (Xen) -> purgatory (native mode) -> new_kernel
purgatory architecture is same as kexec-tools architecture. If you use dom0 i386 it means that kexec-tools is (and must be) i386 too. We do not support Xen i386 anymore. It means that my condition is correct.
Quoted 65 lines
Quoted 5 lines
Quoted 2 lines
Furthmore, the design of the interface should not be deliberately crippled because the common user of it "can deal with it like this";
If something is good and tested in many ways, on many architectures, very long time, why not use it? What is the difference between Xen and other architectures?
argumentum ad antiquitatem
Not that I wish to jibe at kexec-tools, but to point out the fallacy of an argument on that basis.
About "good and tested", the current kexec handover mechanism is insane, and is frankly a miracle it ever worked in the first place.
Lets take the example of a 32bit dom0 on 64bit Xen and a 32bit crash kernel
(The following is to the best of my understanding, so apologies if I have misunderstood bits)
1)
/sbin/kexecbundles a 32bit kernel and initrd, along with purgatory etc and makes a kexec system call
2) dom0 copies the segments into regular kalloc()'d chunks
3) dom0 constructs a control page, bundles some control state together and makes a kexec hypercall
4) Xen saves the control data and overwrites the dom0 provided virtual addressesIn the case of a crash
1) Xen writes crash notes and shuts down as fast as possible
2) Because dom0 is 32bit, Xen sets up 32bit mode non-pae 1:1mapped and 3a) might die there and then because the control page living in dom0 kalloc()'d space might now be above the 4GB boundary
3b) be lucky that the control page is below the 4GB and
4) Execute the control page which sets up 32bit mode non-pae 1:1mapped (on a different set of pagetables/GDT etc)
5) Works to reconstruct the image in the crash region which 6a) might copy in the wrong block because of 32bit truncation issues
7) Jump to the beginning of purgatory which sets up 32bit modeAnd amongst all of that, I am still unsure of whether there are other issues because of an "unsigned long page_list[]" in the 64bit hypervisor being different from the "unsigned long page_list[]" used by the 32bit control page. In
machine_kexec_load()in the hypervisor, we make no sanity checks against the assertions of the comments.In the proposed new interface, we do not need to set up the correct state for purgatory, jump into the dom0 control page which re-sets up different equivalent state, just to reconstruct the image and jump to it.
As for the different architecture of Xen, I hope the above shows exacly why it is different, and why it is dangerous to use assumptions based on
is_pv_32on64_domain(dom0)Quoted 9 lines
Quoted 2 lines
kexec-tools is not the only potential consumer of this interface.
Potentialy yes but as I know (correct me if I am wrong) kexec-tools is only one tool, until now, which uses kexec syscall/hypercall. If we use this tool we should align to widely accepted rules. If we do not like them then we should convince maintainers that our approach is better or write our own tool with our own rules. But then we should not call it kexec.
Quoted 4 lines
Quoted 1 line
Daniel
I see no reason why Davids proposed interface is incompatible with kexec-tools. Do you?
Heh... It looks that there is a misunderstanding. At first I thought that David was going to replace purgatory functionality by switching from 64-bit to 32-bit in kexec_reloc. But later I realized that I missed Xen 64-bit/dom 32-bit case. Now I agree that this switch must stay as is. However, now I think that there is another small mistake which should be fixed. Please look above.
Daniel
Re: [Xen-devel] [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
In reply to Andrew CooperQuoted 30 lines · Andrew Cooper
Quoted 13 lines · Daniel Kiper
Quoted 12 lines · Andrew Cooper
<snip>
Quoted 11 lines
Quoted 11 lines
The tools know what mode the image must be called it and it can tell the hypervisor and the hypervisor can trivial setup the correct mode.
I propose:
* Tools say: "here's an image, call it in mode X".
You suggest:
* Hypervisor implicitly says through some unspecified side channel: "I only call images in mode Y".
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Purgatory is clearly defined. Please look into kexec-tools/purgatory. It is integral part of kexec infrastructure.
Purgatory might be well defined, but that is not relevant here.
The kexec syscall and hypercall basically amount to "Here is a blob. Its architecture is $X and its entry point is $Y"
kexec syscall use architecture information to check that given image could be executed on given platform. That is all.
And how is 'could' distinguished?
A basic sanity check at load time of "is $X an operating mode I can get to at some point in the future" is fine, and useful to eliminate the case of trying to load something claiming to be an ARM blob on an x86 machine.
Quoted 4 lines
However, the entry point given can only possibly work in one operating mode. If $X is i386 and Xen jumps to it with long mode enabled, then it will crash very quickly. Conversely, if $X is
x86_64and Xen jumps to it in protected mode, another crash will occur.
It always works because purgatory sets "native mode". It means that machine before execution of new kernel is in state like it would be after BIOS initialization. It is assumption for all architectures and it is always done by purgatory.
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
(Give or take some reconstruction)
What does this reconstruction? Hypervisor?
Under the current implementation, the dom0 kernel. Under the new planned implementation, Xen.
What do you mean by reconstruction? Setting to "native mode"?
[...]
Quoted 18 lines
Quoted 5 lines
Quoted 3 lines
The fact that this currently works in the common case of having the crash kernel with the same architecture as the dom0 kernel is by luck rather than good guidance.
OK, I agree but in this case following part of patch 5/8:
Quoted 7 lines
if (
image->arch==EM_386)
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;should be change to:
if (
is_pv_32on64_domain(dom0))
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;No - specifically not. This is the whole problem we are trying to avoid.
The current running architecture of dom0 has no place trying to second-guess the intended architecture of the blob.
Quoted 7 lines
What happens if I as the user am currently running a 32bit dom0 on 64 bit Xen, and want to load a 64bit blob to jump to?
Under your suggestion, I as the user have to declare it to be a 32bit blob and write a 32->64 shim at the beginning of it. Under Davids suggestion, all I as the user have to do is to tell Xen that it is indeed a 64bit image.
You forgot about purgatory code. Just reminder:
old_kernel (Xen) -> purgatory (native mode) -> new_kernel
purgatory architecture is same as kexec-tools architecture. If you use dom0 i386 it means that kexec-tools is (and must be) i386 too. We do not support Xen i386 anymore. It means that my condition is correct.
Quoted 65 lines
Quoted 5 lines
Quoted 2 lines
Furthmore, the design of the interface should not be deliberately crippled because the common user of it "can deal with it like this";
If something is good and tested in many ways, on many architectures, very long time, why not use it? What is the difference between Xen and other architectures?
argumentum ad antiquitatem
Not that I wish to jibe at kexec-tools, but to point out the fallacy of an argument on that basis.
About "good and tested", the current kexec handover mechanism is insane, and is frankly a miracle it ever worked in the first place.
Lets take the example of a 32bit dom0 on 64bit Xen and a 32bit crash kernel
(The following is to the best of my understanding, so apologies if I have misunderstood bits)
1)
/sbin/kexecbundles a 32bit kernel and initrd, along with purgatory etc and makes a kexec system call
2) dom0 copies the segments into regular kalloc()'d chunks
3) dom0 constructs a control page, bundles some control state together and makes a kexec hypercall
4) Xen saves the control data and overwrites the dom0 provided virtual addressesIn the case of a crash
1) Xen writes crash notes and shuts down as fast as possible
2) Because dom0 is 32bit, Xen sets up 32bit mode non-pae 1:1mapped and 3a) might die there and then because the control page living in dom0 kalloc()'d space might now be above the 4GB boundary
3b) be lucky that the control page is below the 4GB and
4) Execute the control page which sets up 32bit mode non-pae 1:1mapped (on a different set of pagetables/GDT etc)
5) Works to reconstruct the image in the crash region which 6a) might copy in the wrong block because of 32bit truncation issues
7) Jump to the beginning of purgatory which sets up 32bit modeAnd amongst all of that, I am still unsure of whether there are other issues because of an "unsigned long page_list[]" in the 64bit hypervisor being different from the "unsigned long page_list[]" used by the 32bit control page. In
machine_kexec_load()in the hypervisor, we make no sanity checks against the assertions of the comments.In the proposed new interface, we do not need to set up the correct state for purgatory, jump into the dom0 control page which re-sets up different equivalent state, just to reconstruct the image and jump to it.
As for the different architecture of Xen, I hope the above shows exacly why it is different, and why it is dangerous to use assumptions based on
is_pv_32on64_domain(dom0)Quoted 9 lines
Quoted 2 lines
kexec-tools is not the only potential consumer of this interface.
Potentialy yes but as I know (correct me if I am wrong) kexec-tools is only one tool, until now, which uses kexec syscall/hypercall. If we use this tool we should align to widely accepted rules. If we do not like them then we should convince maintainers that our approach is better or write our own tool with our own rules. But then we should not call it kexec.
Quoted 4 lines
Quoted 1 line
Daniel
I see no reason why Davids proposed interface is incompatible with kexec-tools. Do you?
Heh... It looks that there is a misunderstanding. At first I thought that David was going to replace purgatory functionality by switching from 64-bit to 32-bit in kexec_reloc. But later I realized that I missed Xen 64-bit/dom 32-bit case. Now I agree that this switch must stay as is. However, now I think that there is another small mistake which should be fixed. Please look above.
Daniel
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
Quoted 7 lines · Daniel Kiper
Heh... It looks that there is a misunderstanding. At first I thought that David was going to replace purgatory functionality by switching from 64-bit to 32-bit in
kexec_reloc. But later I realized that I missed Xen 64-bit/dom 32-bit case. Now I agree that this switch must stay as is. However, now I think that there is another small mistake which should be fixed. Please look above.
Which mistake? I'm not sure what you're referring to.
David
Re: [Xen-devel] [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
In reply to Daniel KiperQuoted 7 lines · Daniel Kiper
Heh... It looks that there is a misunderstanding. At first I thought that David was going to replace purgatory functionality by switching from 64-bit to 32-bit in
kexec_reloc. But later I realized that I missed Xen 64-bit/dom 32-bit case. Now I agree that this switch must stay as is. However, now I think that there is another small mistake which should be fixed. Please look above.
Which mistake? I'm not sure what you're referring to.
David
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
Quoted 10 lines · David Vrabel
Quoted 7 lines · Daniel Kiper
Heh... It looks that there is a misunderstanding. At first I thought that David was going to replace purgatory functionality by switching from 64-bit to 32-bit in
kexec_reloc. But later I realized that I missed Xen 64-bit/dom 32-bit case. Now I agree that this switch must stay as is. However, now I think that there is another small mistake which should be fixed. Please look above.Which mistake? I'm not sure what you're referring to.
I thought about that:
if ( image->arch == EM_386 )
reloc_flags |= KEXEC_RELOC_FLAG_COMPAT;
It should be change to:
if ( is_pv_32on64_domain(dom0) )
reloc_flags |= KEXEC_RELOC_FLAG_COMPAT;
Daniel
Re: [Xen-devel] [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
In reply to David VrabelQuoted 10 lines · David Vrabel
Quoted 7 lines · Daniel Kiper
Heh... It looks that there is a misunderstanding. At first I thought that David was going to replace purgatory functionality by switching from 64-bit to 32-bit in
kexec_reloc. But later I realized that I missed Xen 64-bit/dom 32-bit case. Now I agree that this switch must stay as is. However, now I think that there is another small mistake which should be fixed. Please look above.Which mistake? I'm not sure what you're referring to.
I thought about that:
if ( image->arch == EM_386 )
reloc_flags |= KEXEC_RELOC_FLAG_COMPAT;
It should be change to:
if ( is_pv_32on64_domain(dom0) )
reloc_flags |= KEXEC_RELOC_FLAG_COMPAT;
Daniel
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
Quoted 14 lines · Daniel Kiper
Quoted 10 lines · David Vrabel
Quoted 7 lines · Daniel Kiper
Heh... It looks that there is a misunderstanding. At first I thought that David was going to replace purgatory functionality by switching from 64-bit to 32-bit in
kexec_reloc. But later I realized that I missed Xen 64-bit/dom 32-bit case. Now I agree that this switch must stay as is. However, now I think that there is another small mistake which should be fixed. Please look above.Which mistake? I'm not sure what you're referring to.
I thought about that:
Quoted 7 lines
if (
image->arch==EM_386)
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;It should be change to:
if (
is_pv_32on64_domain(dom0))
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;
This isn't a mistake but a deliberate improvement to the old interface.
It is clearer and more useful for this sub-architecture to be explicitly supplied in the kexec_load call than implicitly through some other side-channel.
If we go with what you suggest then you prevent kexec from being used
by: a) PVH dom0s; b) suitably privileged service domains; c) 32-bit guests wanting to load an image with a 64-bit entry point; and d) possibly other use cases you or I haven't even thought about yet.
David
Re: [Xen-devel] [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
In reply to Daniel KiperQuoted 14 lines · Daniel Kiper
Quoted 10 lines · David Vrabel
Quoted 7 lines · Daniel Kiper
Heh... It looks that there is a misunderstanding. At first I thought that David was going to replace purgatory functionality by switching from 64-bit to 32-bit in
kexec_reloc. But later I realized that I missed Xen 64-bit/dom 32-bit case. Now I agree that this switch must stay as is. However, now I think that there is another small mistake which should be fixed. Please look above.Which mistake? I'm not sure what you're referring to.
I thought about that:
Quoted 7 lines
if (
image->arch==EM_386)
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;It should be change to:
if (
is_pv_32on64_domain(dom0))
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;
This isn't a mistake but a deliberate improvement to the old interface.
It is clearer and more useful for this sub-architecture to be explicitly supplied in the kexec_load call than implicitly through some other side-channel.
If we go with what you suggest then you prevent kexec from being used
by: a) PVH dom0s; b) suitably privileged service domains; c) 32-bit guests wanting to load an image with a 64-bit entry point; and d) possibly other use cases you or I haven't even thought about yet.
David
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
Quoted 18 lines · David Vrabel
Quoted 17 lines · Daniel Kiper
Quoted 10 lines · David Vrabel
Quoted 7 lines · Daniel Kiper
Heh... It looks that there is a misunderstanding. At first I thought that David was going to replace purgatory functionality by switching from 64-bit to 32-bit in
kexec_reloc. But later I realized that I missed Xen 64-bit/dom 32-bit case. Now I agree that this switch must stay as is. However, now I think that there is another small mistake which should be fixed. Please look above.Which mistake? I'm not sure what you're referring to.
I thought about that:
if (
image->arch==EM_386)
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;
Quoted 6 lines
Quoted 4 lines
It should be change to:
if (
is_pv_32on64_domain(dom0))
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;This isn't a mistake but a deliberate improvement to the old interface.
I am still not convinced.
Quoted 3 lines
It is clearer and more useful for this sub-architecture to be explicitly supplied in the
kexec_loadcall than implicitly through some other side-channel.
First of all you do not need to pass any info about architecure to new kernel or something like that (please check my previous emails). If any then there is another questions. What do you do if you need second or third argument?. You redefine kexec interface once again. For what? Additionally, currently there are a lot of stuff passed to new kernel via purgatory. And purgatory is called by your interface too...
Quoted 2 lines
If we go with what you suggest then you prevent kexec from being used
by: a) PVH dom0s; b) suitably privileged service domains; c) 32-bit
Maybe for PVH should be different check. However,
until now we do not have it in Xen yet.
Quoted 1 line
guests wanting to load an image with a 64-bit entry point; and d)
Once again:
old_kernel (Xen) -> purgatory (native mode) -> new_kernel
purgatory architecture is same as kexec-tools architecture. If you use dom0 i386 it means that kexec-tools is (and must be) i386 too. We do not support Xen i386 anymore. It means that my condition is correct.
Daniel
Re: [Xen-devel] [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
In reply to David VrabelQuoted 18 lines · David Vrabel
Quoted 17 lines · Daniel Kiper
Quoted 10 lines · David Vrabel
Quoted 7 lines · Daniel Kiper
Heh... It looks that there is a misunderstanding. At first I thought that David was going to replace purgatory functionality by switching from 64-bit to 32-bit in
kexec_reloc. But later I realized that I missed Xen 64-bit/dom 32-bit case. Now I agree that this switch must stay as is. However, now I think that there is another small mistake which should be fixed. Please look above.Which mistake? I'm not sure what you're referring to.
I thought about that:
if (
image->arch==EM_386)
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;
Quoted 6 lines
Quoted 4 lines
It should be change to:
if (
is_pv_32on64_domain(dom0))
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;This isn't a mistake but a deliberate improvement to the old interface.
I am still not convinced.
Quoted 3 lines
It is clearer and more useful for this sub-architecture to be explicitly supplied in the
kexec_loadcall than implicitly through some other side-channel.
First of all you do not need to pass any info about architecure to new kernel or something like that (please check my previous emails). If any then there is another questions. What do you do if you need second or third argument?. You redefine kexec interface once again. For what? Additionally, currently there are a lot of stuff passed to new kernel via purgatory. And purgatory is called by your interface too...
Quoted 2 lines
If we go with what you suggest then you prevent kexec from being used
by: a) PVH dom0s; b) suitably privileged service domains; c) 32-bit
Maybe for PVH should be different check. However,
until now we do not have it in Xen yet.
Quoted 1 line
guests wanting to load an image with a 64-bit entry point; and d)
Once again:
old_kernel (Xen) -> purgatory (native mode) -> new_kernel
purgatory architecture is same as kexec-tools architecture. If you use dom0 i386 it means that kexec-tools is (and must be) i386 too. We do not support Xen i386 anymore. It means that my condition is correct.
Daniel
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
Quoted 20 lines · Daniel Kiper
Quoted 19 lines · David Vrabel
Quoted 18 lines · Daniel Kiper
Quoted 8 lines · David Vrabel
Quoted 6 lines · Daniel Kiper
Heh... It looks that there is a misunderstanding. At first I thought that David was going to replace purgatory functionality by switching from 64-bit to 32-bit in
kexec_reloc. But later I realized that I missed Xen 64-bit/dom 32-bit case. Now I agree that this switch must stay as is. However, now I think that there is another small mistake which should be fixed. Please look above.Which mistake? I'm not sure what you're referring to.
I thought about that:
if (
image->arch==EM_386)
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;It should be change to:
if (
is_pv_32on64_domain(dom0))
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;
Quoted 8 lines
Quoted 1 line
This isn't a mistake but a deliberate improvement to the old interface.
I am still not convinced.
Quoted 3 lines
It is clearer and more useful for this sub-architecture to be explicitly supplied in the
kexec_loadcall than implicitly through some other side-channel.First of all you do not need to pass any info about architecure to new kernel or something like that (please check my previous emails).
Yes - you really do. Guessing the architecture of a blob of code is insane, and any current interface which relies on this guessing is broken by design.
Quoted 14 lines
If any then there is another questions. What do you do if you need second or third argument?. You redefine kexec interface once again. For what? Additionally, currently there are a lot of stuff passed to new kernel via purgatory. And purgatory is called by your interface too...
Quoted 2 lines
If we go with what you suggest then you prevent kexec from being used
by: a) PVH dom0s; b) suitably privileged service domains; c) 32-bitMaybe for PVH should be different check. However,
until now we do not have it in Xen yet.Quoted 1 line
guests wanting to load an image with a 64-bit entry point; and d)
Once again:
Quoted 8 lines
old_kernel(Xen) -> purgatory (native mode) ->new_kernelpurgatory architecture is same as kexec-tools architecture. If you use dom0 i386 it means that kexec-tools is (and must be) i386 too. We do not support Xen i386 anymore. It means that my condition is correct.
Daniel
And what happens when kexec-tools is using ia32-libs under a 64bit dom0? That would also break.
The logic is very simple.
If the blob passed in kexec_load claims to be 32bit, Xen will switch into 32bit mode before executing it. If the blob claims to be 64 bit then Xen will stay in 64bit mode before executing it.
This way, purgatory from any kind of multi-arch setup in dom0 will work, as well as all of the other usecases which your suggestion breaks.
~Andrew
Re: [Xen-devel] [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
In reply to Daniel KiperQuoted 20 lines · Daniel Kiper
Quoted 19 lines · David Vrabel
Quoted 18 lines · Daniel Kiper
Quoted 8 lines · David Vrabel
Quoted 6 lines · Daniel Kiper
Heh... It looks that there is a misunderstanding. At first I thought that David was going to replace purgatory functionality by switching from 64-bit to 32-bit in
kexec_reloc. But later I realized that I missed Xen 64-bit/dom 32-bit case. Now I agree that this switch must stay as is. However, now I think that there is another small mistake which should be fixed. Please look above.Which mistake? I'm not sure what you're referring to.
I thought about that:
if (
image->arch==EM_386)
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;It should be change to:
if (
is_pv_32on64_domain(dom0))
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;
Quoted 8 lines
Quoted 1 line
This isn't a mistake but a deliberate improvement to the old interface.
I am still not convinced.
Quoted 3 lines
It is clearer and more useful for this sub-architecture to be explicitly supplied in the
kexec_loadcall than implicitly through some other side-channel.First of all you do not need to pass any info about architecure to new kernel or something like that (please check my previous emails).
Yes - you really do. Guessing the architecture of a blob of code is insane, and any current interface which relies on this guessing is broken by design.
Quoted 14 lines
If any then there is another questions. What do you do if you need second or third argument?. You redefine kexec interface once again. For what? Additionally, currently there are a lot of stuff passed to new kernel via purgatory. And purgatory is called by your interface too...
Quoted 2 lines
If we go with what you suggest then you prevent kexec from being used
by: a) PVH dom0s; b) suitably privileged service domains; c) 32-bitMaybe for PVH should be different check. However,
until now we do not have it in Xen yet.Quoted 1 line
guests wanting to load an image with a 64-bit entry point; and d)
Once again:
Quoted 8 lines
old_kernel(Xen) -> purgatory (native mode) ->new_kernelpurgatory architecture is same as kexec-tools architecture. If you use dom0 i386 it means that kexec-tools is (and must be) i386 too. We do not support Xen i386 anymore. It means that my condition is correct.
Daniel
And what happens when kexec-tools is using ia32-libs under a 64bit dom0? That would also break.
The logic is very simple.
If the blob passed in kexec_load claims to be 32bit, Xen will switch into 32bit mode before executing it. If the blob claims to be 64 bit then Xen will stay in 64bit mode before executing it.
This way, purgatory from any kind of multi-arch setup in dom0 will work, as well as all of the other usecases which your suggestion breaks.
~Andrew
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
Quoted 27 lines · Andrew Cooper
Quoted 26 lines · Daniel Kiper
Quoted 12 lines · David Vrabel
Quoted 11 lines · Daniel Kiper
Quoted 8 lines · David Vrabel
Quoted 6 lines · Daniel Kiper
Heh... It looks that there is a misunderstanding. At first I thought that David was going to replace purgatory functionality by switching from 64-bit to 32-bit in
kexec_reloc. But later I realized that I missed Xen 64-bit/dom 32-bit case. Now I agree that this switch must stay as is. However, now I think that there is another small mistake which should be fixed. Please look above.Which mistake? I'm not sure what you're referring to.
I thought about that:
Quoted 8 lines
Quoted 7 lines
if (
image->arch==EM_386)
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;It should be change to:
if (
is_pv_32on64_domain(dom0))
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;This isn't a mistake but a deliberate improvement to the old interface.
I am still not convinced.
Quoted 3 lines
It is clearer and more useful for this sub-architecture to be explicitly supplied in the
kexec_loadcall than implicitly through some other side-channel.
Quoted 6 lines
Quoted 2 lines
First of all you do not need to pass any info about architecure to new kernel or something like that (please check my previous emails).
Yes - you really do. Guessing the architecture of a blob of code is insane, and any current interface which relies on this guessing is broken by design.
Which interface do you mean? Old Xen? kexec-tools? purgatory?
Why do you need to enforce architecture? purgatory starts new kernel image like BIOS does it. What is wrong with that? Do you set something in BIOS to differentiate between 32-bit and 64-bit system?
Quoted 21 lines
Quoted 21 lines
If any then there is another questions. What do you do if you need second or third argument?. You redefine kexec interface once again. For what? Additionally, currently there are a lot of stuff passed to new kernel via purgatory. And purgatory is called by your interface too...
Quoted 2 lines
If we go with what you suggest then you prevent kexec from being used
by: a) PVH dom0s; b) suitably privileged service domains; c) 32-bitMaybe for PVH should be different check. However,
until now we do not have it in Xen yet.Quoted 1 line
guests wanting to load an image with a 64-bit entry point; and d)
Once again:
old_kernel(Xen) -> purgatory (native mode) ->new_kernelpurgatory architecture is same as kexec-tools architecture. If you use dom0 i386 it means that kexec-tools is (and must be) i386 too. We do not support Xen i386 anymore. It means that my condition is correct.
Quoted 4 lines
Quoted 1 line
Daniel
And what happens when kexec-tools is using ia32-libs under a 64bit dom0? That would also break.
Hmmm... Once I have done some tests with hypercalls called on 64-bit system running 32-bit binaries. I was not able to run them properly. Probably there is an issue with arguments. However, I have not time to test it deeper. Please correct me if I am wrong. If I am wrong then condition should be changed to something different. In this case your and my proposal will be not correct for all cases for sure.
Quoted 4 lines
The logic is very simple.
If the blob passed in
kexec_loadclaims to be 32bit, Xen will switch into 32bit mode before executing it. If the blob claims to be 64 bit
Davids condition is wrong for Xen/dom0/binaries 64-bit case with 32-bit kernel image. purgatory will crash or somthing like that because it is 64-bit and it was called in 32-bit mode.
Daniel
Re: [Xen-devel] [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
In reply to Andrew CooperQuoted 27 lines · Andrew Cooper
Quoted 26 lines · Daniel Kiper
Quoted 12 lines · David Vrabel
Quoted 11 lines · Daniel Kiper
Quoted 8 lines · David Vrabel
Quoted 6 lines · Daniel Kiper
Heh... It looks that there is a misunderstanding. At first I thought that David was going to replace purgatory functionality by switching from 64-bit to 32-bit in
kexec_reloc. But later I realized that I missed Xen 64-bit/dom 32-bit case. Now I agree that this switch must stay as is. However, now I think that there is another small mistake which should be fixed. Please look above.Which mistake? I'm not sure what you're referring to.
I thought about that:
Quoted 8 lines
Quoted 7 lines
if (
image->arch==EM_386)
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;It should be change to:
if (
is_pv_32on64_domain(dom0))
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;This isn't a mistake but a deliberate improvement to the old interface.
I am still not convinced.
Quoted 3 lines
It is clearer and more useful for this sub-architecture to be explicitly supplied in the
kexec_loadcall than implicitly through some other side-channel.
Quoted 6 lines
Quoted 2 lines
First of all you do not need to pass any info about architecure to new kernel or something like that (please check my previous emails).
Yes - you really do. Guessing the architecture of a blob of code is insane, and any current interface which relies on this guessing is broken by design.
Which interface do you mean? Old Xen? kexec-tools? purgatory?
Why do you need to enforce architecture? purgatory starts new kernel image like BIOS does it. What is wrong with that? Do you set something in BIOS to differentiate between 32-bit and 64-bit system?
Quoted 21 lines
Quoted 21 lines
If any then there is another questions. What do you do if you need second or third argument?. You redefine kexec interface once again. For what? Additionally, currently there are a lot of stuff passed to new kernel via purgatory. And purgatory is called by your interface too...
Quoted 2 lines
If we go with what you suggest then you prevent kexec from being used
by: a) PVH dom0s; b) suitably privileged service domains; c) 32-bitMaybe for PVH should be different check. However,
until now we do not have it in Xen yet.Quoted 1 line
guests wanting to load an image with a 64-bit entry point; and d)
Once again:
old_kernel(Xen) -> purgatory (native mode) ->new_kernelpurgatory architecture is same as kexec-tools architecture. If you use dom0 i386 it means that kexec-tools is (and must be) i386 too. We do not support Xen i386 anymore. It means that my condition is correct.
Quoted 4 lines
Quoted 1 line
Daniel
And what happens when kexec-tools is using ia32-libs under a 64bit dom0? That would also break.
Hmmm... Once I have done some tests with hypercalls called on 64-bit system running 32-bit binaries. I was not able to run them properly. Probably there is an issue with arguments. However, I have not time to test it deeper. Please correct me if I am wrong. If I am wrong then condition should be changed to something different. In this case your and my proposal will be not correct for all cases for sure.
Quoted 4 lines
The logic is very simple.
If the blob passed in
kexec_loadclaims to be 32bit, Xen will switch into 32bit mode before executing it. If the blob claims to be 64 bit
Davids condition is wrong for Xen/dom0/binaries 64-bit case with 32-bit kernel image. purgatory will crash or somthing like that because it is 64-bit and it was called in 32-bit mode.
Daniel
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
Quoted 30 lines · Daniel Kiper
Quoted 29 lines · Andrew Cooper
Quoted 28 lines · Daniel Kiper
Quoted 12 lines · David Vrabel
Quoted 11 lines · Daniel Kiper
Quoted 8 lines · David Vrabel
Quoted 6 lines · Daniel Kiper
Heh... It looks that there is a misunderstanding. At first I thought that David was going to replace purgatory functionality by switching from 64-bit to 32-bit in
kexec_reloc. But later I realized that I missed Xen 64-bit/dom 32-bit case. Now I agree that this switch must stay as is. However, now I think that there is another small mistake which should be fixed. Please look above.Which mistake? I'm not sure what you're referring to.
I thought about that:
Quoted 8 lines
Quoted 7 lines
if (
image->arch==EM_386)
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;It should be change to:
if (
is_pv_32on64_domain(dom0))
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;This isn't a mistake but a deliberate improvement to the old interface.
I am still not convinced.
Quoted 3 lines
It is clearer and more useful for this sub-architecture to be explicitly supplied in the
kexec_loadcall than implicitly through some other side-channel.First of all you do not need to pass any info about architecure to new kernel or something like that (please check my previous emails).
Quoted 8 lines
Quoted 3 lines
Yes - you really do. Guessing the architecture of a blob of code is insane, and any current interface which relies on this guessing is broken by design.
Which interface do you mean? Old Xen? kexec-tools? purgatory?
Why do you need to enforce architecture? purgatory starts new kernel image like BIOS does it. What is wrong with that? Do you set something in BIOS to differentiate between 32-bit and 64-bit system?
Fine, but that is irrelevant. Purgatory can do whatever it wants as soon as it is running.
What Xen cares about is entering into the binary blob in the correct operating mode. This binary blob will usually be purgatory but can be any executable image loaded using the new interface.
If that image claims to be a 32bit image, Xen will enter it in 32bit mode. If it claims to be 64bit, Xen will enter it in 64bit mode. If it is being stupid and claiming to be 32bit when it is in fact 64bit (or vice versa) then it has only itself to blame.
What is absolutely unacceptable (which is the case in the current interface) is for Xen to assume that the entry point for the blob is the same operating mode as dom0.
Just because "this happens to be the case when using kexec-tools at the moment" is no reason nor excuse to functionally break the interface.
~Andrew
Re: [Xen-devel] [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
In reply to Daniel KiperQuoted 30 lines · Daniel Kiper
Quoted 29 lines · Andrew Cooper
Quoted 28 lines · Daniel Kiper
Quoted 12 lines · David Vrabel
Quoted 11 lines · Daniel Kiper
Quoted 8 lines · David Vrabel
Quoted 6 lines · Daniel Kiper
Heh... It looks that there is a misunderstanding. At first I thought that David was going to replace purgatory functionality by switching from 64-bit to 32-bit in
kexec_reloc. But later I realized that I missed Xen 64-bit/dom 32-bit case. Now I agree that this switch must stay as is. However, now I think that there is another small mistake which should be fixed. Please look above.Which mistake? I'm not sure what you're referring to.
I thought about that:
Quoted 8 lines
Quoted 7 lines
if (
image->arch==EM_386)
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;It should be change to:
if (
is_pv_32on64_domain(dom0))
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;This isn't a mistake but a deliberate improvement to the old interface.
I am still not convinced.
Quoted 3 lines
It is clearer and more useful for this sub-architecture to be explicitly supplied in the
kexec_loadcall than implicitly through some other side-channel.First of all you do not need to pass any info about architecure to new kernel or something like that (please check my previous emails).
Quoted 8 lines
Quoted 3 lines
Yes - you really do. Guessing the architecture of a blob of code is insane, and any current interface which relies on this guessing is broken by design.
Which interface do you mean? Old Xen? kexec-tools? purgatory?
Why do you need to enforce architecture? purgatory starts new kernel image like BIOS does it. What is wrong with that? Do you set something in BIOS to differentiate between 32-bit and 64-bit system?
Fine, but that is irrelevant. Purgatory can do whatever it wants as soon as it is running.
What Xen cares about is entering into the binary blob in the correct operating mode. This binary blob will usually be purgatory but can be any executable image loaded using the new interface.
If that image claims to be a 32bit image, Xen will enter it in 32bit mode. If it claims to be 64bit, Xen will enter it in 64bit mode. If it is being stupid and claiming to be 32bit when it is in fact 64bit (or vice versa) then it has only itself to blame.
What is absolutely unacceptable (which is the case in the current interface) is for Xen to assume that the entry point for the blob is the same operating mode as dom0.
Just because "this happens to be the case when using kexec-tools at the moment" is no reason nor excuse to functionally break the interface.
~Andrew
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
Quoted 40 lines · Andrew Cooper
Quoted 30 lines · Daniel Kiper
Quoted 29 lines · Andrew Cooper
Quoted 28 lines · Daniel Kiper
Quoted 12 lines · David Vrabel
Quoted 11 lines · Daniel Kiper
Quoted 8 lines · David Vrabel
Quoted 6 lines · Daniel Kiper
Heh... It looks that there is a misunderstanding. At first I thought that David was going to replace purgatory functionality by switching from 64-bit to 32-bit in
kexec_reloc. But later I realized that I missed Xen 64-bit/dom 32-bit case. Now I agree that this switch must stay as is. However, now I think that there is another small mistake which should be fixed. Please look above.Which mistake? I'm not sure what you're referring to.
I thought about that:
Quoted 8 lines
Quoted 7 lines
if (
image->arch==EM_386)
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;It should be change to:
if (
is_pv_32on64_domain(dom0))
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;This isn't a mistake but a deliberate improvement to the old interface.
I am still not convinced.
Quoted 3 lines
It is clearer and more useful for this sub-architecture to be explicitly supplied in the
kexec_loadcall than implicitly through some other side-channel.First of all you do not need to pass any info about architecure to new kernel or something like that (please check my previous emails).
Quoted 8 lines
Quoted 3 lines
Yes - you really do. Guessing the architecture of a blob of code is insane, and any current interface which relies on this guessing is broken by design.
Which interface do you mean? Old Xen? kexec-tools? purgatory?
Why do you need to enforce architecture? purgatory starts new kernel image like BIOS does it. What is wrong with that? Do you set something in BIOS to differentiate between 32-bit and 64-bit system?
Quoted 6 lines
Fine, but that is irrelevant. Purgatory can do whatever it wants as soon as it is running.
What Xen cares about is entering into the binary blob in the correct operating mode. This binary blob will usually be purgatory but can be any executable image loaded using the new interface.
Now it is clear. If you would like to enforce arch of blob as whole instead of kernel image itself then David's condition is OK.
Daniel
Re: [Xen-devel] [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
In reply to Andrew CooperQuoted 40 lines · Andrew Cooper
Quoted 30 lines · Daniel Kiper
Quoted 29 lines · Andrew Cooper
Quoted 28 lines · Daniel Kiper
Quoted 12 lines · David Vrabel
Quoted 11 lines · Daniel Kiper
Quoted 8 lines · David Vrabel
Quoted 6 lines · Daniel Kiper
Heh... It looks that there is a misunderstanding. At first I thought that David was going to replace purgatory functionality by switching from 64-bit to 32-bit in
kexec_reloc. But later I realized that I missed Xen 64-bit/dom 32-bit case. Now I agree that this switch must stay as is. However, now I think that there is another small mistake which should be fixed. Please look above.Which mistake? I'm not sure what you're referring to.
I thought about that:
Quoted 8 lines
Quoted 7 lines
if (
image->arch==EM_386)
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;It should be change to:
if (
is_pv_32on64_domain(dom0))
reloc_flags|=KEXEC_RELOC_FLAG_COMPAT;This isn't a mistake but a deliberate improvement to the old interface.
I am still not convinced.
Quoted 3 lines
It is clearer and more useful for this sub-architecture to be explicitly supplied in the
kexec_loadcall than implicitly through some other side-channel.First of all you do not need to pass any info about architecure to new kernel or something like that (please check my previous emails).
Quoted 8 lines
Quoted 3 lines
Yes - you really do. Guessing the architecture of a blob of code is insane, and any current interface which relies on this guessing is broken by design.
Which interface do you mean? Old Xen? kexec-tools? purgatory?
Why do you need to enforce architecture? purgatory starts new kernel image like BIOS does it. What is wrong with that? Do you set something in BIOS to differentiate between 32-bit and 64-bit system?
Quoted 6 lines
Fine, but that is irrelevant. Purgatory can do whatever it wants as soon as it is running.
What Xen cares about is entering into the binary blob in the correct operating mode. This binary blob will usually be purgatory but can be any executable image loaded using the new interface.
Now it is clear. If you would like to enforce arch of blob as whole instead of kernel image itself then David's condition is OK.
Daniel
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
In reply to David VrabelQuoted 32 lines · David Vrabel
From: David Vrabel <[email protected]>
In the existing kexec hypercall, the load and unload ops depend on internals of the Linux kernel (the page list and code page provided by the kernel). The code page is used to transition between Xen context and the image so using kernel code doesn't make sense and will not work for PVH guests.
Add replacement
KEXEC_CMD_kexec_loadandKEXEC_CMD_kexec_unloadops that no longer require a code page to be provided by the guest -- Xen now provides the code for calling the image directly.The new load op looks similar to the Linux
kexec_loadsystem call and allows the guest to provide the image data to be loaded. The guest specifies the architecture of the image which may be a 32-bit subarch of the hypervisor's architecture (i.e., anEM_386image on anEM_X86_64hypervisor).The toolstack can now load images without kernel involvement. This is required for supporting kexec when using a dom0 with an upstream kernel.
Crash images are copied directly into the crash region on load. Default images are copied into Xen heap pages and a list of source and destination machine addresses is created. This is list is used in
kexec_reloc()to relocate the image to its destination.The old load and unload sub-ops are still available (as
KEXEC_CMD_load_v1andKEXEC_CMD_unload_v1) and are implemented on top of the new infrastructure.Signed-off-by David Vrabel <[email protected]>
[...]
Quoted 1 line
xen/common/kexec.c +0
-0
[...]
Quoted 7 lines
xen/common/kexec.c +1
-2-static int kexec_load_unload_compat (unsigned long op, -XEN_GUEST_HANDLE_PARAM (void ) uarg) +static int kexec_load_v1_compat (XEN_GUEST_HANDLE_PARAM (void ) uarg) {#ifdef CONFIG_COMPAT compat_kexec_load_v1_t compat_load;
xen/common/kexec.c static int kexec_load_unload_compat(unsigned long op, · line 995
Quoted 8 lines
xen/common/kexec.c +2
-2@@ -807,49 +990,113 @@ static int kexec_load_unload_compat(unsigned long op, load.type = compat_load.type;XLAT_kexec_image (&load.image, &compat_load.image); -return kexec_load_unload_internal (op, &load); -#else /* CONFIG_COMPAT */ +return kexec_do_load_v1 (&load); +#else return 0 ;
-ENOSYS?
Quoted 3 lines
xen/common/kexec.c +1
-1-#endif /* CONFIG_COMPAT */ +#endif }
[...]
xen/common/kexec.c static int kexec_load_unload_compat(unsigned long op, · line 1082
Quoted 13 lines
xen/common/kexec.c +13
-0+static int kexec_unload_v1_compat (XEN_GUEST_HANDLE_PARAM (void ) uarg) +{ +#ifdef CONFIG_COMPAT +compat_kexec_load_v1_t compat_load; +xen_kexec_unload_t unload; + +if (copy_from_guest (&compat_load, uarg,1 ) ) +return -EFAULT ; + + unload.type = compat_load.type; +return kexec_do_unload (&unload); +#else +return 0 ;
-ENOSYS?
xen/common/kexec.c
Quoted 2 lines
xen/common/kexec.c +2
-0+#endif +}
...and in other similar places...
Daniel
Re: [PATCH 5/8] kexec: extend hypercall with improved load/unload ops
In reply to David VrabelQuoted 32 lines · David Vrabel
From: David Vrabel <[email protected]>
In the existing kexec hypercall, the load and unload ops depend on internals of the Linux kernel (the page list and code page provided by the kernel). The code page is used to transition between Xen context and the image so using kernel code doesn't make sense and will not work for PVH guests.
Add replacement
KEXEC_CMD_kexec_loadandKEXEC_CMD_kexec_unloadops that no longer require a code page to be provided by the guest -- Xen now provides the code for calling the image directly.The new load op looks similar to the Linux
kexec_loadsystem call and allows the guest to provide the image data to be loaded. The guest specifies the architecture of the image which may be a 32-bit subarch of the hypervisor's architecture (i.e., anEM_386image on anEM_X86_64hypervisor).The toolstack can now load images without kernel involvement. This is required for supporting kexec when using a dom0 with an upstream kernel.
Crash images are copied directly into the crash region on load. Default images are copied into Xen heap pages and a list of source and destination machine addresses is created. This is list is used in
kexec_reloc()to relocate the image to its destination.The old load and unload sub-ops are still available (as
KEXEC_CMD_load_v1andKEXEC_CMD_unload_v1) and are implemented on top of the new infrastructure.Signed-off-by David Vrabel <[email protected]>
[...]
Quoted 1 line
xen/common/kexec.c +0
-0
[...]
Quoted 7 lines
xen/common/kexec.c +1
-2-static int kexec_load_unload_compat (unsigned long op, -XEN_GUEST_HANDLE_PARAM (void ) uarg) +static int kexec_load_v1_compat (XEN_GUEST_HANDLE_PARAM (void ) uarg) {#ifdef CONFIG_COMPAT compat_kexec_load_v1_t compat_load;
xen/common/kexec.c static int kexec_load_unload_compat(unsigned long op, · line 995
Quoted 8 lines
xen/common/kexec.c +2
-2@@ -807,49 +990,113 @@ static int kexec_load_unload_compat(unsigned long op, load.type = compat_load.type;XLAT_kexec_image (&load.image, &compat_load.image); -return kexec_load_unload_internal (op, &load); -#else /* CONFIG_COMPAT */ +return kexec_do_load_v1 (&load); +#else return 0 ;
-ENOSYS?
Quoted 3 lines
xen/common/kexec.c +1
-1-#endif /* CONFIG_COMPAT */ +#endif }
[...]
xen/common/kexec.c static int kexec_load_unload_compat(unsigned long op, · line 1082
Quoted 13 lines
xen/common/kexec.c +13
-0+static int kexec_unload_v1_compat (XEN_GUEST_HANDLE_PARAM (void ) uarg) +{ +#ifdef CONFIG_COMPAT +compat_kexec_load_v1_t compat_load; +xen_kexec_unload_t unload; + +if (copy_from_guest (&compat_load, uarg,1 ) ) +return -EFAULT ; + + unload.type = compat_load.type; +return kexec_do_unload (&unload); +#else +return 0 ;
-ENOSYS?
xen/common/kexec.c
Quoted 2 lines
xen/common/kexec.c +2
-0+#endif +}
...and in other similar places...
Daniel
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
PATCH 6/8 xen: kexec crash image when dom0 crashes
In reply to David VrabelFrom: David Vrabel <[email protected]>
--- xen/common/shutdown.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
xen/common/shutdown.c +3 -0
@@ -46,6 +46,9 @@ void dom0_shutdown(u8 reason) {debugger_trap_immediate ();printk ("Domain 0 crashed: " ); +#ifdef CONFIG_KEXEC +kexec_crash (); +#endif maybe_reboot ();break ;/* not reached */ }
Signature · 1 line
1.7.2.5
PATCH 6/8 xen: kexec crash image when dom0 crashes
In reply to David VrabelFrom: David Vrabel <[email protected]>
--- xen/common/shutdown.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
xen/common/shutdown.c +3 -0
@@ -46,6 +46,9 @@ void dom0_shutdown(u8 reason) {debugger_trap_immediate ();printk ("Domain 0 crashed: " ); +#ifdef CONFIG_KEXEC +kexec_crash (); +#endif maybe_reboot ();break ;/* not reached */ }
Signature · 7 lines
1.7.2.5 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 7/8 libxc: add hypercall buffer arrays
In reply to David VrabelFrom: David Vrabel <[email protected]>
Hypercall buffer arrays are used when a hypercall takes a variable length array of buffers.
--- tools/libxc/xc_hcall_buf.c | 73 ++++++++++++++++++++++++++++++++++++++++++++ tools/libxc/xenctrl.h | 27 ++++++++++++++++ 2 files changed, 100 insertions(+), 0 deletions(-)
tools/libxc/xc_hcall_buf.c +73 -0
@@ -228,6 +228,79 @@ void xc__hypercall_bounce_post(xc_interface *xch, xc_hypercall_buffer_t *b)xc__hypercall_buffer_free (xch, b); } +struct xc_hypercall_buffer_array { +unsigned max_bufs; +xc_hypercall_buffer_t *bufs; +}; + +xc_hypercall_buffer_array_t *xc_hypercall_buffer_array_create (xc_interface *xch, +unsigned n) +{ +xc_hypercall_buffer_array_t *array; +xc_hypercall_buffer_t *bufs =NULL ; + + array =malloc (sizeof (*array)); +if ( array ==NULL ) + goto error; + + bufs =calloc (n,sizeof (*bufs)); +if ( bufs ==NULL ) + goto error; + + array->max_bufs = n; + array->bufs = bufs; + +return array; + +error: +free (bufs); +free (array); +return NULL ; +} + +void *xc__hypercall_buffer_array_alloc (xc_interface *xch, +xc_hypercall_buffer_array_t *array, +unsigned index, +xc_hypercall_buffer_t *hbuf, +size_t size) +{ +void *buf; + +if ( index >= array->max_bufs || array->bufs[index].hbuf ) +abort (); + + buf =xc__hypercall_buffer_alloc (xch, hbuf, size); +if ( buf ) + array->bufs[index] = *hbuf; +return buf; +} + +void *xc__hypercall_buffer_array_get (xc_interface *xch, +xc_hypercall_buffer_array_t *array, +unsigned index, +xc_hypercall_buffer_t *hbuf) +{ +if ( index >= array->max_bufs || array->bufs[index].hbuf ==NULL ) +abort (); + + *hbuf = array->bufs[index]; +return array->bufs[index].hbuf; +} + +void xc_hypercall_buffer_array_destroy (xc_interface *xc, +xc_hypercall_buffer_array_t *array) +{ +unsigned i; + +if ( array ==NULL ) +return ; + +for (i =0 ; i < array->max_bufs; i++ ) +xc__hypercall_buffer_free (xc, &array->bufs[i]); +free (array->bufs); +free (array); +} +/* * Local variables: * mode: C
tools/libxc/xenctrl.h +27 -0
@@ -317,6 +317,33 @@ void xc__hypercall_buffer_free_pages(xc_interface *xch, xc_hypercall_buffer_t *b#define xc_hypercall_buffer_free_pages (_xch, _name, _nr) xc__hypercall_buffer_free_pages(_xch, HYPERCALL_BUFFER(_name), _nr)/* +* Array of hypercall buffers. +* +* Create an array with xc_hypercall_buffer_array_create() and +* populate it by declaring one hypercall buffer in a loop and +* allocating the buffer with xc_hypercall_buffer_array_alloc(). +* +* To access a previously allocated buffers, declare a new hypercall +* buffer and call xc_hypercall_buffer_array_get(). +* +* Destroy the array with xc_hypercall_buffer_array_destroy() to free +* the array and all its alocated hypercall buffers. +*/ +struct xc_hypercall_buffer_array ; +typedef struct xc_hypercall_buffer_array xc_hypercall_buffer_array_t ; + +xc_hypercall_buffer_array_t *xc_hypercall_buffer_array_create (xc_interface *xch,unsigned n); +void *xc__hypercall_buffer_array_alloc (xc_interface *xch,xc_hypercall_buffer_array_t *array, +unsigned index,xc_hypercall_buffer_t *hbuf,size_t size); +#define xc_hypercall_buffer_array_alloc (_xch, _array, _index, _name, _size) \ + xc__hypercall_buffer_array_alloc(_xch, _array, _index, HYPERCALL_BUFFER(_name), _size) +void *xc__hypercall_buffer_array_get (xc_interface *xch,xc_hypercall_buffer_array_t *array, +unsigned index,xc_hypercall_buffer_t *hbuf); +#define xc_hypercall_buffer_array_get (_xch, _array, _index, _name, _size) \ + xc__hypercall_buffer_array_get(_xch, _array, _index, HYPERCALL_BUFFER(_name)) +void xc_hypercall_buffer_array_destroy (xc_interface *xc,xc_hypercall_buffer_array_t *array); + +/* * CPUMAP handling */ typedef uint8_t *xc_cpumap_t ;
Signature · 1 line
1.7.2.5
PATCH 7/8 libxc: add hypercall buffer arrays
In reply to David VrabelFrom: David Vrabel <[email protected]>
Hypercall buffer arrays are used when a hypercall takes a variable length array of buffers.
--- tools/libxc/xc_hcall_buf.c | 73 ++++++++++++++++++++++++++++++++++++++++++++ tools/libxc/xenctrl.h | 27 ++++++++++++++++ 2 files changed, 100 insertions(+), 0 deletions(-)
tools/libxc/xc_hcall_buf.c +73 -0
@@ -228,6 +228,79 @@ void xc__hypercall_bounce_post(xc_interface *xch, xc_hypercall_buffer_t *b)xc__hypercall_buffer_free (xch, b); } +struct xc_hypercall_buffer_array { +unsigned max_bufs; +xc_hypercall_buffer_t *bufs; +}; + +xc_hypercall_buffer_array_t *xc_hypercall_buffer_array_create (xc_interface *xch, +unsigned n) +{ +xc_hypercall_buffer_array_t *array; +xc_hypercall_buffer_t *bufs =NULL ; + + array =malloc (sizeof (*array)); +if ( array ==NULL ) + goto error; + + bufs =calloc (n,sizeof (*bufs)); +if ( bufs ==NULL ) + goto error; + + array->max_bufs = n; + array->bufs = bufs; + +return array; + +error: +free (bufs); +free (array); +return NULL ; +} + +void *xc__hypercall_buffer_array_alloc (xc_interface *xch, +xc_hypercall_buffer_array_t *array, +unsigned index, +xc_hypercall_buffer_t *hbuf, +size_t size) +{ +void *buf; + +if ( index >= array->max_bufs || array->bufs[index].hbuf ) +abort (); + + buf =xc__hypercall_buffer_alloc (xch, hbuf, size); +if ( buf ) + array->bufs[index] = *hbuf; +return buf; +} + +void *xc__hypercall_buffer_array_get (xc_interface *xch, +xc_hypercall_buffer_array_t *array, +unsigned index, +xc_hypercall_buffer_t *hbuf) +{ +if ( index >= array->max_bufs || array->bufs[index].hbuf ==NULL ) +abort (); + + *hbuf = array->bufs[index]; +return array->bufs[index].hbuf; +} + +void xc_hypercall_buffer_array_destroy (xc_interface *xc, +xc_hypercall_buffer_array_t *array) +{ +unsigned i; + +if ( array ==NULL ) +return ; + +for (i =0 ; i < array->max_bufs; i++ ) +xc__hypercall_buffer_free (xc, &array->bufs[i]); +free (array->bufs); +free (array); +} +/* * Local variables: * mode: C
tools/libxc/xenctrl.h +27 -0
@@ -317,6 +317,33 @@ void xc__hypercall_buffer_free_pages(xc_interface *xch, xc_hypercall_buffer_t *b#define xc_hypercall_buffer_free_pages (_xch, _name, _nr) xc__hypercall_buffer_free_pages(_xch, HYPERCALL_BUFFER(_name), _nr)/* +* Array of hypercall buffers. +* +* Create an array with xc_hypercall_buffer_array_create() and +* populate it by declaring one hypercall buffer in a loop and +* allocating the buffer with xc_hypercall_buffer_array_alloc(). +* +* To access a previously allocated buffers, declare a new hypercall +* buffer and call xc_hypercall_buffer_array_get(). +* +* Destroy the array with xc_hypercall_buffer_array_destroy() to free +* the array and all its alocated hypercall buffers. +*/ +struct xc_hypercall_buffer_array ; +typedef struct xc_hypercall_buffer_array xc_hypercall_buffer_array_t ; + +xc_hypercall_buffer_array_t *xc_hypercall_buffer_array_create (xc_interface *xch,unsigned n); +void *xc__hypercall_buffer_array_alloc (xc_interface *xch,xc_hypercall_buffer_array_t *array, +unsigned index,xc_hypercall_buffer_t *hbuf,size_t size); +#define xc_hypercall_buffer_array_alloc (_xch, _array, _index, _name, _size) \ + xc__hypercall_buffer_array_alloc(_xch, _array, _index, HYPERCALL_BUFFER(_name), _size) +void *xc__hypercall_buffer_array_get (xc_interface *xch,xc_hypercall_buffer_array_t *array, +unsigned index,xc_hypercall_buffer_t *hbuf); +#define xc_hypercall_buffer_array_get (_xch, _array, _index, _name, _size) \ + xc__hypercall_buffer_array_get(_xch, _array, _index, HYPERCALL_BUFFER(_name)) +void xc_hypercall_buffer_array_destroy (xc_interface *xc,xc_hypercall_buffer_array_t *array); + +/* * CPUMAP handling */ typedef uint8_t *xc_cpumap_t ;
Signature · 7 lines
1.7.2.5 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 7/8] libxc: add hypercall buffer arrays
David Vrabel writes ("[Xen-devel] [PATCH 7/8] libxc: add hypercall buffer arrays"):
Quoted 4 lines
From: David Vrabel <[email protected]>
Hypercall buffer arrays are used when a hypercall takes a variable length array of buffers.
Ian Campbell did the hypercall buffers and is the relevant authority, so CC'ing him.
Ian.
Re: [Xen-devel] [PATCH 7/8] libxc: add hypercall buffer arrays
In reply to David VrabelDavid Vrabel writes ("[Xen-devel] [PATCH 7/8] libxc: add hypercall buffer arrays"):
Quoted 4 lines
From: David Vrabel <[email protected]>
Hypercall buffer arrays are used when a hypercall takes a variable length array of buffers.
Ian Campbell did the hypercall buffers and is the relevant authority, so CC'ing him.
Ian.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 7/8] libxc: add hypercall buffer arrays
In reply to David VrabelQuoted 4 lines · David Vrabel
From: David Vrabel <[email protected]>
Hypercall buffer arrays are used when a hypercall takes a variable length array of buffers.
This looks good to me, I took a quick peek at the 4/4 patch in the kexec tools series which uses it as well.
Quoted 129 lines
Signed-off-by David Vrabel <[email protected]>--- tools/libxc/xc_hcall_buf.c | 73 ++++++++++++++++++++++++++++++++++++++++++++ tools/libxc/xenctrl.h | 27 ++++++++++++++++ 2 files changed, 100 insertions(+), 0 deletions(-)tools/libxc/xc_hcall_buf.c +73
-0@@ -228,6 +228,79 @@ void xc__hypercall_bounce_post(xc_interface *xch, xc_hypercall_buffer_t *b)xc__hypercall_buffer_free (xch, b); } +struct xc_hypercall_buffer_array { +unsigned max_bufs; +xc_hypercall_buffer_t *bufs; +}; + +xc_hypercall_buffer_array_t *xc_hypercall_buffer_array_create (xc_interface *xch, +unsigned n) +{ +xc_hypercall_buffer_array_t *array; +xc_hypercall_buffer_t *bufs =NULL ; + + array =malloc (sizeof (*array)); +if ( array ==NULL ) + goto error; + + bufs =calloc (n,sizeof (*bufs)); +if ( bufs ==NULL ) + goto error; + + array->max_bufs = n; + array->bufs = bufs; + +return array; + +error: +free (bufs); +free (array); +return NULL ; +} + +void *xc__hypercall_buffer_array_alloc (xc_interface *xch, +xc_hypercall_buffer_array_t *array, +unsigned index, +xc_hypercall_buffer_t *hbuf, +size_t size) +{ +void *buf; + +if ( index >= array->max_bufs || array->bufs[index].hbuf ) +abort (); + + buf =xc__hypercall_buffer_alloc (xch, hbuf, size); +if ( buf ) + array->bufs[index] = *hbuf; +return buf; +} + +void *xc__hypercall_buffer_array_get (xc_interface *xch, +xc_hypercall_buffer_array_t *array, +unsigned index, +xc_hypercall_buffer_t *hbuf) +{ +if ( index >= array->max_bufs || array->bufs[index].hbuf ==NULL ) +abort (); + + *hbuf = array->bufs[index]; +return array->bufs[index].hbuf; +} + +void xc_hypercall_buffer_array_destroy (xc_interface *xc, +xc_hypercall_buffer_array_t *array) +{ +unsigned i; + +if ( array ==NULL ) +return ; + +for (i =0 ; i < array->max_bufs; i++ ) +xc__hypercall_buffer_free (xc, &array->bufs[i]); +free (array->bufs); +free (array); +} +/* * Local variables: * mode: C tools/libxc/xenctrl.h +27
-0@@ -317,6 +317,33 @@ void xc__hypercall_buffer_free_pages(xc_interface *xch, xc_hypercall_buffer_t *b#define xc_hypercall_buffer_free_pages (_xch, _name, _nr) xc__hypercall_buffer_free_pages(_xch, HYPERCALL_BUFFER(_name), _nr)/* +* Array of hypercall buffers. +* +* Create an array with xc_hypercall_buffer_array_create() and +* populate it by declaring one hypercall buffer in a loop and +* allocating the buffer with xc_hypercall_buffer_array_alloc(). +* +* To access a previously allocated buffers, declare a new hypercall +* buffer and call xc_hypercall_buffer_array_get(). +* +* Destroy the array with xc_hypercall_buffer_array_destroy() to free +* the array and all its alocated hypercall buffers. +*/ +struct xc_hypercall_buffer_array ; +typedef struct xc_hypercall_buffer_array xc_hypercall_buffer_array_t ; + +xc_hypercall_buffer_array_t *xc_hypercall_buffer_array_create (xc_interface *xch,unsigned n); +void *xc__hypercall_buffer_array_alloc (xc_interface *xch,xc_hypercall_buffer_array_t *array, +unsigned index,xc_hypercall_buffer_t *hbuf,size_t size); +#define xc_hypercall_buffer_array_alloc (_xch, _array, _index, _name, _size) \ + xc__hypercall_buffer_array_alloc(_xch, _array, _index, HYPERCALL_BUFFER(_name), _size) +void *xc__hypercall_buffer_array_get (xc_interface *xch,xc_hypercall_buffer_array_t *array, +unsigned index,xc_hypercall_buffer_t *hbuf); +#define xc_hypercall_buffer_array_get (_xch, _array, _index, _name, _size) \ + xc__hypercall_buffer_array_get(_xch, _array, _index, HYPERCALL_BUFFER(_name)) +void xc_hypercall_buffer_array_destroy (xc_interface *xc,xc_hypercall_buffer_array_t *array); + +/* * CPUMAP handling */ typedef uint8_t *xc_cpumap_t ;
Re: [Xen-devel] [PATCH 7/8] libxc: add hypercall buffer arrays
In reply to David VrabelQuoted 4 lines · David Vrabel
From: David Vrabel <[email protected]>
Hypercall buffer arrays are used when a hypercall takes a variable length array of buffers.
This looks good to me, I took a quick peek at the 4/4 patch in the kexec tools series which uses it as well.
Quoted 119 lines
Signed-off-by David Vrabel <[email protected]>--- tools/libxc/xc_hcall_buf.c | 73 ++++++++++++++++++++++++++++++++++++++++++++ tools/libxc/xenctrl.h | 27 ++++++++++++++++ 2 files changed, 100 insertions(+), 0 deletions(-)tools/libxc/xc_hcall_buf.c +73
-0@@ -228,6 +228,79 @@ void xc__hypercall_bounce_post(xc_interface *xch, xc_hypercall_buffer_t *b)xc__hypercall_buffer_free (xch, b); } +struct xc_hypercall_buffer_array { +unsigned max_bufs; +xc_hypercall_buffer_t *bufs; +}; + +xc_hypercall_buffer_array_t *xc_hypercall_buffer_array_create (xc_interface *xch, +unsigned n) +{ +xc_hypercall_buffer_array_t *array; +xc_hypercall_buffer_t *bufs =NULL ; + + array =malloc (sizeof (*array)); +if ( array ==NULL ) + goto error; + + bufs =calloc (n,sizeof (*bufs)); +if ( bufs ==NULL ) + goto error; + + array->max_bufs = n; + array->bufs = bufs; + +return array; + +error: +free (bufs); +free (array); +return NULL ; +} + +void *xc__hypercall_buffer_array_alloc (xc_interface *xch, +xc_hypercall_buffer_array_t *array, +unsigned index, +xc_hypercall_buffer_t *hbuf, +size_t size) +{ +void *buf; + +if ( index >= array->max_bufs || array->bufs[index].hbuf ) +abort (); + + buf =xc__hypercall_buffer_alloc (xch, hbuf, size); +if ( buf ) + array->bufs[index] = *hbuf; +return buf; +} + +void *xc__hypercall_buffer_array_get (xc_interface *xch, +xc_hypercall_buffer_array_t *array, +unsigned index, +xc_hypercall_buffer_t *hbuf) +{ +if ( index >= array->max_bufs || array->bufs[index].hbuf ==NULL ) +abort (); + + *hbuf = array->bufs[index]; +return array->bufs[index].hbuf; +} + +void xc_hypercall_buffer_array_destroy (xc_interface *xc, +xc_hypercall_buffer_array_t *array) +{ +unsigned i; + +if ( array ==NULL ) +return ; + +for (i =0 ; i < array->max_bufs; i++ ) +xc__hypercall_buffer_free (xc, &array->bufs[i]); +free (array->bufs); +free (array); +} +/* * Local variables: * mode: C tools/libxc/xenctrl.h +20
-0@@ -317,6 +317,33 @@ void xc__hypercall_buffer_free_pages(xc_interface *xch, xc_hypercall_buffer_t *b#define xc_hypercall_buffer_free_pages (_xch, _name, _nr) xc__hypercall_buffer_free_pages(_xch, HYPERCALL_BUFFER(_name), _nr)/* +* Array of hypercall buffers. +* +* Create an array with xc_hypercall_buffer_array_create() and +* populate it by declaring one hypercall buffer in a loop and +* allocating the buffer with xc_hypercall_buffer_array_alloc(). +* +* To access a previously allocated buffers, declare a new hypercall +* buffer and call xc_hypercall_buffer_array_get(). +* +* Destroy the array with xc_hypercall_buffer_array_destroy() to free +* the array and all its alocated hypercall buffers. +*/ +struct xc_hypercall_buffer_array ; +typedef struct xc_hypercall_buffer_array xc_hypercall_buffer_array_t ; + +xc_hypercall_buffer_array_t *xc_hypercall_buffer_array_create (xc_interface *xch,unsigned n); +void *xc__hypercall_buffer_array_alloc (xc_interface *xch,xc_hypercall_buffer_array_t *array, +unsigned index,xc_hypercall_buffer_t *hbuf,size_t size); +#define xc_hypercall_buffer_array_alloc (_xch, _array, _index, _name, _size) \ + xc__hypercall_buffer_array_alloc(_xch, _array, _index, HYPERCALL_BUFFER(_name), _size)
tools/libxc/xenctrl.h void xc__hypercall_buffer_free_pages(xc_interface *xch, xc_hypercall_buffer_t *b · line 349
Quoted 10 lines
tools/libxc/xenctrl.h +7
-0+void *xc__hypercall_buffer_array_get (xc_interface *xch,xc_hypercall_buffer_array_t *array, +unsigned index,xc_hypercall_buffer_t *hbuf); +#define xc_hypercall_buffer_array_get (_xch, _array, _index, _name, _size) \ + xc__hypercall_buffer_array_get(_xch, _array, _index, HYPERCALL_BUFFER(_name)) +void xc_hypercall_buffer_array_destroy (xc_interface *xc,xc_hypercall_buffer_array_t *array); + +/* * CPUMAP handling */ typedef uint8_t *xc_cpumap_t ;
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
PATCH 8/8 libxc: add API for kexec hypercall
In reply to David VrabelFrom: David Vrabel <[email protected]>
Add xc_kexec_exec(), xc_kexec_get_ranges(), xc_kexec_load(), and xc_kexec_unload(). The load and unload calls require the v2 load and unload ops.
--- tools/libxc/Makefile | 1 + tools/libxc/xc_kexec.c | 140 ++++++++++++++++++++++++++++++++++++++++++++++++ tools/libxc/xenctrl.h | 55 +++++++++++++++++++ 3 files changed, 196 insertions(+), 0 deletions(-) create mode 100644 tools/libxc/xc_kexec.c
tools/libxc/Makefile +1 -0
@@ -31,6 +31,7 @@ CTRL_SRCS-y += xc_mem_access.c CTRL_SRCS-y += xc_memshr.c CTRL_SRCS-y += xc_hcall_buf.c CTRL_SRCS-y += xc_foreign_memory.c +CTRL_SRCS-y += xc_kexec.c CTRL_SRCS-y += xtl_core.c CTRL_SRCS-y += xtl_logger_stdio.c CTRL_SRCS-$(CONFIG_X86) += xc_pagetab.c
tools/libxc/xc_kexec.c new file +140 -0
140 lines not on this page · raw message
tools/libxc/xenctrl.h +55 -0
65 lines not on this page · raw message
Signature · 1 line
1.7.2.5
PATCH 8/8 libxc: add API for kexec hypercall
In reply to David VrabelFrom: David Vrabel <[email protected]>
Add xc_kexec_exec(), xc_kexec_get_ranges(), xc_kexec_load(), and xc_kexec_unload(). The load and unload calls require the v2 load and unload ops.
--- tools/libxc/Makefile | 1 + tools/libxc/xc_kexec.c | 140 ++++++++++++++++++++++++++++++++++++++++++++++++ tools/libxc/xenctrl.h | 55 +++++++++++++++++++ 3 files changed, 196 insertions(+), 0 deletions(-) create mode 100644 tools/libxc/xc_kexec.c
tools/libxc/Makefile +1 -0
@@ -31,6 +31,7 @@ CTRL_SRCS-y += xc_mem_access.c CTRL_SRCS-y += xc_memshr.c CTRL_SRCS-y += xc_hcall_buf.c CTRL_SRCS-y += xc_foreign_memory.c +CTRL_SRCS-y += xc_kexec.c CTRL_SRCS-y += xtl_core.c CTRL_SRCS-y += xtl_logger_stdio.c CTRL_SRCS-$(CONFIG_X86) += xc_pagetab.c
tools/libxc/xc_kexec.c new file +140 -0
140 lines not on this page · raw message
tools/libxc/xenctrl.h +55 -0
65 lines not on this page · raw message
Signature · 7 lines
1.7.2.5 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 8/8] libxc: add API for kexec hypercall
Quoted 5 lines · David Vrabel
From: David Vrabel <[email protected]>
Add
xc_kexec_exec(),xc_kexec_get_ranges(),xc_kexec_load(), andxc_kexec_unload(). The load and unload calls require the v2 load and unload ops.
Looks good, few nits below, but
Quoted 9 lines
+/*
+ * Find the machine address and size of certain memory areas.
+ *+ * KEXEC_RANGE_MA_CRASH crash area + * KEXEC_RANGE_MA_XEN Xen itself + * KEXEC_RANGE_MA_CPU CPU note for CPU number 'nr' + * KEXEC_RANGE_MA_XENHEAP xenheap + * KEXEC_RANGE_MA_EFI_MEMMAP EFI Memory Map + * KEXEC_RANGE_MA_VMCOREINFO vmcoreinfo
I expect there is a canonical list of these somewhere, can we get a pointer to it here?
Quoted 5 lines
+ *
+ * Fails with:
+ * EINVAL if the range or CPU number isn't valid.
+ */tools/libxc/xenctrl.h +1
-0+int xc_kexec_get_range(xc_interface *xch, int range, int nr,
tools/libxc/xenctrl.h int xc_compression_uncompress_page(xc_interface *xch, char *compbuf, · line 2300
Quoted 10 lines
tools/libxc/xenctrl.h +10
-0+ uint64_t *size, uint64_t *start); + +/* +* Load a kexec image into memory. +* +* The image may be of type KEXEC_TYPE_DEFAULT (executed on request) +* or KEXEC_TYPE_CRASH (executed on a crash). +* +* The image architecture may be a 32-bit variant of the hypervisor +* architecture (e.g, EM_386 on a x86-64 hypervisor).
arch is an ELF arch? Worth mentioning explicitly I think.
Ian
Re: [Xen-devel] [PATCH 8/8] libxc: add API for kexec hypercall
In reply to David VrabelQuoted 5 lines · David Vrabel
From: David Vrabel <[email protected]>
Add
xc_kexec_exec(),xc_kexec_get_ranges(),xc_kexec_load(), andxc_kexec_unload(). The load and unload calls require the v2 load and unload ops.
Looks good, few nits below, but
Quoted 9 lines
+/*
+ * Find the machine address and size of certain memory areas.
+ *+ * KEXEC_RANGE_MA_CRASH crash area + * KEXEC_RANGE_MA_XEN Xen itself + * KEXEC_RANGE_MA_CPU CPU note for CPU number 'nr' + * KEXEC_RANGE_MA_XENHEAP xenheap + * KEXEC_RANGE_MA_EFI_MEMMAP EFI Memory Map + * KEXEC_RANGE_MA_VMCOREINFO vmcoreinfo
I expect there is a canonical list of these somewhere, can we get a pointer to it here?
Quoted 5 lines
+ *
+ * Fails with:
+ * EINVAL if the range or CPU number isn't valid.
+ */tools/libxc/xenctrl.h +1
-0+int xc_kexec_get_range(xc_interface *xch, int range, int nr,
tools/libxc/xenctrl.h int xc_compression_uncompress_page(xc_interface *xch, char *compbuf, · line 2300
Quoted 10 lines
tools/libxc/xenctrl.h +10
-0+ uint64_t *size, uint64_t *start); + +/* +* Load a kexec image into memory. +* +* The image may be of type KEXEC_TYPE_DEFAULT (executed on request) +* or KEXEC_TYPE_CRASH (executed on a crash). +* +* The image architecture may be a 32-bit variant of the hypervisor +* architecture (e.g, EM_386 on a x86-64 hypervisor).
arch is an ELF arch? Worth mentioning explicitly I think.
Ian
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 18 lines · David Vrabel
The series improves the kexec hypercall by making Xen responsible for loading and relocating the image. This allows kexec to be usable by pv-ops kernels and should allow kexec to be usable from a HVM or PVH privileged domain.
The first patch is a simple clean-up.
The second patch allows hypercall structures to be ABI compatible between 32- and 64-bit guests (by reusing stuff present for domctls and sysctls). This seems better than having to keep adding compat handling for new hypercalls etc.
Patch 3 introduces the new ABI.
Patch 4 and 5 nearly completely reimplement the kexec load, unload and exec sub-ops. The old
load_v1sub-op is then implemented on top of the new code.
Quoted 7 lines
Patch 6 calls the kexec image when dom0 crashes. This avoids having to alter dom0 kernels to do a exec sub-op call on crash -- an existing
SHUTDOWN_crash.Patches 7 and 8 add the libxc API for the kexec calls.
The required patch series for kexec-tools will be posted shortly.
On first sight both patch series looks quite good for me. Give me a week or two to do some tests.
Daniel
Quoted 18 lines · David Vrabel
The series improves the kexec hypercall by making Xen responsible for loading and relocating the image. This allows kexec to be usable by pv-ops kernels and should allow kexec to be usable from a HVM or PVH privileged domain.
The first patch is a simple clean-up.
The second patch allows hypercall structures to be ABI compatible between 32- and 64-bit guests (by reusing stuff present for domctls and sysctls). This seems better than having to keep adding compat handling for new hypercalls etc.
Patch 3 introduces the new ABI.
Patch 4 and 5 nearly completely reimplement the kexec load, unload and exec sub-ops. The old
load_v1sub-op is then implemented on top of the new code.
Quoted 7 lines
Patch 6 calls the kexec image when dom0 crashes. This avoids having to alter dom0 kernels to do a exec sub-op call on crash -- an existing
SHUTDOWN_crash.Patches 7 and 8 add the libxc API for the kexec calls.
The required patch series for kexec-tools will be posted shortly.
On first sight both patch series looks quite good for me. Give me a week or two to do some tests.
Daniel
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 15 lines
Quoted 1 line
Quoted 1 line · David Vrabel
The series improves the kexec hypercall by making Xen responsible for loading and relocating the image. This allows kexec to be usable by pv-ops kernels and should allow kexec to be usable from a HVM or PVH privileged domain.
The first patch is a simple clean-up.
The second patch allows hypercall structures to be ABI compatible between 32- and 64-bit guests (by reusing stuff present for domctls and sysctls). This seems better than having to keep adding compat handling for new hypercalls etc.
Patch 3 introduces the new ABI.
Quoted 7 lines
Patch 4 and 5 nearly completely reimplement the kexec load, unload and exec sub-ops. The old
load_v1sub-op is then implemented on top of the new code.Patch 6 calls the kexec image when dom0 crashes. This avoids having to alter dom0 kernels to do a exec sub-op call on crash -- an existing
SHUTDOWN_crash.
Am I right in understanding that at this point no kexec support is necessary in the Dom0 kernel at all anymore? If so, that's a very nice move - thanks for doing that!
Jan
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 19 lines · Jan Beulich
Quoted 19 lines
Quoted 1 line
Quoted 1 line · David Vrabel
The series improves the kexec hypercall by making Xen responsible for loading and relocating the image. This allows kexec to be usable by pv-ops kernels and should allow kexec to be usable from a HVM or PVH privileged domain.
The first patch is a simple clean-up.
The second patch allows hypercall structures to be ABI compatible between 32- and 64-bit guests (by reusing stuff present for domctls and sysctls). This seems better than having to keep adding compat handling for new hypercalls etc.
Patch 3 introduces the new ABI.
Patch 4 and 5 nearly completely reimplement the kexec load, unload and exec sub-ops. The old
load_v1sub-op is then implemented on top of the new code.
Quoted 7 lines
Quoted 3 lines
Patch 6 calls the kexec image when dom0 crashes. This avoids having to alter dom0 kernels to do a exec sub-op call on crash -- an existing
SHUTDOWN_crash.Am I right in understanding that at this point no kexec support is necessary in the Dom0 kernel at all anymore? If so, that's a very nice move - thanks for doing that!
Yes. It will kexec slightly later than it would on native (or classic) but I don't think this will be a problem in practice.
David
Quoted 19 lines · Jan Beulich
Quoted 19 lines
Quoted 1 line
Quoted 1 line · David Vrabel
The series improves the kexec hypercall by making Xen responsible for loading and relocating the image. This allows kexec to be usable by pv-ops kernels and should allow kexec to be usable from a HVM or PVH privileged domain.
The first patch is a simple clean-up.
The second patch allows hypercall structures to be ABI compatible between 32- and 64-bit guests (by reusing stuff present for domctls and sysctls). This seems better than having to keep adding compat handling for new hypercalls etc.
Patch 3 introduces the new ABI.
Patch 4 and 5 nearly completely reimplement the kexec load, unload and exec sub-ops. The old
load_v1sub-op is then implemented on top of the new code.
Quoted 7 lines
Quoted 3 lines
Patch 6 calls the kexec image when dom0 crashes. This avoids having to alter dom0 kernels to do a exec sub-op call on crash -- an existing
SHUTDOWN_crash.Am I right in understanding that at this point no kexec support is necessary in the Dom0 kernel at all anymore? If so, that's a very nice move - thanks for doing that!
Yes. It will kexec slightly later than it would on native (or classic) but I don't think this will be a problem in practice.
David
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 15 lines
Quoted 1 line
Quoted 1 line · David Vrabel
The series improves the kexec hypercall by making Xen responsible for loading and relocating the image. This allows kexec to be usable by pv-ops kernels and should allow kexec to be usable from a HVM or PVH privileged domain.
The first patch is a simple clean-up.
The second patch allows hypercall structures to be ABI compatible between 32- and 64-bit guests (by reusing stuff present for domctls and sysctls). This seems better than having to keep adding compat handling for new hypercalls etc.
Patch 3 introduces the new ABI.
Quoted 7 lines
Patch 4 and 5 nearly completely reimplement the kexec load, unload and exec sub-ops. The old
load_v1sub-op is then implemented on top of the new code.Patch 6 calls the kexec image when dom0 crashes. This avoids having to alter dom0 kernels to do a exec sub-op call on crash -- an existing
SHUTDOWN_crash.
Am I right in understanding that at this point no kexec support is necessary in the Dom0 kernel at all anymore? If so, that's a very nice move - thanks for doing that!
Jan
Quoted 26 lines · David Vrabel
The series improves the kexec hypercall by making Xen responsible for loading and relocating the image. This allows kexec to be usable by pv-ops kernels and should allow kexec to be usable from a HVM or PVH privileged domain.
The first patch is a simple clean-up.
The second patch allows hypercall structures to be ABI compatible between 32- and 64-bit guests (by reusing stuff present for domctls and sysctls). This seems better than having to keep adding compat handling for new hypercalls etc.
Patch 3 introduces the new ABI.
Patch 4 and 5 nearly completely reimplement the kexec load, unload and exec sub-ops. The old
load_v1sub-op is then implemented on top of the new code.Patch 6 calls the kexec image when dom0 crashes. This avoids having to alter dom0 kernels to do a exec sub-op call on crash -- an existing
SHUTDOWN_crash.Patches 7 and 8 add the libxc API for the kexec calls.
The required patch series for kexec-tools will be posted shortly.
Quoted 7 lines
David
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
I have tested this patch set on a Fedora 17 dom0 with kernels:
3.7.3-101.fc17.x86_64
3.6.5-1.fc17.x86_64
So:
-Don Slutz
Quoted 26 lines · David Vrabel
The series improves the kexec hypercall by making Xen responsible for loading and relocating the image. This allows kexec to be usable by pv-ops kernels and should allow kexec to be usable from a HVM or PVH privileged domain.
The first patch is a simple clean-up.
The second patch allows hypercall structures to be ABI compatible between 32- and 64-bit guests (by reusing stuff present for domctls and sysctls). This seems better than having to keep adding compat handling for new hypercalls etc.
Patch 3 introduces the new ABI.
Patch 4 and 5 nearly completely reimplement the kexec load, unload and exec sub-ops. The old
load_v1sub-op is then implemented on top of the new code.Patch 6 calls the kexec image when dom0 crashes. This avoids having to alter dom0 kernels to do a exec sub-op call on crash -- an existing
SHUTDOWN_crash.Patches 7 and 8 add the libxc API for the kexec calls.
The required patch series for kexec-tools will be posted shortly.
Quoted 7 lines
David
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
I have tested this patch set on a Fedora 17 dom0 with kernels:
3.7.3-101.fc17.x86_64
3.6.5-1.fc17.x86_64
So:
-Don Slutz
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 4 lines · David Vrabel
The series improves the kexec hypercall by making Xen responsible for loading and relocating the image. This allows kexec to be usable by pv-ops kernels and should allow kexec to be usable from a HVM or PVH privileged domain.
Any further comments/acks for any of these patches? Specifically patch 2 and the toolstack patches (7 and 8).
Thanks.
Quoted 13 lines
The first patch is a simple clean-up.
The second patch allows hypercall structures to be ABI compatible between 32- and 64-bit guests (by reusing stuff present for domctls and sysctls). This seems better than having to keep adding compat handling for new hypercalls etc.
Patch 3 introduces the new ABI.
Patch 4 and 5 nearly completely reimplement the kexec load, unload and exec sub-ops. The old
load_v1sub-op is then implemented on top of the new code.
Quoted 7 lines
Patch 6 calls the kexec image when dom0 crashes. This avoids having to alter dom0 kernels to do a exec sub-op call on crash -- an existing
SHUTDOWN_crash.Patches 7 and 8 add the libxc API for the kexec calls.
The required patch series for kexec-tools will be posted shortly.
David
Quoted 4 lines · David Vrabel
The series improves the kexec hypercall by making Xen responsible for loading and relocating the image. This allows kexec to be usable by pv-ops kernels and should allow kexec to be usable from a HVM or PVH privileged domain.
Any further comments/acks for any of these patches? Specifically patch 2 and the toolstack patches (7 and 8).
Thanks.
Quoted 13 lines
The first patch is a simple clean-up.
The second patch allows hypercall structures to be ABI compatible between 32- and 64-bit guests (by reusing stuff present for domctls and sysctls). This seems better than having to keep adding compat handling for new hypercalls etc.
Patch 3 introduces the new ABI.
Patch 4 and 5 nearly completely reimplement the kexec load, unload and exec sub-ops. The old
load_v1sub-op is then implemented on top of the new code.
Quoted 7 lines
Patch 6 calls the kexec image when dom0 crashes. This avoids having to alter dom0 kernels to do a exec sub-op call on crash -- an existing
SHUTDOWN_crash.Patches 7 and 8 add the libxc API for the kexec calls.
The required patch series for kexec-tools will be posted shortly.
David
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec