WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Questions about sh_prefetch and log_dirty

Hi, 

At 13:56 +0100 on 25 Jun (1245938205), David Knight wrote:
> I made a mistake when I explain my problem. My code can successfully
> migrate the domU TO MODIFIED Xen. But when a domU is migrated
> from Modified Xen to a Unmodified Xen. The clock is frozen. 

OK, that makes much more sense.  It's the log-dirty code in the Xen
you're migratin from that will cause the problems.

> Here is my code, most of it is just a copy of sh_prefetch();

You've done some pretty odd things to it.  Why did you remove all the
comments, for example?  Why did you replace all the array indirections
with pointer arithmetic?

Anyway, the main thing that stands out is that you don't handle the OOS
optimization at all.  Are you running a very old version of Xen?

Cheers,

Tim.

> static void sh_prebuild(struct vcpu *v, walk_t gw,
>                                 shadow_l1e_t *ptr_sl1e, mfn_t sl1mfn, 
> unsigned int countl, unsigned int countr)
> {
>     int i, distr,distl;
>     gfn_t gfn;
>     mfn_t gmfn;
>     guest_l1e_t *gl1p = NULL, gl1e;
>     shadow_l1e_t sl1e;
>     u32 gflags;
>     p2m_type_t p2mt;
>     struct page_info *pg;
> 
>     distl = ((unsigned long)ptr_sl1e & ~PAGE_MASK) / sizeof sl1e;
>     distr = (PAGE_SIZE - ((unsigned long)ptr_sl1e & ~PAGE_MASK)) / sizeof 
> sl1e;
> 
>     if ( distl > countl )
>         distl = countl;
>     if ( distr > countr + 1 )
>         distr = countr + 1;
> 
>     if ( !mfn_valid(gw.l1mfn) )
>         return;
> 
>     gl1p = sh_map_domain_page(gw.l1mfn);
>     gl1p += guest_l1_table_offset(gw.va);
> 
>     ptr_sl1e -= distl;
>     distl = 0-distl;
> 
>     for ( i = distl; i < distr ; i++ )
>     {
>         if ( i == 0 )
>         {
>             ptr_sl1e += 1;
>             continue;
>         }
> 
>         if ( ptr_sl1e->l1 != 0 )
>             break;
> 
>         if ( mfn_valid(gw.l1mfn) )
>         {
>             gl1e = *(gl1p + i);
> 
>             gflags = guest_l1e_get_flags(gl1e);
>             if ( (gflags & _PAGE_PRESENT)
>                  && (!(gflags & _PAGE_ACCESSED)
>                      || ((gflags & _PAGE_RW) && !(gflags & _PAGE_DIRTY))) )
>                 break;
>         }
>         else
>         {
>             ASSERT(guest_l2e_get_flags(gw.l2e) & _PAGE_PSE);
>             gl1e = guest_l1e_from_gfn(
>                 _gfn(gfn_x(guest_l1e_get_gfn(gw.l1e)) + i),
>                 guest_l1e_get_flags(gw.l1e));
>         }
> 
>         gfn = guest_l1e_get_gfn(gl1e);
>         gmfn = gfn_to_mfn(v->domain, gfn, &p2mt);
> 
>         pg = mfn_to_page(gmfn);
> 
>         if ( mfn_valid(gmfn)
>             && ((pg->u.inuse.type_info & PGT_type_mask)==PGT_writable_page) )
>         {
>             l1e_propagate_from_guest(v, gl1e, gmfn, &sl1e, ft_demand_write, 
> p2mt);
>             (void) shadow_set_l1e(v, ptr_sl1e, sl1e, sl1mfn);
>         }
> 
>         ptr_sl1e += 1;
>     }
>     if ( gl1p != NULL )
>         sh_unmap_domain_page(gl1p);
> }

-- 
Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Principal Software Engineer, Citrix Systems (R&D) Ltd.
[Company #02300071, SL9 0DZ, UK.]

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel