From: "zhujun" Subject: shadow_clean_dirty_bitmap's another solution Date: Wed, 24 Jun 2009 17:08:38 +0800 Message-ID: <004601c9f4ab$5ce9f030$16bdd090$@pku.edu.cn> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0992603744==" Return-path: 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: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org UbJGR;7b MIME 8qJ=5D6`2?7VSJ<~!# --===============0992603744== Content-Type: multipart/alternative; boundary="----=_NextPart_000_0047_01C9F4EE.6B0D3030" Content-Language: zh-cn UbJGR;7b MIME 8qJ=5D6`2?7VSJ<~!# ------=_NextPart_000_0047_01C9F4EE.6B0D3030 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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. sl1mfn = shadow_l2e_get_mfn(*sl2e); if ( mfn_valid(sl1mfn) ) { SHADOW_FOREACH_L1E(sl1mfn, sl1e, 0, 0, { flags = shadow_l1e_get_flags(*sl1e); target_mfn = shadow_l1e_get_mfn(*sl1e); if(mfn_valid(target_mfn)) { pg = mfn_to_page(target_mfn); if ((pg != NULL) || ((pg->u.inuse.type_info & PGT_type_mask) == PGT_writable_page)) { if ((flags & _PAGE_PRESENT) && (flags & _PAGE_RW)) { shadow_l1e_t ro_sl1e = shadow_l1e_remove_flags(*sl1e, _PAGE_RW); (void) shadow_set_l1e(v, sl1e, ro_sl1e, sl1mfn); } } } }); } zhujun ------=_NextPart_000_0047_01C9F4EE.6B0D3030 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

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.

 

         =            sl1mfn =3D shadow_l2e_get_mfn(*sl2e);

          =       if ( mfn_valid(sl1mfn) )

          =       {

          =          SHADOW_FOREACH_L1E(sl1mfn, sl1e, 0, 0, = {

          =             &= nbsp; flags =3D shadow_l1e_get_flags(*sl1e);

          =             &= nbsp; target_mfn =3D shadow_l1e_get_mfn(*sl1e);

          =             &= nbsp; if(mfn_valid(target_mfn))

          =             &= nbsp; {

          =             &= nbsp;         pg =3D mfn_to_page(target_mfn);

          =             &= nbsp;         if ((pg !=3D NULL) || ((pg->u.inuse.type_info & PGT_type_mask) = =3D=3D PGT_writable_page))

          =             &= nbsp;         {

          =             &= nbsp;           &n= bsp;     if ((flags & _PAGE_PRESENT) && (flags & = _PAGE_RW))

          =             &= nbsp;           &n= bsp;     {

          =             &= nbsp;                 &= nbsp;       shadow_l1e_t ro_sl1e =3D shadow_l1e_remove_flags(*sl1e, = _PAGE_RW);

          =             &= nbsp;           &n= bsp;           &nb= sp; (void) shadow_set_l1e(v, sl1e, ro_sl1e, sl1mfn);

          =             &= nbsp;           &n= bsp;     }

          =             &= nbsp;         }

          =             &= nbsp; }

          =          });

          =       }

         =

 

zhujun

 

------=_NextPart_000_0047_01C9F4EE.6B0D3030-- --===============0992603744== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============0992603744==--