aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_suspend.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-06-01 14:15:48 +0100
committerKeir Fraser <keir.fraser@citrix.com>2009-06-01 14:15:48 +0100
commitd06a984487230b6e078e30f2cea26b3baf937efc (patch)
tree97679128014fe5f84e3c740345d18b43bf301984 /tools/libxc/xc_suspend.c
parent1472f8177f8ec6d81b471d678cf22e04c36e1a2a (diff)
downloadxen-d06a984487230b6e078e30f2cea26b3baf937efc.tar.gz
xen-d06a984487230b6e078e30f2cea26b3baf937efc.tar.bz2
xen-d06a984487230b6e078e30f2cea26b3baf937efc.zip
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>
Diffstat (limited to 'tools/libxc/xc_suspend.c')
-rw-r--r--tools/libxc/xc_suspend.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/libxc/xc_suspend.c b/tools/libxc/xc_suspend.c
index c0ab75762d..a9999b38ed 100644
--- a/tools/libxc/xc_suspend.c
+++ b/tools/libxc/xc_suspend.c
@@ -110,7 +110,7 @@ int xc_suspend_evtchn_init(int xc, int xce, int domid, int port)
return suspend_evtchn;
cleanup:
- if (suspend_evtchn > 0)
+ if (suspend_evtchn != -1)
xc_suspend_evtchn_release(xce, suspend_evtchn);
return -1;