Jiang, Yunhong
2009-May-31 11:10 UTC
[Xen-devel] [PATCH 0/6] Support exchange page from user space tools
The followed patches are to support exchange a page from user space tools for a PV guest. Patches 1~4 are just user space changes(1~3 are minor changes). But patch 5/6 need more discussion and review. Thanks Yunhong Jiang Patch 1- export_xc_map_m2p.patch export the map_m2p functin . Patch 2 - grant_check.patch Add a function so that user space can check if a page is granted or not. Patch 3 - map_p2m.patch This patch firstly change the xc_core_arch_map_p2m() to map the p2m to be writable, then it export this function. Patch 4 - xc_exchange.patch This patch support exchange a page for PV guest. See the patch for more information. Patch 5 - mem_exchange.patch Currently XENMEM_exchange only support exchange memory for current domain, This patch extend it to foreign domain once the target domain is in suspended state. Patch 6 - update_pt.patch Currently MMU_PT_UPDATE_RESERVE_AD support only update page table for current domain. This patch add support for foreign domain also. This patch make the mod_lx_entry and get_page_from_lxe much more complex, especially considering the parameter definition for these function are not described so clearly. See discussion in http://lists.xensource.com/archives/html/xen-devel/2009-05/msg00629.html for more information. I''m not sure if I need do some cleanup before this patch. Notice: 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. 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 = 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 informatin. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel