From: "zhujun" Subject: =?gb2312?B?tPC4tDogW1hlbi1kZXZlbF0gc2hhZG93X2NsZWFuX2RpcnR5X2JpdA==?= =?gb2312?B?bWFwJ3MgYW5vdGhlciBzb2x1dGlvbg==?= Date: Wed, 24 Jun 2009 17:39:34 +0800 Message-ID: <004e01c9f4af$af42bb10$0dc83130$@pku.edu.cn> References: <004601c9f4ab$5ce9f030$16bdd090$@pku.edu.cn> <20090624091618.GO16056@york.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20090624091618.GO16056@york.uk.xensource.com> Content-Language: zh-cn List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: 'Tim Deegan' Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Thanks for your advice. I am sorry my code was not complete in last mail. I forgot to mention = that I was looking in sl2es because I wanted to only walk all the in-use L1 = shadow page tables. Those not in-use L1 shadow page tables are not walked. = That's because when a L1 shadow page table is selected to be in-use, the = entries will be propagated from the guest page table again. Then, the R/W bit = will be cleared because of log dirty mode. Just as shadow_blow_tables, it = only blows the in-use shadow page tables. Others in the hash table are not = blew down. Am I right? Yes, my code is too cautious, because I have tried too many times to = remove my faults. Unfortunately, I am not sure about my solution. -----=D3=CA=BC=FE=D4=AD=BC=FE----- =B7=A2=BC=FE=C8=CB: Tim Deegan [mailto:Tim.Deegan@citrix.com]=20 =B7=A2=CB=CD=CA=B1=BC=E4: 2009=C4=EA6=D4=C224=C8=D5 17:16 =CA=D5=BC=FE=C8=CB: zhujun =B3=AD=CB=CD: xen-devel@lists.xensource.com =D6=F7=CC=E2: Re: [Xen-devel] shadow_clean_dirty_bitmap's another = solution At 10:08 +0100 on 24 Jun (1245838118), zhujun wrote: > Hi, > When doing live migration, the shadow code is translated to = log dirty mode. However, in the shadow_clean_dirty_bitmap function, all the in-use shadow page tables are blew down. I think it is too crude, just = as the comment of the function says. I am trying to find a better solution, = but it does not succeeds. Would you please help me check my source code and = give me some suggestions? My current solution is walking all the in-use L1 = shadow page tables and clearing each L1 entry?s R/W bit if it has set. > I don?t know whether it is enough to remove these R/W bits = for live migration. If not, how to make all the pages of a PV domain = read-only again? Thanks very much! > My source code is here. >=20 > sl1mfn =3D shadow_l2e_get_mfn(*sl2e); Stop right there! :) Why are you looking in sl2es? You need to make = _all_ the sl1es read-only for this to work. You should be using hash_foreach() to walk through every l1 shadow. Have a look at sh_remove_all_mappings for an example of code that walks every sl1 = table. Also your code below seems a bit too cautious: it should be OK to just = check for_PAGE_PRESENT and _PAGE_RW and then clean _PAGE_RW. Cheers, Tim. > if ( mfn_valid(sl1mfn) ) > { > SHADOW_FOREACH_L1E(sl1mfn, sl1e, 0, 0, { > flags =3D shadow_l1e_get_flags(*sl1e); > target_mfn =3D shadow_l1e_get_mfn(*sl1e); > if(mfn_valid(target_mfn)) > { > pg =3D mfn_to_page(target_mfn); > if ((pg !=3D NULL) || ((pg->u.inuse.type_info & PGT_type_mask) =3D=3D PGT_writable_page)) > { > if ((flags & _PAGE_PRESENT) && (flags & _PAGE_RW)) > { > shadow_l1e_t ro_sl1e = =3D shadow_l1e_remove_flags(*sl1e, _PAGE_RW); > (void) = shadow_set_l1e(v, sl1e, ro_sl1e, sl1mfn); > } > } > } > }); > } >=20 >=20 > zhujun >=20 Content-Description: ATT00001.txt > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel -- Tim Deegan Principal Software Engineer, Citrix Systems (R&D) Ltd. [Company #02300071, SL9 0DZ, UK.]