From: Don Slutz <dslutz@verizon.com>
To: David Vrabel <david.vrabel@citrix.com>, xen-devel@lists.xen.org
Cc: Daniel Kiper <daniel.kiper@oracle.com>,
Simon Horman <horms@verge.net.au>,
kexec@lists.infradead.org
Subject: Re: [Xen-devel] [PATCH 1/4] kexec/xen: require libxc from Xen 4.4
Date: Thu, 7 Nov 2013 15:35:40 -0500 [thread overview]
Message-ID: <527BF99C.1060905@terremark.com> (raw)
In-Reply-To: <1383749722-12091-2-git-send-email-david.vrabel@citrix.com>
For what it is worth.
Reviewed-by: Don Slutz <dslutz@verizon.com>
-Don Slutz
On 11/06/13 09:55, David Vrabel wrote:
> From: David Vrabel <david.vrabel@citrix.com>
>
> libxc from Xen 4.4 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.
>
> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
> ---
> configure.ac | 5 +-
> kexec/arch/i386/crashdump-x86.c | 110 ------------------------------------
> kexec/arch/i386/kexec-x86-common.c | 103 ---------------------------------
> kexec/crashdump-xen.c | 12 ----
> 4 files changed, 1 insertions(+), 229 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 7b61dbf..50b706a 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -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
> diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
> index e44fceb..7aa5a12 100644
> --- a/kexec/arch/i386/crashdump-x86.c
> +++ b/kexec/arch/i386/crashdump-x86.c
> @@ -43,14 +43,7 @@
> #include "crashdump-x86.h"
>
> #ifdef HAVE_LIBXENCTRL
> -#ifdef HAVE_XC_GET_MACHINE_MEMORY_MAP
> #include <xenctrl.h>
> -#else
> -#define __XEN_TOOLS__ 1
> -#include <xen/xen.h>
> -#include <xen/memory.h>
> -#include <xen/sys/privcmd.h>
> -#endif /* HAVE_XC_GET_MACHINE_MEMORY_MAP */
> #endif /* HAVE_LIBXENCTRL */
>
> #include <x86/x86-linux.h>
> @@ -300,34 +293,20 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges,
> }
>
> #ifdef HAVE_LIBXENCTRL
> -#ifdef HAVE_XC_GET_MACHINE_MEMORY_MAP
> static int get_crash_memory_ranges_xen(struct memory_range **range,
> int *ranges, unsigned long lowmem_limit)
> {
> int j, rc, ret = -1;
> struct e820entry e820entries[CRASH_MAX_MEMORY_RANGES];
> unsigned int i;
> -#ifdef XENCTRL_HAS_XC_INTERFACE
> xc_interface *xc;
> -#else
> - int xc;
> -#endif
>
> -#ifdef XENCTRL_HAS_XC_INTERFACE
> xc = xc_interface_open(NULL, NULL, 0);
>
> if (!xc) {
> fprintf(stderr, "%s: Failed to open Xen control interface\n", __func__);
> goto err;
> }
> -#else
> - xc = xc_interface_open();
> -
> - if (xc == -1) {
> - fprintf(stderr, "%s: Failed to open Xen control interface\n", __func__);
> - goto err;
> - }
> -#endif
>
> rc = xc_get_machine_memory_map(xc, e820entries, CRASH_MAX_MEMORY_RANGES);
>
> @@ -364,95 +343,6 @@ err:
> static int get_crash_memory_ranges_xen(struct memory_range **range,
> int *ranges, unsigned long lowmem_limit)
> {
> - int fd, j, rc, ret = -1;
> - privcmd_hypercall_t hypercall;
> - struct e820entry *e820entries = NULL;
> - struct xen_memory_map *xen_memory_map = NULL;
> - unsigned int i;
> -
> - fd = open("/proc/xen/privcmd", O_RDWR);
> -
> - if (fd == -1) {
> - fprintf(stderr, "%s: open(/proc/xen/privcmd): %m\n", __func__);
> - goto err;
> - }
> -
> - rc = posix_memalign((void **)&e820entries, getpagesize(),
> - sizeof(struct e820entry) * CRASH_MAX_MEMORY_RANGES);
> -
> - if (rc) {
> - fprintf(stderr, "%s: posix_memalign(e820entries): %s\n", __func__, strerror(rc));
> - e820entries = NULL;
> - goto err;
> - }
> -
> - rc = posix_memalign((void **)&xen_memory_map, getpagesize(),
> - sizeof(struct xen_memory_map));
> -
> - if (rc) {
> - fprintf(stderr, "%s: posix_memalign(xen_memory_map): %s\n", __func__, strerror(rc));
> - xen_memory_map = NULL;
> - goto err;
> - }
> -
> - if (mlock(e820entries, sizeof(struct e820entry) * CRASH_MAX_MEMORY_RANGES) == -1) {
> - fprintf(stderr, "%s: mlock(e820entries): %m\n", __func__);
> - goto err;
> - }
> -
> - if (mlock(xen_memory_map, sizeof(struct xen_memory_map)) == -1) {
> - fprintf(stderr, "%s: mlock(xen_memory_map): %m\n", __func__);
> - goto err;
> - }
> -
> - xen_memory_map->nr_entries = CRASH_MAX_MEMORY_RANGES;
> - set_xen_guest_handle(xen_memory_map->buffer, e820entries);
> -
> - hypercall.op = __HYPERVISOR_memory_op;
> - hypercall.arg[0] = XENMEM_machine_memory_map;
> - hypercall.arg[1] = (__u64)xen_memory_map;
> -
> - rc = ioctl(fd, IOCTL_PRIVCMD_HYPERCALL, &hypercall);
> -
> - if (rc == -1) {
> - fprintf(stderr, "%s: ioctl(IOCTL_PRIVCMD_HYPERCALL): %m\n", __func__);
> - goto err;
> - }
> -
> - for (i = 0, j = 0; i < xen_memory_map->nr_entries &&
> - j < CRASH_MAX_MEMORY_RANGES; ++i, ++j) {
> - crash_memory_range[j].start = e820entries[i].addr;
> - crash_memory_range[j].end = e820entries[i].addr + e820entries[i].size - 1;
> - crash_memory_range[j].type = xen_e820_to_kexec_type(e820entries[i].type);
> - segregate_lowmem_region(&j, lowmem_limit);
> - }
> -
> - *range = crash_memory_range;
> - *ranges = j;
> -
> - qsort(*range, *ranges, sizeof(struct memory_range), compare_ranges);
> -
> - for (i = 0; i < crash_reserved_mem_nr; i++)
> - if (exclude_region(ranges, crash_reserved_mem[i].start,
> - crash_reserved_mem[i].end) < 0)
> - goto err;
> -
> - ret = 0;
> -
> -err:
> - munlock(xen_memory_map, sizeof(struct xen_memory_map));
> - munlock(e820entries, sizeof(struct e820entry) * CRASH_MAX_MEMORY_RANGES);
> - free(xen_memory_map);
> - free(e820entries);
> - close(fd);
> -
> - return ret;
> -}
> -#endif /* HAVE_XC_GET_MACHINE_MEMORY_MAP */
> -#else
> -static int get_crash_memory_ranges_xen(struct memory_range **range,
> - int *ranges, unsigned long lowmem_limit)
> -{
> return 0;
> }
> #endif /* HAVE_LIBXENCTRL */
> diff --git a/kexec/arch/i386/kexec-x86-common.c b/kexec/arch/i386/kexec-x86-common.c
> index ed6c950..bf58f53 100644
> --- a/kexec/arch/i386/kexec-x86-common.c
> +++ b/kexec/arch/i386/kexec-x86-common.c
> @@ -40,15 +40,7 @@
> #include "kexec-x86.h"
>
> #ifdef HAVE_LIBXENCTRL
> -#ifdef HAVE_XC_GET_MACHINE_MEMORY_MAP
> #include <xenctrl.h>
> -#else
> -#define __XEN_TOOLS__ 1
> -#include <x86/x86-linux.h>
> -#include <xen/xen.h>
> -#include <xen/memory.h>
> -#include <xen/sys/privcmd.h>
> -#endif /* HAVE_XC_GET_MACHINE_MEMORY_MAP */
> #endif /* HAVE_LIBXENCTRL */
>
> static struct memory_range memory_range[MAX_MEMORY_RANGES];
> @@ -173,33 +165,19 @@ unsigned xen_e820_to_kexec_type(uint32_t type)
> *
> * @return 0 on success, any other value on failure.
> */
> -#ifdef HAVE_XC_GET_MACHINE_MEMORY_MAP
> static int get_memory_ranges_xen(struct memory_range **range, int *ranges)
> {
> int rc, ret = -1;
> struct e820entry e820entries[MAX_MEMORY_RANGES];
> unsigned int i;
> -#ifdef XENCTRL_HAS_XC_INTERFACE
> xc_interface *xc;
> -#else
> - int xc;
> -#endif
>
> -#ifdef XENCTRL_HAS_XC_INTERFACE
> xc = xc_interface_open(NULL, NULL, 0);
>
> if (!xc) {
> fprintf(stderr, "%s: Failed to open Xen control interface\n", __func__);
> goto err;
> }
> -#else
> - xc = xc_interface_open();
> -
> - if (xc == -1) {
> - fprintf(stderr, "%s: Failed to open Xen control interface\n", __func__);
> - goto err;
> - }
> -#endif
>
> rc = xc_get_machine_memory_map(xc, e820entries, MAX_MEMORY_RANGES);
>
> @@ -229,87 +207,6 @@ err:
> #else
> static int get_memory_ranges_xen(struct memory_range **range, int *ranges)
> {
> - int fd, rc, ret = -1;
> - privcmd_hypercall_t hypercall;
> - struct e820entry *e820entries = NULL;
> - struct xen_memory_map *xen_memory_map = NULL;
> - unsigned int i;
> -
> - fd = open("/proc/xen/privcmd", O_RDWR);
> -
> - if (fd == -1) {
> - fprintf(stderr, "%s: open(/proc/xen/privcmd): %m\n", __func__);
> - goto err;
> - }
> -
> - rc = posix_memalign((void **)&e820entries, sysconf(_SC_PAGESIZE),
> - sizeof(struct e820entry) * MAX_MEMORY_RANGES);
> -
> - if (rc) {
> - fprintf(stderr, "%s: posix_memalign(e820entries): %s\n", __func__, strerror(rc));
> - e820entries = NULL;
> - goto err;
> - }
> -
> - rc = posix_memalign((void **)&xen_memory_map, sysconf(_SC_PAGESIZE),
> - sizeof(struct xen_memory_map));
> -
> - if (rc) {
> - fprintf(stderr, "%s: posix_memalign(xen_memory_map): %s\n", __func__, strerror(rc));
> - xen_memory_map = NULL;
> - goto err;
> - }
> -
> - if (mlock(e820entries, sizeof(struct e820entry) * MAX_MEMORY_RANGES) == -1) {
> - fprintf(stderr, "%s: mlock(e820entries): %m\n", __func__);
> - goto err;
> - }
> -
> - if (mlock(xen_memory_map, sizeof(struct xen_memory_map)) == -1) {
> - fprintf(stderr, "%s: mlock(xen_memory_map): %m\n", __func__);
> - goto err;
> - }
> -
> - xen_memory_map->nr_entries = MAX_MEMORY_RANGES;
> - set_xen_guest_handle(xen_memory_map->buffer, e820entries);
> -
> - hypercall.op = __HYPERVISOR_memory_op;
> - hypercall.arg[0] = XENMEM_machine_memory_map;
> - hypercall.arg[1] = (__u64)xen_memory_map;
> -
> - rc = ioctl(fd, IOCTL_PRIVCMD_HYPERCALL, &hypercall);
> -
> - if (rc == -1) {
> - fprintf(stderr, "%s: ioctl(IOCTL_PRIVCMD_HYPERCALL): %m\n", __func__);
> - goto err;
> - }
> -
> - for (i = 0; i < xen_memory_map->nr_entries; ++i) {
> - memory_range[i].start = e820entries[i].addr;
> - memory_range[i].end = e820entries[i].addr + e820entries[i].size;
> - memory_range[i].type = xen_e820_to_kexec_type(e820entries[i].type);
> - }
> -
> - qsort(memory_range, xen_memory_map->nr_entries, sizeof(struct memory_range), compare_ranges);
> -
> - *range = memory_range;
> - *ranges = xen_memory_map->nr_entries;
> -
> - ret = 0;
> -
> -err:
> - munlock(xen_memory_map, sizeof(struct xen_memory_map));
> - munlock(e820entries, sizeof(struct e820entry) * MAX_MEMORY_RANGES);
> - free(xen_memory_map);
> - free(e820entries);
> - close(fd);
> -
> - return ret;
> -}
> -#endif /* HAVE_XC_GET_MACHINE_MEMORY_MAP */
> -#else
> -static int get_memory_ranges_xen(struct memory_range **range, int *ranges)
> -{
> return 0;
> }
> #endif /* HAVE_LIBXENCTRL */
> diff --git a/kexec/crashdump-xen.c b/kexec/crashdump-xen.c
> index d8bd0f4..ff4706c 100644
> --- a/kexec/crashdump-xen.c
> +++ b/kexec/crashdump-xen.c
> @@ -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 ) {
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2013-11-07 20:39 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-06 14:55 [PATCHv7 0/4] kexec-tools: add support for Xen 4.4 David Vrabel
2013-11-06 14:55 ` David Vrabel
2013-11-06 14:55 ` [PATCH 1/4] kexec/xen: require libxc from " David Vrabel
2013-11-06 14:55 ` David Vrabel
2013-11-07 20:35 ` Don Slutz [this message]
2013-11-07 20:35 ` Don Slutz
2013-11-13 3:12 ` Simon Horman
2013-11-06 14:55 ` [PATCH 2/4] kexec/xen: use libxc to get location of crash notes David Vrabel
2013-11-06 14:55 ` David Vrabel
2013-11-07 20:36 ` [Xen-devel] " Don Slutz
2013-11-07 20:36 ` Don Slutz
2013-11-06 14:55 ` [PATCH 3/4] kexec/xen: switch to use xc_kexec_get_range for get_xen_vmcoreinfo David Vrabel
2013-11-06 14:55 ` David Vrabel
2013-11-06 14:55 ` [PATCH 4/4] kexec/xen: directly load images images into Xen David Vrabel
2013-11-06 14:55 ` David Vrabel
2013-11-07 20:36 ` Don Slutz
2013-11-07 20:36 ` [Xen-devel] " Don Slutz
2013-11-19 1:20 ` Simon Horman
2013-11-19 1:20 ` Simon Horman
2013-11-19 8:28 ` Daniel Kiper
2013-11-19 9:19 ` Simon Horman
2013-11-19 9:19 ` Simon Horman
2013-11-19 8:28 ` Daniel Kiper
2013-11-09 19:21 ` [PATCHv7 0/4] kexec-tools: add support for Xen 4.4 Daniel Kiper
2013-11-09 19:21 ` Daniel Kiper
2013-11-11 14:35 ` Don Slutz
2013-11-11 14:35 ` Don Slutz
2013-11-13 10:27 ` David Vrabel
2013-11-19 1:15 ` Simon Horman
2013-11-19 1:15 ` Simon Horman
2013-11-13 10:27 ` David Vrabel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=527BF99C.1060905@terremark.com \
--to=dslutz@verizon.com \
--cc=daniel.kiper@oracle.com \
--cc=david.vrabel@citrix.com \
--cc=horms@verge.net.au \
--cc=kexec@lists.infradead.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.