ia64/xen-unstable

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