tinnycloud
2011-Jan-06 02:23 UTC
[Xen-devel] Could the page sharing inside domain? (memory_sharing on xen)
Hi all: One of the features listed as having been added to Xen 4 is page sharing for HVM domUs. Pity is it has been disabled since buggy. Well I tried to make it work these days. After go through the code and get thoroughly concept of page sharing, I''ve been able to setup test environment, but confronted domU crash. One abnormal output from serial is (XEN) mm.c:859:d0 Error getting mfn 2df15f (pfn fffffffffffffffe) from L1 entry 80000002df15f627 for l1e_owner=0, pg_owner=4 (XEN) mm.c:859:d0 Error getting mfn 2df160 (pfn fffffffffffffffe) from L1 entry 80000002df160627 for l1e_owner=0, pg_owner=4 Later, I found this is related to page sharing inside domain itself. That is when a domain X first read IO sectors Y, it will nominate the gref into xen(that is build a hash entry in xen) , after IO completion, it will build a hash entry in tapdisk2 hash table. But later domain X read same sectors again, it can find entry in both hash tables, and page sharing works, one page freed. Then I can see above serial output. So my question is: Is page sharing legal inside domain? Thanks. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Tim Deegan
2011-Jan-06 10:13 UTC
Re: [Xen-devel] Could the page sharing inside domain? (memory_sharing on xen)
At 02:23 +0000 on 06 Jan (1294280625), tinnycloud wrote:> Hi all: > > One of the features listed as having been added to Xen 4 is page > sharing for HVM domUs. Pity is it has been disabled since buggy. > Well I tried to make it work these days. > > After go through the code and get thoroughly concept of page > sharing, I''ve > been able to setup test environment, but confronted domU crash. > > One abnormal output from serial is > > (XEN) mm.c:859:d0 Error getting mfn 2df15f (pfn fffffffffffffffe) from L1 > entry 80000002df15f627 for l1e_owner=0, pg_owner=4 > (XEN) mm.c:859:d0 Error getting mfn 2df160 (pfn fffffffffffffffe) from L1 > entry 80000002df160627 for l1e_owner=0, pg_owner=4 > > Later, I found this is related to page sharing inside domain itself. > > That is when a domain X first read IO sectors Y, it will nominate > the gref into xen(that is build a hash entry in xen) > , after IO completion, it will build a hash entry in tapdisk2 hash > table. > > But later domain X read same sectors again, it can find entry in > both hash tables, and page sharing works, one page freed. > Then I can see above serial output. > > So my question is: Is page sharing legal inside domain?It was intended to be, but as you say it''s buggy. The error messages you see above are from dom0 trying to map dom4''s memory and finding a shared page (i.e. owned by dom_cow). Either there''s a missing unshare operation on the path that called get_page_from_l1e(), or a race where a page got re-shared before the mapping could be completed, or possibly the unshare operation doesn''t work properly when a domain has two copies of a shared page. Tim. -- Tim Deegan <Tim.Deegan@citrix.com> Principal Software Engineer, Xen Platform Team Citrix Systems UK Ltd. (Company #02937203, SL9 0BG) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jui-Hao Chiang
2011-Jan-06 14:16 UTC
Re: [Xen-devel] Could the page sharing inside domain? (memory_sharing on xen)
Hi, The error messages you see above are from dom0 trying to map dom4''s> memory and finding a shared page (i.e. owned by dom_cow). Either > there''s a missing unshare operation on the path that called > get_page_from_l1e(), or a race where a page got re-shared before the > mapping could be completed, or possibly the unshare operation doesn''t > work properly when a domain has two copies of a shared page. > > Tim. > > >That''s exactly what we have found during yesterday. It is because the code doesn''t update/check p2m type with the shr_lock, which causes either incorrect share operation or race-condition in unshare operation. We will submit our current fix as a patch soon. Bests, Jui-Hao _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel