Questions about sh_prefetch and log_dirty
Hi,
I've been working on a project which is to minimize the overhead of page_fault when PV is in log_dirty mode. I wrote a function "sh_prebuild", it's very much similar to sh_prefetch(), the major difference between them is:
I set the "ft" as "ft_demand_write" rather than "ft_prefetch" when I call l1e_propagate_from_guest(). I just want to make the faulted page and its following pages writable and marked as dirty after a write_protect page_fault. The function "sh_prebuild" is called in the sh_page_fault() right before sh_prefetch():
---------------sh_page_fault()-----------------
if ( ( shadow_mode_log_dirty(v->domain) )
&& ( ft == ft_demand_write ) )sh_prebuild(.......);
..............
I got problems when I migrate. The code can successfully migrate the domainU to another UNMODIFIED Xen. But when I migrate a domainU from UNMODIFIED Xen back to this MODIFIED Xen, the domU's clock is frozen, I use "xm console" to get in domU's console, but I just got about 6 TSC error messages and no other respond.
I am using 32-bit PV domain, no-PSE.
Does someone know any reasons? Thanks.
Hi,
Quoted 6 lines · David Knight
I've been working on a project which is to minimize the overhead of
page_faultwhen PV is inlog_dirtymode. I wrote a function "sh_prebuild", it's very much similar tosh_prefetch(), the major difference between them is:
I set the "ft" as "ft_demand_write" rather than "ft_prefetch" when I calll1e_propagate_from_guest().
I'm not sure that's a good idea. The point of log-dirty is that it lets the migration tool resend only the dirtied pages, and although your change will avoid some page faults, it will increase the number of frames that have to be retransmitted.
Also, just setting ft_demand_write won't always do what you want: in _sh_propagate, if the guest PTE's _PAGE_DIRTY bit isn't set it will mask out _PAGE_RW anyway.
That said, I don't understand why your live migrations are failing, especially not on the migration _to_ the modified Xen, since the idea you describe should be safe.
Cheers,
Tim.
Quoted 29 lines
I just want to make the faulted page and its following pages writable and marked as dirty after a
write_protectpage_fault. The function "sh_prebuild" is called in thesh_page_fault()right beforesh_prefetch():---------------sh_page_fault()-----------------
if ( (
shadow_mode_log_dirty(v->domain))
&& ( ft ==ft_demand_write) )sh_prebuild(.......);..............
I got problems when I migrate. The code can successfully migrate the domainU to another UNMODIFIED Xen. But when I migrate a domainU from UNMODIFIED Xen back to this MODIFIED Xen, the domU's clock is frozen, I use "xm console" to get in domU's console, but I just got about 6 TSC error messages and no other respond.
I am using 32-bit PV domain, no-PSE.
Does someone know any reasons? Thanks._______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Signature · 3 lines
Tim Deegan <[email protected]> Principal Software Engineer, Citrix Systems (R&D) Ltd. [Company #02300071, SL9 0DZ, UK.]
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 2 lines · David Knight
Could it be possible that xen is in
log_dirty_modewhen a DomU is immigrating into it ?
No; and if it were it wouldn't matter since the domain being migrated into isn't running.
Cheers,
Tim.
Quoted 32 lines
Quoted 30 lines
Quoted 29 lines
I just want to make the faulted page and its following pages writable and marked as dirty after a
write_protectpage_fault. The function "sh_prebuild" is called in thesh_page_fault()right beforesh_prefetch():---------------sh_page_fault()-----------------
if ( (
shadow_mode_log_dirty(v->domain))
&& ( ft ==ft_demand_write) )sh_prebuild(.......);..............
I got problems when I migrate. The code can successfully migrate the domainU to another UNMODIFIED Xen. But when I migrate a domainU from UNMODIFIED Xen back to this MODIFIED Xen, the domU's clock is frozen, I use "xm console" to get in domU's console, but I just got about 6 TSC error messages and no other respond.
I am using 32-bit PV domain, no-PSE.
Does someone know any reasons? Thanks._______________________________________________
Xen-devel mailing list [email protected]<mailto:[email protected]>
http://lists.xensource.com/xen-devel
Signature · 3 lines
Tim Deegan <[email protected]> Principal Software Engineer, Citrix Systems (R&D) Ltd. [Company #02300071, SL9 0DZ, UK.]
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Hi,
Quoted 3 lines · David Knight
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.
Quoted 1 line
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.
Quoted 75 lines
static void sh_prebuild(struct vcpu *v,
walk_tgw,
shadow_l1e_t*ptr_sl1e,mfn_tsl1mfn, 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); }
Signature · 3 lines
Tim Deegan <[email protected]> Principal Software Engineer, Citrix Systems (R&D) Ltd. [Company #02300071, SL9 0DZ, UK.]
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 6 lines · David Knight
Quoted 3 lines
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?
Would pointer arithmetic become a problem? anyway, I didn't get any warning during compilation.
No, it just struck me as odd that you would bother to change it.
Quoted 2 lines
I am running XEN 3.3.1, our optimization is mainly for PV guest, so I remove OOS code. I know there will be problem when using HVM.
In that case I don't see anything obvious that would cause the crash.
Tim.
Signature · 3 lines
Tim Deegan <[email protected]> Principal Software Engineer, Citrix Systems (R&D) Ltd. [Company #02300071, SL9 0DZ, UK.]
Thanks a lot.
2009/6/25 10:51 pm, Tim Deegan wrote:
Quoted 27 lines
Quoted 6 lines · David Knight
Quoted 3 lines
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?
Would pointer arithmetic become a problem? anyway, I didn't get any warning during compilation.
No, it just struck me as odd that you would bother to change it.
Quoted 2 lines
I am running XEN 3.3.1, our optimization is mainly for PV guest, so I remove OOS code. I know there will be problem when using HVM.
In that case I don't see anything obvious that would cause the crash.
Tim.
Signature · 8 lines
Tim Deegan <[email protected]> Principal Software Engineer, Citrix Systems (R&D) Ltd. [Company #02300071, SL9 0DZ, UK.] _______________________________________________ Xen-devel mailing list [email protected] http://lists.xensource.com/xen-devel