ia64/xen-unstable

view Makefile @ 19691:f44438bc79ac

libxc: Exchange a page for PV guest

This patch support exchange a page for a suspended PV guest from user
space.

The basic idea to offline a page is:
1) mark a page offline pending
2) If the page is owned by a HVM domain, user have to live migrate it.
In future, with stub-domain support, we can also exchange the page
without migration.
3) If the page is owned by a PV domain, we will try to exchange the
offline pending page to a new one and free the old page.

This patch achieves item 3.

The method to exchange the offline pending page for PV domain is:

1) Suspend the guest.
2) If the page is being granted out, return with offline pending.
3) Get a copy for the content
4) Scan all page table page to see if any reference to the offending
page, if yes, make the entry to be non-present to reduce the reference
count.
5) After update all page tables, user space tools will try to exchange
the old page. If the new mfn has no reference anymore (i.e.
count_info & count_mask =3D 1), the exchange will allocate a new page,
update the m2p and return success, otherwise it will return fail.
6) If step 5 is success, user space tools will update the content of
the new page change the p2m table, and change all entries scaned in
step 4 to point to new entry.
if step failed, it will try to undo step 4 to revert page table.
7) Resume the guest.

Please refer to thread in
http://www.mailinglistarchive.com/xen-devel@lists.xensource.com/msg63084.html
for more information.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Jun 01 14:15:48 2009 +0100 (2009-06-01)
parents 9749e8f6e3d8
children
line source
1 #
2 # Grand Unified Makefile for Xen.
3 #
5 # Default target must appear before any include lines
6 .PHONY: all
7 all: dist
9 export XEN_ROOT=$(CURDIR)
10 include Config.mk
12 SUBARCH := $(subst x86_32,i386,$(XEN_TARGET_ARCH))
13 export XEN_TARGET_ARCH SUBARCH XEN_SYSTYPE
14 include buildconfigs/Rules.mk
16 # build and install everything into the standard system directories
17 .PHONY: install
18 install: install-xen install-kernels install-tools install-stubdom install-docs
20 .PHONY: build
21 build: kernels
22 $(MAKE) -C xen build
23 $(MAKE) -C tools build
24 $(MAKE) -C stubdom build
25 ifeq (x86_64,$(XEN_TARGET_ARCH))
26 XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom pv-grub
27 endif
28 $(MAKE) -C docs build
30 # The test target is for unit tests that can run without an installation. Of
31 # course, many tests require a machine running Xen itself, and these are
32 # handled elsewhere.
33 .PHONY: test
34 test:
35 $(MAKE) -C tools/python test
37 # build and install everything into local dist directory
38 .PHONY: dist
39 dist: DESTDIR=$(DISTDIR)/install
40 dist: dist-xen dist-kernels dist-tools dist-stubdom dist-docs
41 $(INSTALL_DIR) $(DISTDIR)/check
42 $(INSTALL_DATA) ./COPYING $(DISTDIR)
43 $(INSTALL_DATA) ./README $(DISTDIR)
44 $(INSTALL_PROG) ./install.sh $(DISTDIR)
45 $(INSTALL_PROG) tools/check/chk tools/check/check_* tools/check/funcs.sh $(DISTDIR)/check
46 dist-%: DESTDIR=$(DISTDIR)/install
47 dist-%: install-%
48 @: # do nothing
50 # Legacy dist targets
51 .PHONY: xen tools stubdom kernels docs
52 xen: dist-xen
53 tools: dist-tools
54 kernels: dist-kernels
55 stubdom: dist-stubdom
56 docs: dist-docs
58 .PHONY: prep-kernels
59 prep-kernels:
60 for i in $(XKERNELS) ; do $(MAKE) $$i-prep || exit 1; done
62 .PHONY: install-xen
63 install-xen:
64 $(MAKE) -C xen install
66 .PHONY: install-tools
67 install-tools: tools/ioemu-dir
68 $(MAKE) -C tools install
70 .PHONY: install-kernels
71 install-kernels:
72 for i in $(XKERNELS) ; do $(MAKE) $$i-install || exit 1; done
74 .PHONY: install-stubdom
75 install-stubdom: tools/ioemu-dir
76 $(MAKE) -C stubdom install
77 ifeq (x86_64,$(XEN_TARGET_ARCH))
78 XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom install-grub
79 endif
81 tools/ioemu-dir:
82 $(MAKE) -C tools ioemu-dir-find
84 .PHONY: install-docs
85 install-docs:
86 sh ./docs/check_pkgs && $(MAKE) -C docs install || true
88 .PHONY: dev-docs
89 dev-docs:
90 $(MAKE) -C docs dev-docs
92 # Build all the various kernels and modules
93 .PHONY: kbuild
94 kbuild: kernels
96 # Delete the kernel build trees entirely
97 .PHONY: kdelete
98 kdelete:
99 for i in $(XKERNELS) ; do $(MAKE) $$i-delete ; done
101 # Clean the kernel build trees
102 .PHONY: kclean
103 kclean:
104 for i in $(XKERNELS) ; do $(MAKE) $$i-clean ; done
106 # build xen, the tools, and a domain 0 plus unprivileged linux-xen images,
107 # and place them in the install directory. 'make install' should then
108 # copy them to the normal system directories
109 .PHONY: world
110 world:
111 $(MAKE) clean
112 $(MAKE) kdelete
113 $(MAKE) dist
115 # clean doesn't do a kclean
116 .PHONY: clean
117 clean::
118 $(MAKE) -C xen clean
119 $(MAKE) -C tools clean
120 $(MAKE) -C stubdom crossclean
121 ifeq (x86_64,$(XEN_TARGET_ARCH))
122 XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom crossclean
123 endif
124 $(MAKE) -C docs clean
126 # clean, but blow away kernel build tree plus tarballs
127 .PHONY: distclean
128 distclean:
129 $(MAKE) -C xen distclean
130 $(MAKE) -C tools distclean
131 $(MAKE) -C stubdom distclean
132 ifeq (x86_64,$(XEN_TARGET_ARCH))
133 XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom distclean
134 endif
135 $(MAKE) -C docs distclean
136 rm -rf dist patches/tmp
137 for i in $(ALLKERNELS) ; do $(MAKE) $$i-delete ; done
138 rm -rf patches/*/.makedep
140 # Linux name for GNU distclean
141 .PHONY: mrproper
142 mrproper: distclean
144 # Prepare for source tarball
145 .PHONY: src-tarball
146 src-tarball: distclean
147 $(MAKE) -C xen .banner
148 rm -rf xen/tools/figlet .[a-z]*
149 $(MAKE) -C xen distclean
151 .PHONY: help
152 help:
153 @echo 'Installation targets:'
154 @echo ' install - build and install everything'
155 @echo ' install-xen - build and install the Xen hypervisor'
156 @echo ' install-tools - build and install the control tools'
157 @echo ' install-kernels - build and install guest kernels'
158 @echo ' install-stubdom - build and install the stubdomain images'
159 @echo ' install-docs - build and install user documentation'
160 @echo ''
161 @echo 'Building targets:'
162 @echo ' dist - build and install everything into local dist directory'
163 @echo ' world - clean everything, delete guest kernel build'
164 @echo ' trees then make dist'
165 @echo ' xen - build and install Xen hypervisor'
166 @echo ' tools - build and install tools'
167 @echo ' stubdom - build and install the stubdomain images'
168 @echo ' kernels - build and install guest kernels'
169 @echo ' kbuild - synonym for make kernels'
170 @echo ' docs - build and install user documentation'
171 @echo ' dev-docs - build developer-only documentation'
172 @echo ''
173 @echo 'Cleaning targets:'
174 @echo ' clean - clean the Xen, tools and docs (but not guest kernel trees)'
175 @echo ' distclean - clean plus delete kernel build trees and'
176 @echo ' local downloaded files'
177 @echo ' kdelete - delete guest kernel build trees'
178 @echo ' kclean - clean guest kernel build trees'
179 @echo ''
180 @echo 'Miscellaneous targets:'
181 @echo ' prep-kernels - prepares kernel directories, does not build'
182 @echo ' uninstall - attempt to remove installed Xen tools'
183 @echo ' (use with extreme care!)'
184 @echo
185 @echo 'Trusted Boot (tboot) targets:'
186 @echo ' build-tboot - download and build the tboot module'
187 @echo ' install-tboot - download, build, and install the tboot module'
188 @echo ' clean-tboot - clean the tboot module if it exists'
189 @echo
190 @echo 'Environment:'
191 @echo ' [ this documentation is sadly not complete ]'
193 # Use this target with extreme care!
194 .PHONY: uninstall
195 uninstall: D=$(DESTDIR)
196 uninstall:
197 [ -d $(D)$(XEN_CONFIG_DIR) ] && mv -f $(D)$(XEN_CONFIG_DIR) $(D)$(XEN_CONFIG_DIR).old-`date +%s` || true
198 rm -rf $(D)$(CONFIG_DIR)/init.d/xend*
199 rm -rf $(D)$(CONFIG_DIR)/hotplug/xen-backend.agent
200 rm -f $(D)$(CONFIG_DIR)/udev/rules.d/xen-backend.rules
201 rm -f $(D)$(CONFIG_DIR)/udev/xen-backend.rules
202 rm -f $(D)$(CONFIG_DIR)/udev/rules.d/xend.rules
203 rm -f $(D)$(CONFIG_DIR)/udev/xend.rules
204 rm -f $(D)$(CONFIG_DIR)/sysconfig/xendomains
205 rm -rf $(D)/var/run/xen* $(D)/var/lib/xen*
206 rm -rf $(D)/boot/*xen*
207 rm -rf $(D)/lib/modules/*xen*
208 rm -rf $(D)$(LIBDIR)/xen* $(D)$(BINDIR)/lomount
209 rm -rf $(D)$(BINDIR)/cpuperf-perfcntr $(D)$(BINDIR)/cpuperf-xen
210 rm -rf $(D)$(BINDIR)/xc_shadow
211 rm -rf $(D)$(BINDIR)/pygrub
212 rm -rf $(D)$(BINDIR)/setsize $(D)$(BINDIR)/tbctl
213 rm -rf $(D)$(BINDIR)/xsls
214 rm -rf $(D)$(INCLUDEDIR)/xenctrl.h $(D)$(INCLUDEDIR)/xenguest.h
215 rm -rf $(D)$(INCLUDEDIR)/xs_lib.h $(D)$(INCLUDEDIR)/xs.h
216 rm -rf $(D)$(INCLUDEDIR)/xen
217 rm -rf $(D)$(LIBDIR)/libxenctrl* $(D)$(LIBDIR)/libxenguest*
218 rm -rf $(D)$(LIBDIR)/libxenstore*
219 rm -rf $(D)$(LIBDIR)/python/xen $(D)$(LIBDIR)/python/grub
220 rm -rf $(D)$(LIBDIR)/xen/
221 rm -rf $(D)$(LIBEXEC)/xen*
222 rm -rf $(D)$(SBINDIR)/setmask
223 rm -rf $(D)$(SBINDIR)/xen* $(D)$(SBINDIR)/netfix $(D)$(SBINDIR)/xm
224 rm -rf $(D)$(SHAREDIR)/doc/xen
225 rm -rf $(D)$(SHAREDIR)/xen
226 rm -rf $(D)$(MAN1DIR)/xen*
227 rm -rf $(D)$(MAN8DIR)/xen*
228 rm -rf $(D)/boot/tboot*
230 # Legacy targets for compatibility
231 .PHONY: linux26
232 linux26:
233 $(MAKE) 'KERNELS=linux-2.6*' kernels
236 #
237 # tboot targets
238 #
240 TBOOT_TARFILE = tboot-20090330.tar.gz
241 #TBOOT_BASE_URL = http://downloads.sourceforge.net/tboot
242 TBOOT_BASE_URL = $(XEN_EXTFILES_URL)
244 .PHONY: build-tboot
245 build-tboot: download_tboot
246 $(MAKE) -C tboot build
248 .PHONY: install-tboot
249 install-tboot: download_tboot
250 $(MAKE) -C tboot install
252 .PHONY: dist-tboot
253 dist-tboot: download_tboot
254 $(MAKE) DESTDIR=$(DISTDIR)/install -C tboot dist
256 .PHONY: clean-tboot
257 clean-tboot:
258 [ ! -d tboot ] || $(MAKE) -C tboot clean
260 .PHONY: distclean-tboot
261 distclean-tboot:
262 [ ! -d tboot ] || $(MAKE) -C tboot distclean
264 .PHONY: download_tboot
265 download_tboot: tboot/Makefile
267 tboot/Makefile: tboot/$(TBOOT_TARFILE)
268 [ -e tboot/Makefile ] || tar -xzf tboot/$(TBOOT_TARFILE) -C tboot/ --strip-components 1
270 tboot/$(TBOOT_TARFILE):
271 mkdir -p tboot
272 wget -O tboot/$(TBOOT_TARFILE) $(TBOOT_BASE_URL)/$(TBOOT_TARFILE)