ia64/xen-unstable

annotate tools/libxc/xenguest.h @ 19639:205b1badbcfd

Add support for superpages (hugepages) in PV domain

This patch adds the option "superpages" to the domain configuration
file. If it is set, the domain is populated using 2M pages.

This code does not support fallback to small pages. If the domain can
not be created with 2M pages, the create will fail.

The patch also includes support for saving and restoring domains with
the superpage flag set. However, if a domain has freed small pages
within its physical page array and then extended the array, the
restore will fill in those freed pages. It will then attempt to
allocate more than its memory limit and will fail. This is
significant because apparently Linux does this during boot, thus a
freshly booted Linux image can not be saved and restored successfully.

Signed-off-by: Dave McCracken <dcm@mccr.org>
author Keir Fraser <keir.fraser@citrix.com>
date Tue May 26 09:58:38 2009 +0100 (2009-05-26)
parents a5f497f02e34
children 84c1f7c46444
rev   line source
cl349@6404 1 /******************************************************************************
cl349@6404 2 * xenguest.h
kaf24@9730 3 *
cl349@6404 4 * A library for guest domain management in Xen.
kaf24@9730 5 *
cl349@6404 6 * Copyright (c) 2003-2004, K A Fraser.
cl349@6404 7 */
cl349@6404 8
shand@6615 9 #ifndef XENGUEST_H
shand@6615 10 #define XENGUEST_H
cl349@6404 11
shand@6615 12 #define XCFLAGS_LIVE 1
shand@6615 13 #define XCFLAGS_DEBUG 2
Tim@13491 14 #define XCFLAGS_HVM 4
Tim@14314 15 #define XCFLAGS_STDVGA 8
shand@6615 16
cl349@6404 17
cl349@6404 18 /**
Tim@14805 19 * This function will save a running domain.
cl349@6404 20 *
cl349@6404 21 * @parm xc_handle a handle to an open hypervisor interface
cl349@6404 22 * @parm fd the file descriptor to save a domain to
cl349@6404 23 * @parm dom the id of the domain
cl349@6404 24 * @return 0 on success, -1 on failure
cl349@6404 25 */
Tim@14805 26 int xc_domain_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
Tim@14805 27 uint32_t max_factor, uint32_t flags /* XCFLAGS_xxx */,
keir@18446 28 int (*suspend)(void), int hvm,
Tim@14805 29 void *(*init_qemu_maps)(int, unsigned), /* HVM only */
Tim@14805 30 void (*qemu_flip_buffer)(int, int)); /* HVM only */
emellor@8535 31
cl349@6404 32
cl349@6404 33 /**
Tim@14749 34 * This function will restore a saved domain.
cl349@6404 35 *
cl349@6404 36 * @parm xc_handle a handle to an open hypervisor interface
cl349@6404 37 * @parm fd the file descriptor to restore a domain from
cl349@6404 38 * @parm dom the id of the domain
cl349@6404 39 * @parm store_evtchn the store event channel for this domain to use
cl349@6404 40 * @parm store_mfn returned with the mfn of the store page
Tim@14749 41 * @parm hvm non-zero if this is a HVM restore
Tim@14749 42 * @parm pae non-zero if this HVM domain has PAE support enabled
keir@19639 43 * @parm superpages non-zero to allocate guest memory with superpages
cl349@6404 44 * @return 0 on success, -1 on failure
cl349@6404 45 */
Tim@14749 46 int xc_domain_restore(int xc_handle, int io_fd, uint32_t dom,
Tim@14749 47 unsigned int store_evtchn, unsigned long *store_mfn,
Tim@14749 48 unsigned int console_evtchn, unsigned long *console_mfn,
keir@19639 49 unsigned int hvm, unsigned int pae, int superpages);
Tim@13491 50
Tim@13491 51 /**
kaf24@9204 52 * This function will create a domain for a paravirtualized Linux
kaf24@9204 53 * using file names pointing to kernel and ramdisk
kaf24@9204 54 *
kaf24@9204 55 * @parm xc_handle a handle to an open hypervisor interface
kaf24@9204 56 * @parm domid the id of the domain
kfraser@12218 57 * @parm mem_mb memory size in megabytes
kfraser@12218 58 * @parm image_name name of the kernel image file
kfraser@12218 59 * @parm ramdisk_name name of the ramdisk image file
kaf24@9204 60 * @parm cmdline command line string
kaf24@9204 61 * @parm flags domain creation flags
kaf24@9204 62 * @parm store_evtchn the store event channel for this domain to use
kaf24@9204 63 * @parm store_mfn returned with the mfn of the store page
kaf24@9204 64 * @parm console_evtchn the console event channel for this domain to use
kaf24@9204 65 * @parm conole_mfn returned with the mfn of the console page
keir@19639 66 * @parm superpages populate memory in guest with superpages
kaf24@9204 67 * @return 0 on success, -1 on failure
kaf24@9204 68 */
cl349@6404 69 int xc_linux_build(int xc_handle,
cl349@6404 70 uint32_t domid,
kfraser@12218 71 unsigned int mem_mb,
cl349@6404 72 const char *image_name,
cl349@6404 73 const char *ramdisk_name,
cl349@6404 74 const char *cmdline,
Ian@9054 75 const char *features,
cl349@6404 76 unsigned long flags,
cl349@6404 77 unsigned int store_evtchn,
cl349@6492 78 unsigned long *store_mfn,
cl349@6492 79 unsigned int console_evtchn,
keir@19639 80 unsigned long *console_mfn,
keir@19639 81 int superpages);
cl349@6404 82
kfraser@14130 83 /** The same interface, but the dom structure is managed by the caller */
kfraser@14130 84 struct xc_dom_image;
kfraser@14130 85 int xc_dom_linux_build(int xc_handle,
kfraser@14130 86 struct xc_dom_image *dom,
kfraser@14130 87 uint32_t domid,
kfraser@14130 88 unsigned int mem_mb,
kfraser@14130 89 const char *image_name,
kfraser@14130 90 const char *ramdisk_name,
kfraser@14130 91 unsigned long flags,
kfraser@14130 92 unsigned int store_evtchn,
kfraser@14130 93 unsigned long *store_mfn,
kfraser@14130 94 unsigned int console_evtchn,
keir@19639 95 unsigned long *console_mfn,
keir@19639 96 int superpages);
kfraser@14130 97
kaf24@9204 98 /**
kaf24@9204 99 * This function will create a domain for a paravirtualized Linux
kaf24@9204 100 * using buffers for kernel and initrd
kaf24@9204 101 *
kfraser@12218 102 * @parm xc_handle a handle to an open hypervisor interface
kfraser@12218 103 * @parm domid the id of the domain
kfraser@12218 104 * @parm mem_mb memory size in megabytes
kfraser@12218 105 * @parm image_buffer buffer containing kernel image
kfraser@12218 106 * @parm image_size size of the kernel image buffer
kfraser@12218 107 * @parm initrd_buffer name of the ramdisk image file
kfraser@12218 108 * @parm initrd_size size of the ramdisk buffer
kfraser@12218 109 * @parm cmdline command line string
kfraser@12218 110 * @parm flags domain creation flags
kfraser@12218 111 * @parm store_evtchn the store event channel for this domain to use
kfraser@12218 112 * @parm store_mfn returned with the mfn of the store page
kfraser@12218 113 * @parm console_evtchn the console event channel for this domain to use
kfraser@12218 114 * @parm conole_mfn returned with the mfn of the console page
keir@19639 115 * @parm superpages populate memory in guest with superpages
kaf24@9204 116 * @return 0 on success, -1 on failure
kaf24@9204 117 */
kaf24@9204 118 int xc_linux_build_mem(int xc_handle,
kaf24@9204 119 uint32_t domid,
kfraser@12218 120 unsigned int mem_mb,
kaf24@9205 121 const char *image_buffer,
kaf24@9204 122 unsigned long image_size,
kaf24@9205 123 const char *initrd_buffer,
kaf24@9204 124 unsigned long initrd_size,
kaf24@9204 125 const char *cmdline,
kaf24@9204 126 const char *features,
kaf24@9204 127 unsigned long flags,
kaf24@9204 128 unsigned int store_evtchn,
kaf24@9204 129 unsigned long *store_mfn,
kaf24@9204 130 unsigned int console_evtchn,
keir@19639 131 unsigned long *console_mfn,
keir@19639 132 int superpages);
kaf24@9204 133
kaf24@8708 134 int xc_hvm_build(int xc_handle,
cl349@6404 135 uint32_t domid,
cl349@6404 136 int memsize,
kfraser@12600 137 const char *image_name);
cl349@6404 138
keir@18976 139 int xc_hvm_build_target_mem(int xc_handle,
keir@18976 140 uint32_t domid,
keir@18976 141 int memsize,
keir@18976 142 int target,
keir@18976 143 const char *image_name);
keir@18976 144
kaf24@9204 145 int xc_hvm_build_mem(int xc_handle,
kaf24@9204 146 uint32_t domid,
kaf24@9204 147 int memsize,
kaf24@9205 148 const char *image_buffer,
kfraser@12600 149 unsigned long image_size);
kfraser@12600 150
keir@19387 151 int xc_suspend_evtchn_release(int xce, int suspend_evtchn);
keir@19387 152
keir@19387 153 int xc_suspend_evtchn_init(int xc, int xce, int domid, int port);
keir@19387 154
keir@19387 155 int xc_await_suspend(int xce, int suspend_evtchn);
keir@19387 156
kaf24@9204 157 #endif /* XENGUEST_H */