ia64/xen-unstable

view Config.mk @ 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 2eb9f1db70a4
children 72ff07f65e16
line source
1 # -*- mode: Makefile; -*-
3 # A debug build of Xen and tools?
4 debug ?= n
6 XEN_COMPILE_ARCH ?= $(shell uname -m | sed -e s/i.86/x86_32/ \
7 -e s/i86pc/x86_32/ -e s/amd64/x86_64/)
8 XEN_TARGET_ARCH ?= $(XEN_COMPILE_ARCH)
9 XEN_OS ?= $(shell uname -s)
11 CONFIG_$(XEN_OS) := y
13 SHELL ?= /bin/sh
15 # Tools to run on system hosting the build
16 HOSTCC = gcc
17 HOSTCFLAGS = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
18 HOSTCFLAGS += -fno-strict-aliasing
20 DISTDIR ?= $(XEN_ROOT)/dist
21 DESTDIR ?= /
23 # Allow phony attribute to be listed as dependency rather than fake target
24 .PHONY: .phony
26 include $(XEN_ROOT)/config/$(XEN_OS).mk
27 include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk
29 SHAREDIR ?= $(PREFIX)/share
30 DOCDIR ?= $(SHAREDIR)/doc/xen
31 MANDIR ?= $(SHAREDIR)/man
33 ifneq ($(EXTRA_PREFIX),)
34 EXTRA_INCLUDES += $(EXTRA_PREFIX)/include
35 EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBLEAFDIR)
36 endif
38 PYTHON ?= python
39 PYTHON_PREFIX_ARG ?= --prefix="$(PREFIX)"
40 # The above requires that PREFIX contains *no spaces*. This variable is here
41 # to permit the user to set PYTHON_PREFIX_ARG to '' to workaround this bug:
42 # https://bugs.launchpad.net/ubuntu/+bug/362570
44 # cc-option: Check if compiler supports first option, else fall back to second.
45 # Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586)
46 cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
47 /dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;)
49 # cc-option-add: Add an option to compilation flags, but only if supported.
50 # Usage: $(call cc-option-add CFLAGS,CC,-march=winchip-c6)
51 cc-option-add = $(eval $(call cc-option-add-closure,$(1),$(2),$(3)))
52 define cc-option-add-closure
53 ifneq ($$(call cc-option,$$($(2)),$(3),n),n)
54 $(1) += $(3)
55 endif
56 endef
58 # cc-ver: Check compiler is at least specified version. Return boolean 'y'/'n'.
59 # Usage: ifeq ($(call cc-ver,$(CC),0x030400),y)
60 cc-ver = $(shell if [ $$((`$(1) -dumpversion | awk -F. \
61 '{ printf "0x%02x%02x%02x", $$1, $$2, $$3}'`)) -ge $$(($(2))) ]; \
62 then echo y; else echo n; fi ;)
64 # cc-ver-check: Check compiler is at least specified version, else fail.
65 # Usage: $(call cc-ver-check,CC,0x030400,"Require at least gcc-3.4")
66 cc-ver-check = $(eval $(call cc-ver-check-closure,$(1),$(2),$(3)))
67 define cc-ver-check-closure
68 ifeq ($$(call cc-ver,$$($(1)),$(2)),n)
69 override $(1) = echo "*** FATAL BUILD ERROR: "$(3) >&2; exit 1;
70 cc-option := n
71 endif
72 endef
74 define absolutify_xen_root
75 case "$(XEN_ROOT)" in \
76 /*) XEN_ROOT=$(XEN_ROOT) ;; \
77 *) xen_root_lhs=`pwd`; \
78 xen_root_rhs=$(XEN_ROOT)/; \
79 while [ "x$${xen_root_rhs#../}" != "x$$xen_root_rhs" ]; do \
80 xen_root_rhs="$${xen_root_rhs#../}"; \
81 xen_root_rhs="$${xen_root_rhs#/}"; \
82 xen_root_rhs="$${xen_root_rhs#/}"; \
83 xen_root_lhs="$${xen_root_lhs%/*}"; \
84 done; \
85 XEN_ROOT="$$xen_root_lhs/$$xen_root_rhs" ;; \
86 esac; \
87 export XEN_ROOT
88 endef
90 ifeq ($(debug),y)
91 CFLAGS += -g
92 endif
94 CFLAGS += -fno-strict-aliasing
96 CFLAGS += -std=gnu99
98 CFLAGS += -Wall -Wstrict-prototypes
100 # -Wunused-value makes GCC 4.x too aggressive for my taste: ignoring the
101 # result of any casted expression causes a warning.
102 CFLAGS += -Wno-unused-value
104 $(call cc-option-add,HOSTCFLAGS,HOSTCC,-Wdeclaration-after-statement)
105 $(call cc-option-add,CFLAGS,CC,-Wdeclaration-after-statement)
107 LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i))
108 CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i))
110 # Enable XSM security module. Enabling XSM requires selection of an
111 # XSM security module (FLASK_ENABLE or ACM_SECURITY).
112 XSM_ENABLE ?= n
113 FLASK_ENABLE ?= n
114 ACM_SECURITY ?= n
116 XEN_EXTFILES_URL=http://xenbits.xensource.com/xen-extfiles
117 # All the files at that location were downloaded from elsewhere on
118 # the internet. The original download URL is preserved as a comment
119 # near the place in the Xen Makefiles where the file is used.
121 QEMU_REMOTE=http://xenbits.xensource.com/git-http/qemu-xen-unstable.git
123 # Specify which qemu-dm to use. This may be `ioemu' to use the old
124 # Mercurial in-tree version, or a local directory, or a git URL.
125 # CONFIG_QEMU ?= ../qemu-xen.git
126 CONFIG_QEMU ?= $(QEMU_REMOTE)
128 OCAML_XENSTORED_REPO=http://xenbits.xensource.com/ext/xen-ocaml-tools.hg
130 # Build OCAML version of xenstored instead of the in-tree C version?
131 # This will cause $(OCAML_XENSTORED_REPO) to be cloned.
132 CONFIG_OCAML_XENSTORED ?= n
134 # Optional components
135 XENSTAT_XENTOP ?= y
136 VTPM_TOOLS ?= n
137 LIBXENAPI_BINDINGS ?= n
138 PYTHON_TOOLS ?= y
139 CONFIG_MINITERM ?= n
140 CONFIG_LOMOUNT ?= n
142 -include $(XEN_ROOT)/.config