[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH][Xen 4.0-testing.hg] fix small bugs of memory sharing
Hi, Tim: Thanks for your information, First I want to explain that our current project is try to implement memory deduplication for unmodified guest in Xen (basically HVM). Since memory sharing code provides good fundamental for COW mechanism, we would like to test and utilize it. Please see my inline comments. On Wed, Dec 8, 2010 at 6:51 PM, Tim Deegan <Tim.Deegan@xxxxxxxxxx> wrote: Hi, You are right, I should change to xen-unstable when submitting the patch. But in the latest xen-unstable, the mem_sharing_share_pages() function crashes the entire xen. Currently I don't have a serial-port for debugging the oops message. Or could someone give me a hint on how to debug this kind of crash?
Got it.
It seems the candidate page for nomination usually has (type=none, count=1), and it's ok for page_make_sharable() to make it (type=none, count=2) afterwards. However, when we have a page (type=none, count=2), the page_make_sharable() will make it wrong as the following steps: (step1) get_page() increases count (type=none, count=3) (step2) cmpxchg loops changes type (type=8400000000000001, count=3, actually the real value of count_info is 0x8000000000000002) (step3) Checking count is greater than 2? Oops!.... abort without recovering type back to none So that's why I interchange (step2) and (step3) and replace put_page_and_type() with put_page(). I don't understand why this function requires type == none; CC'ing the (Correct me if I am wrong please !!) From my observation, the normal page mapped by a single gfn of a domain will have count=1 (PGT_allocated) and type=0. The page_make_sharable() will use get_page() before checking ci >=2. So it's ok for PGT_allocated page, but not ok if ci =2 before get_page(). After some tracing, I found a scenario for the page (ci=2, ti=0). It seems the stub domain for a HVM guest will try to map some of HVM's memory into its own address space using do_mmu_update(), which increases the ci from 1 to 2 without changing the type or marking it as shared. For a 1GB 64-bit HVM Centos 5.5 guest (pae=1, hap=1), around 250MB will become ci=2 after booting into user space prompt. I wonder the following two things (1) stub domain does this to perform I/O for HVM guest? can someone point out where this code is? (2) is there a way or any place to unmap the memory and make the page count back to 1? It's not possible to share a page with typecount > 0 because we need to Assume my previous guess for stub domain is right. Then if a page from the previous scenario is made sharable and its mapped mfn is freed (when sharing two pages, the later one's mfn will be discarded), will the stub domain refer to the old discarded mfn if no unmapping is performed?
Appreciate any comments, Jui-Hao _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |