From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jiang, Yunhong" Subject: RE: Re: [PATCH] Support swap a page from user space tools -- Was RE: [RFC][PATCH] Basic support for page offline Date: Fri, 20 Mar 2009 10:52:36 +0800 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: Content-Language: en-US List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser , Tim Deegan Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org xen-devel-bounces@lists.xensource.com <> wrote: > On 19/03/2009 14:42, "Jiang, Yunhong" wrote: >=20 >>>> It is ok for us to use an arbitrary new mfn, and then do the >>>> update_entry. But what happen if this process failed and we want to tu= rn >>>> back to the old page? We still need this mechanism at that situation. >>>=20 >>> If what failed? The update_entry? How could that happen? >>=20 >> Per discussion before, when the page is granted to other domain, then >> after we update all entry, there will still have reference to left. >=20 > Hmmm I don't really understand. 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 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 is target of this s= eries patches). The method to exchange the offline pending page for PV domain is: 1) Suspend the guest. 2) Allocate a new page for the guest 3) Get a copy for the content 4) User space tools will scan all page table page to see if any reference t= o the offending page, if yes, then it will hypercall to Xen to replace the = entry to point to the new one. (Through the mmu_*ops) 5) After update all page tables, user space tools will try to exchange the = old page with the new page. If the new mfn has no reference anymore (i.e. c= ount_info & count_mask =3D 1), the exchange will update the m2p and return = success, otherwise it will return fail. (the page may be referenced by othe= r domain, like grant table or foreign mapped). 6) If step 5 is success, user space tools will update the content of the ne= w page and the p2m table, else it will try to undo step 4 to revert page ta= ble changes. 7) Resume the guest. This requires we need to allocate the new page before the exchange call and= we have to pass both old_mfn and new_mfn in step 5 to exchange the memory.= However, current hypercall will always allocate a new page to replace the = old one. Currently I try to add a new hypercall for this purpose.=20 Maybe we can enhance the current XENMEM_exchange to accept a mem_flags, whe= n that flag is set, the exch.out.extent_start will be the new_mfn instead o= f the gpfn, and the gpfn will be always same as corresponding gpfn in the e= xch.in.ext_start. But I do think this is a bit tricky, it change the meanin= g of exch.out.extent_start and how the gpn is pass down.=20 Thanks Yunhong Jiang >=20 > K. >=20 >=20 >=20 > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel=