Skip to contentSkip to conversation

kexec-tools: add support for Xen 4.3

PATCH Superseded David Vrabel 3 participants 22 messages Apr 8, 2013 – Apr 17, 2013

Subsystems (2)

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v2 cover kexec-tools: add support for Xen 4.3

The series adds support for the new hypercall ABI which should be provided by Xen 4.3. Images are loaded into Xen directly with no kernel involvement.

Do not apply until the hypervisor side patches are applied to Xen.

Patch 1 is unrelated but kexec wouldn't work for me without it. Not sure why I had problems, perhaps a toolstack specific issue?

Patch 2 makes libxc 4.3 mandatory for Xen support.

Patch 3-4 removes a use of /proc/iomem in favour of libxc.

Patch 5 adds the support for loading, unloading, and exec'ing an image in Xen.

This series explicitly drops support for older version of libxc/Xen as supporting kexec on these hypervisors requires kernel support that will never be available upstream.

Changes since v1:
- Patch from Don Sultz: use libxc for vmcoreinfo.
- Use xc_get_max_cpus() to get number of PCPUs.
- Enable unload and exec of images.

David

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

#1 lore raw

PATCH 1/5 purgatory: put variables altered by kexec in .data not .bss

From: David Vrabel <[email protected]>

elf_rel_set_symbol() fails if the symbol is in the .bss section.

---
 purgatory/arch/i386/console-x86.c        |    6 +++---
 purgatory/arch/i386/crashdump_backup.c   |    8 +++++---
 purgatory/arch/x86_64/purgatory-x86_64.c |    6 +++---
 purgatory/include/purgatory.h            |    4 ++++
 purgatory/purgatory.c                    |    4 ++--
 5 files changed, 17 insertions(+), 11 deletions(-)
purgatory/arch/i386/console-x86.c +3 -3
index 9773573..40a734b 100644
@@ -55,9 +55,9 @@ static void putchar_vga(int ch)
  */
 
 /* Base Address */
-uint8_t console_serial = 0;
-uint16_t serial_base = 0x3f8; /* TTYS0 */
-uint32_t serial_baud = 0;
+uint8_t console_serial __data = 0;
+uint16_t serial_base __data = 0x3f8; /* TTYS0 */
+uint32_t serial_baud __data = 0;
 
 #define XMTRDY          0x20
 
purgatory/arch/i386/crashdump_backup.c +5 -3
index 365eb5d..0438a75 100644
@@ -21,13 +21,15 @@
 #include <stdint.h>
 #include <string.h>
 
+#include <purgatory.h>
+
 /* Backup region start gets set after /proc/iomem has been parsed. */
 /* We reuse the same code for x86_64 also so changing backup_start to
    unsigned long */
-unsigned long  backup_start = 0;
+unsigned long  backup_start __data = 0;
 
-unsigned long backup_src_start = 0;
-unsigned long backup_src_size = 0;
+unsigned long backup_src_start __data = 0;
+unsigned long backup_src_size __data = 0;
 
 /* Backup first 640K of memory to backup region as reserved by kexec.
  * Assuming first 640K has to be present on i386 machines and no address
purgatory/arch/x86_64/purgatory-x86_64.c +3 -3
index c25a9c2..8a3e24d 100644
@@ -3,11 +3,11 @@
 #include <purgatory.h>
 #include "purgatory-x86_64.h"
 
-uint8_t reset_vga = 0;
+uint8_t reset_vga __data = 0;
 uint8_t legacy_pic = 0;
-uint8_t panic_kernel = 0;
+uint8_t panic_kernel __data = 0;
 unsigned long jump_back_entry = 0;
-char *cmdline_end = NULL;
+char *cmdline_end __data = NULL;
 
 void setup_arch(void)
 {
purgatory/include/purgatory.h +4 -0
index ed50dc4..e2b061a 100644
@@ -1,6 +1,10 @@
 #ifndef PURGATORY_H
 #define PURGATORY_H
 
+/* Force variables that are adjusted by kexec to be in .data not
+   .bss. */
+#define __data __attribute__((section("data")))
+
 void putchar(int ch);
 void sprintf(char *buffer, const char *fmt, ...);
 void printf(const char *fmt, ...);
purgatory/purgatory.c +2 -2
index 3bbcc09..05f3b48 100644
@@ -6,8 +6,8 @@
 #include <string.h>
 #include "../kexec/kexec-sha256.h"
 
-struct sha256_region sha256_regions[SHA256_REGIONS] = {};
-sha256_digest_t sha256_digest = { };
+struct sha256_region sha256_regions[SHA256_REGIONS] __data = {};
+sha256_digest_t sha256_digest __data = { };
 
 int verify_sha256_digest(void)
 {
Signature · 1 line
1.7.2.5
#2 lore raw

PATCH 1/5 purgatory: put variables altered by kexec in .data not .bss

In reply to David Vrabel

From: David Vrabel <[email protected]>

elf_rel_set_symbol() fails if the symbol is in the .bss section.

---
 purgatory/arch/i386/console-x86.c        |    6 +++---
 purgatory/arch/i386/crashdump_backup.c   |    8 +++++---
 purgatory/arch/x86_64/purgatory-x86_64.c |    6 +++---
 purgatory/include/purgatory.h            |    4 ++++
 purgatory/purgatory.c                    |    4 ++--
 5 files changed, 17 insertions(+), 11 deletions(-)
purgatory/arch/i386/console-x86.c +3 -3
index 9773573..40a734b 100644
@@ -55,9 +55,9 @@ static void putchar_vga(int ch)
  */
 
 /* Base Address */
-uint8_t console_serial = 0;
-uint16_t serial_base = 0x3f8; /* TTYS0 */
-uint32_t serial_baud = 0;
+uint8_t console_serial __data = 0;
+uint16_t serial_base __data = 0x3f8; /* TTYS0 */
+uint32_t serial_baud __data = 0;
 
 #define XMTRDY          0x20
 
purgatory/arch/i386/crashdump_backup.c +5 -3
index 365eb5d..0438a75 100644
@@ -21,13 +21,15 @@
 #include <stdint.h>
 #include <string.h>
 
+#include <purgatory.h>
+
 /* Backup region start gets set after /proc/iomem has been parsed. */
 /* We reuse the same code for x86_64 also so changing backup_start to
    unsigned long */
-unsigned long  backup_start = 0;
+unsigned long  backup_start __data = 0;
 
-unsigned long backup_src_start = 0;
-unsigned long backup_src_size = 0;
+unsigned long backup_src_start __data = 0;
+unsigned long backup_src_size __data = 0;
 
 /* Backup first 640K of memory to backup region as reserved by kexec.
  * Assuming first 640K has to be present on i386 machines and no address
purgatory/arch/x86_64/purgatory-x86_64.c +3 -3
index c25a9c2..8a3e24d 100644
@@ -3,11 +3,11 @@
 #include <purgatory.h>
 #include "purgatory-x86_64.h"
 
-uint8_t reset_vga = 0;
+uint8_t reset_vga __data = 0;
 uint8_t legacy_pic = 0;
-uint8_t panic_kernel = 0;
+uint8_t panic_kernel __data = 0;
 unsigned long jump_back_entry = 0;
-char *cmdline_end = NULL;
+char *cmdline_end __data = NULL;
 
 void setup_arch(void)
 {
purgatory/include/purgatory.h +4 -0
index ed50dc4..e2b061a 100644
@@ -1,6 +1,10 @@
 #ifndef PURGATORY_H
 #define PURGATORY_H
 
+/* Force variables that are adjusted by kexec to be in .data not
+   .bss. */
+#define __data __attribute__((section("data")))
+
 void putchar(int ch);
 void sprintf(char *buffer, const char *fmt, ...);
 void printf(const char *fmt, ...);
purgatory/purgatory.c +2 -2
index 3bbcc09..05f3b48 100644
@@ -6,8 +6,8 @@
 #include <string.h>
 #include "../kexec/kexec-sha256.h"
 
-struct sha256_region sha256_regions[SHA256_REGIONS] = {};
-sha256_digest_t sha256_digest = { };
+struct sha256_region sha256_regions[SHA256_REGIONS] __data = {};
+sha256_digest_t sha256_digest __data = { };
 
 int verify_sha256_digest(void)
 {
Signature · 7 lines
1.7.2.5


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

PATCH 2/5 kexec/xen: require libxc from Xen 4.3

In reply to David Vrabel

From: David Vrabel <[email protected]>

libxc from Xen 4.3 added xc_kexec_load() which will be required to load images into Xen in the future.

Remove all the #ifdef'ery for older versions of libxc.

---
 configure.ac                       |    5 +-
 kexec/arch/i386/crashdump-x86.c    |  109 ------------------------------------
 kexec/arch/i386/kexec-x86-common.c |  103 ----------------------------------
 kexec/crashdump-xen.c              |   12 ----
 4 files changed, 1 insertions(+), 228 deletions(-)
configure.ac +1 -4
index 438b3c9..120a5ed 100644
@@ -161,11 +161,8 @@ fi
 dnl find Xen control stack libraries
 if test "$with_xen" = yes ; then
 	AC_CHECK_HEADER(xenctrl.h,
-		AC_CHECK_LIB(xenctrl, xc_version, ,
+		AC_CHECK_LIB(xenctrl, xc_kexec_load, ,
 		AC_MSG_NOTICE([Xen support disabled])))
-	if test "$ac_cv_lib_xenctrl_xc_version" = yes ; then
-		AC_CHECK_FUNCS(xc_get_machine_memory_map)
-	fi
 fi
 
 dnl ---Sanity checks
kexec/arch/i386/crashdump-x86.c +0 -109

142 lines not on this page · raw message

kexec/arch/i386/kexec-x86-common.c +0 -103

135 lines not on this page · raw message

kexec/crashdump-xen.c +0 -12
index d8bd0f4..ff4706c 100644
@@ -131,30 +131,18 @@ unsigned long xen_architecture(struct crash_elf_info *elf_info)
 #ifdef HAVE_LIBXENCTRL
 	int rc;
 	xen_capabilities_info_t capabilities;
-#ifdef XENCTRL_HAS_XC_INTERFACE
 	xc_interface *xc;
-#else
-	int xc;
-#endif
 
 	if (!xen_present())
 		goto out;
 
 	memset(capabilities, '0', XEN_CAPABILITIES_INFO_LEN);
 
-#ifdef XENCTRL_HAS_XC_INTERFACE
 	xc = xc_interface_open(NULL, NULL, 0);
 	if ( !xc ) {
 		fprintf(stderr, "failed to open xen control interface.\n");
 		goto out;
 	}
-#else
-	xc = xc_interface_open();
-	if ( xc == -1 ) {
-		fprintf(stderr, "failed to open xen control interface.\n");
-		goto out;
-	}
-#endif
 
 	rc = xc_version(xc, XENVER_capabilities, &capabilities[0]);
 	if ( rc == -1 ) {
Signature · 1 line
1.7.2.5
#4 lore raw

PATCH 2/5 kexec/xen: require libxc from Xen 4.3

In reply to David Vrabel

From: David Vrabel <[email protected]>

libxc from Xen 4.3 added xc_kexec_load() which will be required to load images into Xen in the future.

Remove all the #ifdef'ery for older versions of libxc.

---
 configure.ac                       |    5 +-
 kexec/arch/i386/crashdump-x86.c    |  109 ------------------------------------
 kexec/arch/i386/kexec-x86-common.c |  103 ----------------------------------
 kexec/crashdump-xen.c              |   12 ----
 4 files changed, 1 insertions(+), 228 deletions(-)
configure.ac +1 -4
index 438b3c9..120a5ed 100644
@@ -161,11 +161,8 @@ fi
 dnl find Xen control stack libraries
 if test "$with_xen" = yes ; then
 	AC_CHECK_HEADER(xenctrl.h,
-		AC_CHECK_LIB(xenctrl, xc_version, ,
+		AC_CHECK_LIB(xenctrl, xc_kexec_load, ,
 		AC_MSG_NOTICE([Xen support disabled])))
-	if test "$ac_cv_lib_xenctrl_xc_version" = yes ; then
-		AC_CHECK_FUNCS(xc_get_machine_memory_map)
-	fi
 fi
 
 dnl ---Sanity checks
kexec/arch/i386/crashdump-x86.c +0 -109

142 lines not on this page · raw message

kexec/arch/i386/kexec-x86-common.c +0 -103

135 lines not on this page · raw message

kexec/crashdump-xen.c +0 -12
index d8bd0f4..ff4706c 100644
@@ -131,30 +131,18 @@ unsigned long xen_architecture(struct crash_elf_info *elf_info)
 #ifdef HAVE_LIBXENCTRL
 	int rc;
 	xen_capabilities_info_t capabilities;
-#ifdef XENCTRL_HAS_XC_INTERFACE
 	xc_interface *xc;
-#else
-	int xc;
-#endif
 
 	if (!xen_present())
 		goto out;
 
 	memset(capabilities, '0', XEN_CAPABILITIES_INFO_LEN);
 
-#ifdef XENCTRL_HAS_XC_INTERFACE
 	xc = xc_interface_open(NULL, NULL, 0);
 	if ( !xc ) {
 		fprintf(stderr, "failed to open xen control interface.\n");
 		goto out;
 	}
-#else
-	xc = xc_interface_open();
-	if ( xc == -1 ) {
-		fprintf(stderr, "failed to open xen control interface.\n");
-		goto out;
-	}
-#endif
 
 	rc = xc_version(xc, XENVER_capabilities, &capabilities[0]);
 	if ( rc == -1 ) {
Signature · 7 lines
1.7.2.5


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

PATCH 3/5 kexec/xen: use libxc to get location of crash notes

In reply to David Vrabel

From: David Vrabel <[email protected]>

Use xc_kexec_get_range(KEXEC_RANGE_MA_CPU) instead of parsing /proc/iomem (which is only populated by non-upstream ("classic") Xen kernels).

---
 kexec/crashdump-xen.c |   61 ++++++++++++++++++++++++++++---------------------
 1 files changed, 35 insertions(+), 26 deletions(-)
kexec/crashdump-xen.c +35 -26
index ff4706c..13335a5 100644
@@ -163,42 +163,51 @@ unsigned long xen_architecture(struct crash_elf_info *elf_info)
 	return machine;
 }
 
-static int xen_crash_note_callback(void *UNUSED(data), int nr,
-				   char *UNUSED(str),
-				   unsigned long base,
-				   unsigned long length)
-{
-	struct crash_note_info *note = xen_phys_notes + nr;
-
-	note->base = base;
-	note->length = length;
-
-	return 0;
-}
-
+#ifdef HAVE_LIBXENCTRL
 int xen_get_nr_phys_cpus(void)
 {
-	char *match = "Crash note\n";
-	int cpus, n;
+	xc_interface *xc;
+	int cpu;
 
 	if (xen_phys_cpus)
 		return xen_phys_cpus;
 
-	if ((cpus = kexec_iomem_for_each_line(match, NULL, NULL))) {
-		n = sizeof(struct crash_note_info) * cpus;
-		xen_phys_notes = malloc(n);
-		if (!xen_phys_notes) {
-			fprintf(stderr, "failed to allocate xen_phys_notes.\n");
+	xc = xc_interface_open(NULL, NULL, 0);
+	if ( !xc ) {
+		fprintf(stderr, "failed to open xen control interface.\n");
+		return -1;
+	}
+
+	for (cpu = 0;; cpu++) {
+		uint64_t size, start;
+		int ret;
+
+		ret = xc_kexec_get_range(xc, KEXEC_RANGE_MA_CPU, cpu, &size, &start);
+		if (ret < 0)
+			break;
+
+		xen_phys_notes = realloc(xen_phys_notes,
+					 sizeof(*xen_phys_notes) * (cpu + 1));
+		if (xen_phys_notes == NULL)
 			return -1;
-		}
-		memset(xen_phys_notes, 0, n);
-		kexec_iomem_for_each_line(match,
-					  xen_crash_note_callback, NULL);
-		xen_phys_cpus = cpus;
+
+		xen_phys_notes[cpu].base = start;
+		xen_phys_notes[cpu].length = size;
 	}
 
-	return cpus;
+	xc_interface_close(xc);
+
+	xen_phys_cpus = cpu;
+
+	return cpu;
 }
+#else
+int xen_get_nr_phys_cpus(void)
+{
+	return -1;
+}
+#endif
+
 
 int xen_get_note(int cpu, uint64_t *addr, uint64_t *len)
 {
Signature · 1 line
1.7.2.5
#6 lore raw

PATCH 3/5 kexec/xen: use libxc to get location of crash notes

In reply to David Vrabel

From: David Vrabel <[email protected]>

Use xc_kexec_get_range(KEXEC_RANGE_MA_CPU) instead of parsing /proc/iomem (which is only populated by non-upstream ("classic") Xen kernels).

---
 kexec/crashdump-xen.c |   61 ++++++++++++++++++++++++++++---------------------
 1 files changed, 35 insertions(+), 26 deletions(-)
kexec/crashdump-xen.c +35 -26
index ff4706c..13335a5 100644
@@ -163,42 +163,51 @@ unsigned long xen_architecture(struct crash_elf_info *elf_info)
 	return machine;
 }
 
-static int xen_crash_note_callback(void *UNUSED(data), int nr,
-				   char *UNUSED(str),
-				   unsigned long base,
-				   unsigned long length)
-{
-	struct crash_note_info *note = xen_phys_notes + nr;
-
-	note->base = base;
-	note->length = length;
-
-	return 0;
-}
-
+#ifdef HAVE_LIBXENCTRL
 int xen_get_nr_phys_cpus(void)
 {
-	char *match = "Crash note\n";
-	int cpus, n;
+	xc_interface *xc;
+	int cpu;
 
 	if (xen_phys_cpus)
 		return xen_phys_cpus;
 
-	if ((cpus = kexec_iomem_for_each_line(match, NULL, NULL))) {
-		n = sizeof(struct crash_note_info) * cpus;
-		xen_phys_notes = malloc(n);
-		if (!xen_phys_notes) {
-			fprintf(stderr, "failed to allocate xen_phys_notes.\n");
+	xc = xc_interface_open(NULL, NULL, 0);
+	if ( !xc ) {
+		fprintf(stderr, "failed to open xen control interface.\n");
+		return -1;
+	}
+
+	for (cpu = 0;; cpu++) {
+		uint64_t size, start;
+		int ret;
+
+		ret = xc_kexec_get_range(xc, KEXEC_RANGE_MA_CPU, cpu, &size, &start);
+		if (ret < 0)
+			break;
+
+		xen_phys_notes = realloc(xen_phys_notes,
+					 sizeof(*xen_phys_notes) * (cpu + 1));
+		if (xen_phys_notes == NULL)
 			return -1;
-		}
-		memset(xen_phys_notes, 0, n);
-		kexec_iomem_for_each_line(match,
-					  xen_crash_note_callback, NULL);
-		xen_phys_cpus = cpus;
+
+		xen_phys_notes[cpu].base = start;
+		xen_phys_notes[cpu].length = size;
 	}
 
-	return cpus;
+	xc_interface_close(xc);
+
+	xen_phys_cpus = cpu;
+
+	return cpu;
 }
+#else
+int xen_get_nr_phys_cpus(void)
+{
+	return -1;
+}
+#endif
+
 
 int xen_get_note(int cpu, uint64_t *addr, uint64_t *len)
 {
Signature · 7 lines
1.7.2.5


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

PATCH 4/5 kexec/xen: switch to use xc_kexec_get_range for get_xen_vmcoreinfo.

In reply to David Vrabel

From: Don Slutz <[email protected]>

---
 kexec/crashdump-xen.c |   20 ++++++++++++++++++++
 kexec/crashdump.c     |    2 ++
 2 files changed, 22 insertions(+), 0 deletions(-)
kexec/crashdump-xen.c +20 -0
index 13335a5..dfb86c8 100644
@@ -164,6 +164,26 @@ unsigned long xen_architecture(struct crash_elf_info *elf_info)
 }
 
 #ifdef HAVE_LIBXENCTRL
+int get_xen_vmcoreinfo(uint64_t *addr, uint64_t *len)
+{
+	xc_interface *xc;
+	int ret = 0;
+
+	xc = xc_interface_open(NULL, NULL, 0);
+	if (!xc) {
+	        fprintf(stderr, "failed to open xen control interface.\n");
+	        return -1;
+	}
+
+	ret = xc_kexec_get_range(xc, KEXEC_RANGE_MA_VMCOREINFO, 0, len, addr);
+
+	xc_interface_close(xc);
+
+	if (ret < 0)
+	        return -1;
+	return 0;
+}
+
 int xen_get_nr_phys_cpus(void)
 {
 	xc_interface *xc;
kexec/crashdump.c +2 -0
index cdd3ef6..b8441b7 100644
@@ -141,7 +141,9 @@ int get_kernel_vmcoreinfo(uint64_t *addr, uint64_t *len)
 	return get_vmcoreinfo("/sys/kernel/vmcoreinfo", addr, len);
 }
 
+#ifndef HAVE_LIBXENCTRL
 int get_xen_vmcoreinfo(uint64_t *addr, uint64_t *len)
 {
 	return get_vmcoreinfo("/sys/hypervisor/vmcoreinfo", addr, len);
 }
+#endif
Signature · 1 line
1.7.2.5
#8 lore raw

PATCH 5/5 kexec/xen: directly load images images into Xen

In reply to David Vrabel

From: David Vrabel <[email protected]>

Xen 4.3 has an improvided kexec hypercall ABI that allows images to be loaded and executed without any kernel involvement. Use the API provided by libxc to load images when running in a Xen guest.

Support for loading images via the kexec_load syscall in non-upstream ("classic") Xen kernels is no longer supported.

---
 kexec/Makefile                     |    1 +
 kexec/arch/i386/crashdump-x86.c    |   19 ++++++-
 kexec/arch/i386/kexec-x86-common.c |    6 +-
 kexec/crashdump-xen.c              |   52 ++++++++++++++--
 kexec/crashdump.h                  |    3 +-
 kexec/kexec-xen.c                  |  117 ++++++++++++++++++++++++++++++++++++
 kexec/kexec.c                      |   26 +++++++--
 kexec/kexec.h                      |    7 ++
 8 files changed, 214 insertions(+), 17 deletions(-)
 create mode 100644 kexec/kexec-xen.c
kexec/Makefile +1 -0
index 8a6138d..dc9dab1 100644
@@ -25,6 +25,7 @@ KEXEC_SRCS_base += kexec/phys_arch.c
 KEXEC_SRCS_base += kexec/kernel_version.c
 KEXEC_SRCS_base += kexec/lzma.c
 KEXEC_SRCS_base += kexec/zlib.c
+KEXEC_SRCS_base += kexec/kexec-xen.c
 
 KEXEC_GENERATED_SRCS += $(PURGATORY_HEX_C)
 
kexec/arch/i386/crashdump-x86.c +18 -1
index f9709fe..46a76f9 100644
@@ -939,11 +939,28 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
 	return 0;
 }
 
+int get_crashkernel_region(uint64_t *start, uint64_t *end)
+{
+	int ret;
+
+	if (xen_present())
+		ret = xen_get_crashkernel_region(start, end);
+	else
+		ret = parse_iomem_single("Crash kernel\n", start, end);
+	if (ret < 0)
+		return ret;
+	if (start == end)
+		return -1;
+	return 0;
+}
+
 int is_crashkernel_mem_reserved(void)
 {
 	uint64_t start, end;
+	int rc;
 
-	if (parse_iomem_single("Crash kernel\n", &start, &end) || start == end)
+	rc = get_crashkernel_region(&start, &end);
+	if (rc < 0)
 		return 0;
 
 	crash_reserved_mem.start = start;
kexec/arch/i386/kexec-x86-common.c +3 -3
index dba89f2..2477dee 100644
@@ -364,9 +364,9 @@ int get_memory_ranges(struct memory_range **range, int *ranges,
 	    !(kexec_flags & KEXEC_PRESERVE_CONTEXT)) {
 		uint64_t start, end;
 
-		ret = parse_iomem_single("Crash kernel\n", &start, &end);
-		if (ret != 0) {
-			fprintf(stderr, "parse_iomem_single failed.\n");
+		ret = get_crashkernel_region(&start, &end);
+		if (ret < 0) {
+			fprintf(stderr, "No crash region available.\n");
 			return -1;
 		}
 
kexec/crashdump-xen.c +45 -7

77 lines not on this page · raw message

kexec/crashdump.h +2 -1
index 0f7c2ea..95f1f0c 100644
@@ -1,6 +1,7 @@
 #ifndef CRASHDUMP_H
 #define CRASHDUMP_H
 
+int get_crashkernel_region(uint64_t *start, uint64_t *end);
 extern int get_crash_notes_per_cpu(int cpu, uint64_t *addr, uint64_t *len);
 extern int get_kernel_vmcoreinfo(uint64_t *addr, uint64_t *len);
 extern int get_xen_vmcoreinfo(uint64_t *addr, uint64_t *len);
@@ -56,9 +57,9 @@ unsigned long crash_architecture(struct crash_elf_info *elf_info);
 unsigned long phys_to_virt(struct crash_elf_info *elf_info,
 			   unsigned long paddr);
 
-int xen_present(void);
 unsigned long xen_architecture(struct crash_elf_info *elf_info);
 int xen_get_nr_phys_cpus(void);
 int xen_get_note(int cpu, uint64_t *addr, uint64_t *len);
+int xen_get_crashkernel_region(uint64_t *start, uint64_t *end);
 
 #endif /* CRASHDUMP_H */
kexec/kexec-xen.c new file +117 -0

117 lines not on this page · raw message

kexec/kexec.c +21 -5
index 16c6308..9db288f 100644
@@ -764,8 +764,14 @@ static int my_load(const char *type, int fileind, int argc, char **argv,
 		info.entry, info.kexec_flags);
 	print_segments(stderr, &info);
 #endif
-	result = kexec_load(
-		info.entry, info.nr_segments, info.segment, info.kexec_flags);
+	if (xen_present())
+		result = xen_kexec_load((uint64_t)info.entry,
+					info.nr_segments, info.segment,
+					info.kexec_flags);
+	else
+		result = kexec_load(info.entry,
+				    info.nr_segments, info.segment,
+				    info.kexec_flags);
 	if (result != 0) {
 		/* The load failed, print some debugging information */
 		fprintf(stderr, "kexec_load failed: %s\n", 
@@ -789,10 +795,13 @@ static int k_unload (unsigned long kexec_flags)
 	}
 	kexec_flags |= native_arch;
 
-	result = kexec_load(NULL, 0, NULL, kexec_flags);
+	if (xen_present())
+		result = xen_kexec_unload(kexec_flags);
+	else
+		result = kexec_load(NULL, 0, NULL, kexec_flags);
 	if (result != 0) {
 		/* The unload failed, print some debugging information */
-		fprintf(stderr, "kexec_load (0 segments) failed: %s\n",
+		fprintf(stderr, "kexec unload failed: %s\n",
 			strerror(errno));
 	}
 	return result;
@@ -823,7 +832,10 @@ static int my_shutdown(void)
  */
 static int my_exec(void)
 {
-	reboot(LINUX_REBOOT_CMD_KEXEC);
+	if (xen_present())
+		xen_kexec_exec();
+	else
+		reboot(LINUX_REBOOT_CMD_KEXEC);
 	/* I have failed if I make it here */
 	fprintf(stderr, "kexec failed: %s\n", 
 		strerror(errno));
@@ -924,6 +936,10 @@ static int kexec_loaded(void)
 	char *p;
 	char line[3];
 
+	/* No way to tell if an image is loaded under Xen, assume it is. */
+	if (xen_present())
+		return 1;
+
 	fp = fopen("/sys/kernel/kexec_loaded", "r");
 	if (fp == NULL)
 		return -1;
kexec/kexec.h +7 -0
index 94c62c1..d28a04b 100644
@@ -280,4 +280,11 @@ extern int add_backup_segments(struct kexec_info *info,
 
 char *concat_cmdline(const char *base, const char *append);
 
+int xen_present(void);
+int xen_kexec_load(uint64_t entry,
+		   uint32_t nr_segments, struct kexec_segment *segments,
+		   uint64_t kexec_flags);
+int xen_kexec_unload(uint64_t kexec_flags);
+void xen_kexec_exec(void);
+
 #endif /* KEXEC_H */
Signature · 1 line
1.7.2.5
#9 lore raw

PATCH 5/5 kexec/xen: directly load images images into Xen

In reply to David Vrabel

From: David Vrabel <[email protected]>

Xen 4.3 has an improvided kexec hypercall ABI that allows images to be loaded and executed without any kernel involvement. Use the API provided by libxc to load images when running in a Xen guest.

Support for loading images via the kexec_load syscall in non-upstream ("classic") Xen kernels is no longer supported.

---
 kexec/Makefile                     |    1 +
 kexec/arch/i386/crashdump-x86.c    |   19 ++++++-
 kexec/arch/i386/kexec-x86-common.c |    6 +-
 kexec/crashdump-xen.c              |   52 ++++++++++++++--
 kexec/crashdump.h                  |    3 +-
 kexec/kexec-xen.c                  |  117 ++++++++++++++++++++++++++++++++++++
 kexec/kexec.c                      |   26 +++++++--
 kexec/kexec.h                      |    7 ++
 8 files changed, 214 insertions(+), 17 deletions(-)
 create mode 100644 kexec/kexec-xen.c
kexec/Makefile +1 -0
index 8a6138d..dc9dab1 100644
@@ -25,6 +25,7 @@ KEXEC_SRCS_base += kexec/phys_arch.c
 KEXEC_SRCS_base += kexec/kernel_version.c
 KEXEC_SRCS_base += kexec/lzma.c
 KEXEC_SRCS_base += kexec/zlib.c
+KEXEC_SRCS_base += kexec/kexec-xen.c
 
 KEXEC_GENERATED_SRCS += $(PURGATORY_HEX_C)
 
kexec/arch/i386/crashdump-x86.c +18 -1
index f9709fe..46a76f9 100644
@@ -939,11 +939,28 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
 	return 0;
 }
 
+int get_crashkernel_region(uint64_t *start, uint64_t *end)
+{
+	int ret;
+
+	if (xen_present())
+		ret = xen_get_crashkernel_region(start, end);
+	else
+		ret = parse_iomem_single("Crash kernel\n", start, end);
+	if (ret < 0)
+		return ret;
+	if (start == end)
+		return -1;
+	return 0;
+}
+
 int is_crashkernel_mem_reserved(void)
 {
 	uint64_t start, end;
+	int rc;
 
-	if (parse_iomem_single("Crash kernel\n", &start, &end) || start == end)
+	rc = get_crashkernel_region(&start, &end);
+	if (rc < 0)
 		return 0;
 
 	crash_reserved_mem.start = start;
kexec/arch/i386/kexec-x86-common.c +3 -3
index dba89f2..2477dee 100644
@@ -364,9 +364,9 @@ int get_memory_ranges(struct memory_range **range, int *ranges,
 	    !(kexec_flags & KEXEC_PRESERVE_CONTEXT)) {
 		uint64_t start, end;
 
-		ret = parse_iomem_single("Crash kernel\n", &start, &end);
-		if (ret != 0) {
-			fprintf(stderr, "parse_iomem_single failed.\n");
+		ret = get_crashkernel_region(&start, &end);
+		if (ret < 0) {
+			fprintf(stderr, "No crash region available.\n");
 			return -1;
 		}
 
kexec/crashdump-xen.c +45 -7

77 lines not on this page · raw message

kexec/crashdump.h +2 -1
index 0f7c2ea..95f1f0c 100644
@@ -1,6 +1,7 @@
 #ifndef CRASHDUMP_H
 #define CRASHDUMP_H
 
+int get_crashkernel_region(uint64_t *start, uint64_t *end);
 extern int get_crash_notes_per_cpu(int cpu, uint64_t *addr, uint64_t *len);
 extern int get_kernel_vmcoreinfo(uint64_t *addr, uint64_t *len);
 extern int get_xen_vmcoreinfo(uint64_t *addr, uint64_t *len);
@@ -56,9 +57,9 @@ unsigned long crash_architecture(struct crash_elf_info *elf_info);
 unsigned long phys_to_virt(struct crash_elf_info *elf_info,
 			   unsigned long paddr);
 
-int xen_present(void);
 unsigned long xen_architecture(struct crash_elf_info *elf_info);
 int xen_get_nr_phys_cpus(void);
 int xen_get_note(int cpu, uint64_t *addr, uint64_t *len);
+int xen_get_crashkernel_region(uint64_t *start, uint64_t *end);
 
 #endif /* CRASHDUMP_H */
kexec/kexec-xen.c new file +117 -0

117 lines not on this page · raw message

kexec/kexec.c +21 -5
index 16c6308..9db288f 100644
@@ -764,8 +764,14 @@ static int my_load(const char *type, int fileind, int argc, char **argv,
 		info.entry, info.kexec_flags);
 	print_segments(stderr, &info);
 #endif
-	result = kexec_load(
-		info.entry, info.nr_segments, info.segment, info.kexec_flags);
+	if (xen_present())
+		result = xen_kexec_load((uint64_t)info.entry,
+					info.nr_segments, info.segment,
+					info.kexec_flags);
+	else
+		result = kexec_load(info.entry,
+				    info.nr_segments, info.segment,
+				    info.kexec_flags);
 	if (result != 0) {
 		/* The load failed, print some debugging information */
 		fprintf(stderr, "kexec_load failed: %s\n", 
@@ -789,10 +795,13 @@ static int k_unload (unsigned long kexec_flags)
 	}
 	kexec_flags |= native_arch;
 
-	result = kexec_load(NULL, 0, NULL, kexec_flags);
+	if (xen_present())
+		result = xen_kexec_unload(kexec_flags);
+	else
+		result = kexec_load(NULL, 0, NULL, kexec_flags);
 	if (result != 0) {
 		/* The unload failed, print some debugging information */
-		fprintf(stderr, "kexec_load (0 segments) failed: %s\n",
+		fprintf(stderr, "kexec unload failed: %s\n",
 			strerror(errno));
 	}
 	return result;
@@ -823,7 +832,10 @@ static int my_shutdown(void)
  */
 static int my_exec(void)
 {
-	reboot(LINUX_REBOOT_CMD_KEXEC);
+	if (xen_present())
+		xen_kexec_exec();
+	else
+		reboot(LINUX_REBOOT_CMD_KEXEC);
 	/* I have failed if I make it here */
 	fprintf(stderr, "kexec failed: %s\n", 
 		strerror(errno));
@@ -924,6 +936,10 @@ static int kexec_loaded(void)
 	char *p;
 	char line[3];
 
+	/* No way to tell if an image is loaded under Xen, assume it is. */
+	if (xen_present())
+		return 1;
+
 	fp = fopen("/sys/kernel/kexec_loaded", "r");
 	if (fp == NULL)
 		return -1;
kexec/kexec.h +7 -0
index 94c62c1..d28a04b 100644
@@ -280,4 +280,11 @@ extern int add_backup_segments(struct kexec_info *info,
 
 char *concat_cmdline(const char *base, const char *append);
 
+int xen_present(void);
+int xen_kexec_load(uint64_t entry,
+		   uint32_t nr_segments, struct kexec_segment *segments,
+		   uint64_t kexec_flags);
+int xen_kexec_unload(uint64_t kexec_flags);
+void xen_kexec_exec(void);
+
 #endif /* KEXEC_H */
Signature · 7 lines
1.7.2.5


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

Re: [PATCH 5/5] kexec/xen: directly load images images into Xen

Quoted 10 lines · David Vrabel

From: David Vrabel <[email protected]>

Xen 4.3 has an improvided kexec hypercall ABI that allows images to be loaded and executed without any kernel involvement. Use the API provided by libxc to load images when running in a Xen guest.

Support for loading images via the kexec_load syscall in non-upstream ("classic") Xen kernels is no longer supported.

[...]

Quoted 1 line
kexec/kexec-xen.c +0 -0

[...]

Quoted 31 lines
kexec/kexec-xen.c +31 -0
+int xen_kexec_load(uint64_t entry,
+		   uint32_t nr_segments, struct kexec_segment *segments,
+		   uint64_t kexec_flags)
+{
+	xc_interface *xch;
+	xc_hypercall_buffer_array_t *array = NULL;
+	uint8_t type;
+	uint8_t arch;
+	xen_kexec_segment_t *xen_segs;
+	int s;
+	int ret = -1;
+
+	xch = xc_interface_open(NULL, NULL, 0);
+	if (!xch)
+		return -1;
+
+	xen_segs = calloc(nr_segments, sizeof(*xen_segs));
+	if (!xen_segs)
+		goto out;
+
+	array = xc_hypercall_buffer_array_create(xch, nr_segments);
+	if (array == NULL)
+		goto out;
+
+	for (s = 0; s < nr_segments; s++) {
+		DECLARE_HYPERCALL_BUFFER(void, seg_buf);
+
+		seg_buf = xc_hypercall_buffer_array_alloc(xch, array, s,
+							  seg_buf, segments[s].bufsz);
+		if (seg_buf == NULL)
+			goto out;

kexec/kexec-xen.c line 55

Quoted 10 lines
kexec/kexec-xen.c +10 -0
+		memcpy(seg_buf, segments[s].buf, segments[s].bufsz);
+
+		set_xen_guest_handle(xen_segs[s].buf, seg_buf);
+		xen_segs[s].buf_size = segments[s].bufsz;
+		xen_segs[s].dest_maddr = (uint64_t)segments[s].mem;
+		xen_segs[s].dest_size = segments[s].memsz;
+	}
+
+	type = kexec_flags & KEXEC_TYPE_CRASH;
+	arch = (kexec_flags >> 16) & 0xffff;

arch = (kexec_flags & KEXEC_ARCH_MASK) >> 16;

Daniel

#11 lore raw

Re: [PATCH 5/5] kexec/xen: directly load images images into Xen

In reply to David Vrabel
Quoted 10 lines · David Vrabel

From: David Vrabel <[email protected]>

Xen 4.3 has an improvided kexec hypercall ABI that allows images to be loaded and executed without any kernel involvement. Use the API provided by libxc to load images when running in a Xen guest.

Support for loading images via the kexec_load syscall in non-upstream ("classic") Xen kernels is no longer supported.

[...]

Quoted 1 line
kexec/kexec-xen.c +0 -0

[...]

Quoted 31 lines
kexec/kexec-xen.c +31 -0
+int xen_kexec_load(uint64_t entry,
+		   uint32_t nr_segments, struct kexec_segment *segments,
+		   uint64_t kexec_flags)
+{
+	xc_interface *xch;
+	xc_hypercall_buffer_array_t *array = NULL;
+	uint8_t type;
+	uint8_t arch;
+	xen_kexec_segment_t *xen_segs;
+	int s;
+	int ret = -1;
+
+	xch = xc_interface_open(NULL, NULL, 0);
+	if (!xch)
+		return -1;
+
+	xen_segs = calloc(nr_segments, sizeof(*xen_segs));
+	if (!xen_segs)
+		goto out;
+
+	array = xc_hypercall_buffer_array_create(xch, nr_segments);
+	if (array == NULL)
+		goto out;
+
+	for (s = 0; s < nr_segments; s++) {
+		DECLARE_HYPERCALL_BUFFER(void, seg_buf);
+
+		seg_buf = xc_hypercall_buffer_array_alloc(xch, array, s,
+							  seg_buf, segments[s].bufsz);
+		if (seg_buf == NULL)
+			goto out;

kexec/kexec-xen.c line 55

Quoted 10 lines
kexec/kexec-xen.c +10 -0
+		memcpy(seg_buf, segments[s].buf, segments[s].bufsz);
+
+		set_xen_guest_handle(xen_segs[s].buf, seg_buf);
+		xen_segs[s].buf_size = segments[s].bufsz;
+		xen_segs[s].dest_maddr = (uint64_t)segments[s].mem;
+		xen_segs[s].dest_size = segments[s].memsz;
+	}
+
+	type = kexec_flags & KEXEC_TYPE_CRASH;
+	arch = (kexec_flags >> 16) & 0xffff;

arch = (kexec_flags & KEXEC_ARCH_MASK) >> 16;

Daniel

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

#12 lore raw

Re: [PATCH 5/5] kexec/xen: directly load images images into Xen

Quoted 53 lines · Daniel Kiper
Quoted 10 lines · David Vrabel

From: David Vrabel <[email protected]>

Xen 4.3 has an improvided kexec hypercall ABI that allows images to be loaded and executed without any kernel involvement. Use the API provided by libxc to load images when running in a Xen guest.

Support for loading images via the kexec_load syscall in non-upstream ("classic") Xen kernels is no longer supported.

[...]

Quoted 1 line
kexec/kexec-xen.c +0 -0

[...]

Quoted 35 lines
kexec/kexec-xen.c +35 -0
+int xen_kexec_load(uint64_t entry,
+		   uint32_t nr_segments, struct kexec_segment *segments,
+		   uint64_t kexec_flags)
+{
+	xc_interface *xch;
+	xc_hypercall_buffer_array_t *array = NULL;
+	uint8_t type;
+	uint8_t arch;
+	xen_kexec_segment_t *xen_segs;
+	int s;
+	int ret = -1;
+
+	xch = xc_interface_open(NULL, NULL, 0);
+	if (!xch)
+		return -1;
+
+	xen_segs = calloc(nr_segments, sizeof(*xen_segs));
+	if (!xen_segs)
+		goto out;
+
+	array = xc_hypercall_buffer_array_create(xch, nr_segments);
+	if (array == NULL)
+		goto out;
+
+	for (s = 0; s < nr_segments; s++) {
+		DECLARE_HYPERCALL_BUFFER(void, seg_buf);
+
+		seg_buf = xc_hypercall_buffer_array_alloc(xch, array, s,
+							  seg_buf, segments[s].bufsz);
+		if (seg_buf == NULL)
+			goto out;
+		memcpy(seg_buf, segments[s].buf, segments[s].bufsz);
+
+		set_xen_guest_handle(xen_segs[s].buf, seg_buf);
+		xen_segs[s].buf_size = segments[s].bufsz;
Quoted 8 lines

kexec/kexec-xen.c line 55

Quoted 6 lines
kexec/kexec-xen.c +6 -0
+		xen_segs[s].dest_maddr = (uint64_t)segments[s].mem;
+		xen_segs[s].dest_size = segments[s].memsz;
+	}
+
+	type = kexec_flags & KEXEC_TYPE_CRASH;
+	arch = (kexec_flags >> 16) & 0xffff;

arch = (kexec_flags & KEXEC_ARCH_MASK) >> 16;

What is wrong with this line?
Why did not you applied it?

Daniel

#13 lore raw

Re: [PATCH 5/5] kexec/xen: directly load images images into Xen

In reply to Daniel Kiper
Quoted 53 lines · Daniel Kiper
Quoted 10 lines · David Vrabel

From: David Vrabel <[email protected]>

Xen 4.3 has an improvided kexec hypercall ABI that allows images to be loaded and executed without any kernel involvement. Use the API provided by libxc to load images when running in a Xen guest.

Support for loading images via the kexec_load syscall in non-upstream ("classic") Xen kernels is no longer supported.

[...]

Quoted 1 line
kexec/kexec-xen.c +0 -0

[...]

Quoted 35 lines
kexec/kexec-xen.c +35 -0
+int xen_kexec_load(uint64_t entry,
+		   uint32_t nr_segments, struct kexec_segment *segments,
+		   uint64_t kexec_flags)
+{
+	xc_interface *xch;
+	xc_hypercall_buffer_array_t *array = NULL;
+	uint8_t type;
+	uint8_t arch;
+	xen_kexec_segment_t *xen_segs;
+	int s;
+	int ret = -1;
+
+	xch = xc_interface_open(NULL, NULL, 0);
+	if (!xch)
+		return -1;
+
+	xen_segs = calloc(nr_segments, sizeof(*xen_segs));
+	if (!xen_segs)
+		goto out;
+
+	array = xc_hypercall_buffer_array_create(xch, nr_segments);
+	if (array == NULL)
+		goto out;
+
+	for (s = 0; s < nr_segments; s++) {
+		DECLARE_HYPERCALL_BUFFER(void, seg_buf);
+
+		seg_buf = xc_hypercall_buffer_array_alloc(xch, array, s,
+							  seg_buf, segments[s].bufsz);
+		if (seg_buf == NULL)
+			goto out;
+		memcpy(seg_buf, segments[s].buf, segments[s].bufsz);
+
+		set_xen_guest_handle(xen_segs[s].buf, seg_buf);
+		xen_segs[s].buf_size = segments[s].bufsz;
Quoted 8 lines

kexec/kexec-xen.c line 55

Quoted 6 lines
kexec/kexec-xen.c +6 -0
+		xen_segs[s].dest_maddr = (uint64_t)segments[s].mem;
+		xen_segs[s].dest_size = segments[s].memsz;
+	}
+
+	type = kexec_flags & KEXEC_TYPE_CRASH;
+	arch = (kexec_flags >> 16) & 0xffff;

arch = (kexec_flags & KEXEC_ARCH_MASK) >> 16;

What is wrong with this line?
Why did not you applied it?

Daniel

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

#14 lore raw

Re: [PATCH 5/5] kexec/xen: directly load images images into Xen

Quoted 6 lines · Daniel Kiper
Quoted 2 lines · Daniel Kiper

arch = (kexec_flags & KEXEC_ARCH_MASK) >> 16;

What is wrong with this line?
Why did not you applied it?

I haven't reposted the kexec-tools patches so it's not clear what you are expecting this to be applied to.

David

#15 lore raw

Re: [PATCH 5/5] kexec/xen: directly load images images into Xen

In reply to Daniel Kiper
Quoted 6 lines · Daniel Kiper
Quoted 2 lines · Daniel Kiper

arch = (kexec_flags & KEXEC_ARCH_MASK) >> 16;

What is wrong with this line?
Why did not you applied it?

I haven't reposted the kexec-tools patches so it's not clear what you are expecting this to be applied to.

David

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

#16 lore raw

Re: [PATCH 5/5] kexec/xen: directly load images images into Xen

Quoted 10 lines · David Vrabel
Quoted 6 lines · Daniel Kiper
Quoted 2 lines · Daniel Kiper

arch = (kexec_flags & KEXEC_ARCH_MASK) >> 16;

What is wrong with this line?
Why did not you applied it?

I haven't reposted the kexec-tools patches so it's not clear what you are expecting this to be applied to.

arch = (kexec_flags >> 16) & 0xffff;

should be changed to:

arch = (kexec_flags & KEXEC_ARCH_MASK) >> 16;

or add comment what are you doing but I think
that former is better.

Additionally I found in kexec-tools git tree something like that:

kexec/crashdump-xen.c:

...
#ifdef HAVE_LIBXENCTRL
int get_xen_vmcoreinfo(uint64_t *addr, uint64_t *len) {
...
}

and in

kexec/crashdump.c:

...

#ifndef HAVE_LIBXENCTRL
int get_xen_vmcoreinfo(uint64_t *addr, uint64_t *len)
{
return get_vmcoreinfo("/sys/hypervisor/vmcoreinfo", addr, len);
}
#endif

Move get_xen_vmcoreinfo() from kexec/crashdump.c to kexec/crashdump-xen.c and make it return -1 ifndef HAVE_LIBXENCTRL. /sys/hypervisor/vmcoreinfo is valid for legacy kexec implementation only.

Please repost next time Xen and kexec-tools patches.

Daniel

#17 lore raw

Re: [PATCH 5/5] kexec/xen: directly load images images into Xen

In reply to David Vrabel
Quoted 10 lines · David Vrabel
Quoted 6 lines · Daniel Kiper
Quoted 2 lines · Daniel Kiper

arch = (kexec_flags & KEXEC_ARCH_MASK) >> 16;

What is wrong with this line?
Why did not you applied it?

I haven't reposted the kexec-tools patches so it's not clear what you are expecting this to be applied to.

arch = (kexec_flags >> 16) & 0xffff;

should be changed to:

arch = (kexec_flags & KEXEC_ARCH_MASK) >> 16;

or add comment what are you doing but I think
that former is better.

Additionally I found in kexec-tools git tree something like that:

kexec/crashdump-xen.c:

...
#ifdef HAVE_LIBXENCTRL
int get_xen_vmcoreinfo(uint64_t *addr, uint64_t *len) {
...
}

and in

kexec/crashdump.c:

...

#ifndef HAVE_LIBXENCTRL
int get_xen_vmcoreinfo(uint64_t *addr, uint64_t *len)
{
return get_vmcoreinfo("/sys/hypervisor/vmcoreinfo", addr, len);
}
#endif

Move get_xen_vmcoreinfo() from kexec/crashdump.c to kexec/crashdump-xen.c and make it return -1 ifndef HAVE_LIBXENCTRL. /sys/hypervisor/vmcoreinfo is valid for legacy kexec implementation only.

Please repost next time Xen and kexec-tools patches.

Daniel

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

#18 lore raw
In reply to David Vrabel

Hi David,

Quoted 5 lines · David Vrabel

The series adds support for the new hypercall ABI which should be provided by Xen 4.3. Images are loaded into Xen directly with no kernel involvement.

Do not apply until the hypervisor side patches are applied to Xen.

Please let me know when you are ready for these to be applied by reposting them.

Quoted 28 lines

Patch 1 is unrelated but kexec wouldn't work for me without it. Not sure why I had problems, perhaps a toolstack specific issue?

Patch 2 makes libxc 4.3 mandatory for Xen support.

Patch 3-4 removes a use of /proc/iomem in favour of libxc.

Patch 5 adds the support for loading, unloading, and exec'ing an image in Xen.

This series explicitly drops support for older version of libxc/Xen as supporting kexec on these hypervisors requires kernel support that will never be available upstream.

Changes since v1:
- Patch from Don Sultz: use libxc for vmcoreinfo.
- Use xc_get_max_cpus() to get number of PCPUs.
- Enable unload and exec of images.

David

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

#19 lore raw
In reply to David Vrabel

Hi David,

Quoted 5 lines · David Vrabel

The series adds support for the new hypercall ABI which should be provided by Xen 4.3. Images are loaded into Xen directly with no kernel involvement.

Do not apply until the hypervisor side patches are applied to Xen.

Please let me know when you are ready for these to be applied by reposting them.

Quoted 19 lines

Patch 1 is unrelated but kexec wouldn't work for me without it. Not sure why I had problems, perhaps a toolstack specific issue?

Patch 2 makes libxc 4.3 mandatory for Xen support.

Patch 3-4 removes a use of /proc/iomem in favour of libxc.

Patch 5 adds the support for loading, unloading, and exec'ing an image in Xen.

This series explicitly drops support for older version of libxc/Xen as supporting kexec on these hypervisors requires kernel support that will never be available upstream.

Changes since v1:
- Patch from Don Sultz: use libxc for vmcoreinfo.
- Use xc_get_max_cpus() to get number of PCPUs.
- Enable unload and exec of images.

Quoted 9 lines

David

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

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

#20 lore raw
In reply to David Vrabel
Quoted 16 lines · David Vrabel

The series adds support for the new hypercall ABI which should be provided by Xen 4.3. Images are loaded into Xen directly with no kernel involvement.

Do not apply until the hypervisor side patches are applied to Xen.

Patch 1 is unrelated but kexec wouldn't work for me without it. Not sure why I had problems, perhaps a toolstack specific issue?

Patch 2 makes libxc 4.3 mandatory for Xen support.

Patch 3-4 removes a use of /proc/iomem in favour of libxc.

Patch 5 adds the support for loading, unloading, and exec'ing an image in Xen.

Quoted 8 lines

This series explicitly drops support for older version of libxc/Xen as supporting kexec on these hypervisors requires kernel support that will never be available upstream.

Changes since v1:
- Patch from Don Sultz: use libxc for vmcoreinfo.
- Use xc_get_max_cpus() to get number of PCPUs.
- Enable unload and exec of images.

I could not test new kexec implementation because this patch series does not cleanly apply to latest kexec-tools tree. Please fix that and repost.

Xen patches applies to latest Xen unstable tree with some warnings. I think it is worth update those patches too.

Daniel

#21 lore raw
In reply to David Vrabel
Quoted 16 lines · David Vrabel

The series adds support for the new hypercall ABI which should be provided by Xen 4.3. Images are loaded into Xen directly with no kernel involvement.

Do not apply until the hypervisor side patches are applied to Xen.

Patch 1 is unrelated but kexec wouldn't work for me without it. Not sure why I had problems, perhaps a toolstack specific issue?

Patch 2 makes libxc 4.3 mandatory for Xen support.

Patch 3-4 removes a use of /proc/iomem in favour of libxc.

Patch 5 adds the support for loading, unloading, and exec'ing an image in Xen.

Quoted 8 lines

This series explicitly drops support for older version of libxc/Xen as supporting kexec on these hypervisors requires kernel support that will never be available upstream.

Changes since v1:
- Patch from Don Sultz: use libxc for vmcoreinfo.
- Use xc_get_max_cpus() to get number of PCPUs.
- Enable unload and exec of images.

I could not test new kexec implementation because this patch series does not cleanly apply to latest kexec-tools tree. Please fix that and repost.

Xen patches applies to latest Xen unstable tree with some warnings. I think it is worth update those patches too.

Daniel

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