Hi -- In examining the domain save/migration code (xc_domain_save.c), I came across the step in which page table page frames in memory are canonicalized so that mfns are translated to pfns before those pages are written out to the saved image/destination host. This makes me wonder if a PV host is allowed to swap out page table pages if it so decided; if swapping of PT pages were allowed, then wouldn''t certain page table pages not be canonicalized (since they would be on disk, not in any of the machine frames). This obviously be bad. Am I understanding things incorrectly? Thanks, Mike _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On 20/02/2008, Mike Sun <msun@gatech.edu> wrote:> Hi -- > > In examining the domain save/migration code (xc_domain_save.c), I came > across the step in which page table page frames in memory are > canonicalized so that mfns are translated to pfns before those pages > are written out to the saved image/destination host. This makes me > wonder if a PV host is allowed to swap out page table pages if it soI suspect Xen translates the mfns of the PV guests PT pages to equivalent pfns before they can be actually swapped out on to a physical disk. May be I am wrong i guess as i do not have the source handy at the moment. Please CMIIW. Thanks,> decided; if swapping of PT pages were allowed, then wouldn''t certain > page table pages not be canonicalized (since they would be on disk, > not in any of the machine frames). This obviously be bad. > > Am I understanding things incorrectly? > > Thanks, > Mike > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel >-- Pradeep Singh Rautela http://eagain.wordpress.com http://emptydomain.googlepages.com _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Tuesday, 19 February 2008 at 15:27, Mike Sun wrote:> Hi -- > > In examining the domain save/migration code (xc_domain_save.c), I came > across the step in which page table page frames in memory are > canonicalized so that mfns are translated to pfns before those pages > are written out to the saved image/destination host. This makes me > wonder if a PV host is allowed to swap out page table pages if it so > decided; if swapping of PT pages were allowed, then wouldn''t certain > page table pages not be canonicalized (since they would be on disk, > not in any of the machine frames). This obviously be bad. > > Am I understanding things incorrectly?Have a look at take_machine_down in linux-.../drivers/xen/core/machine_reboot.c. Before the suspend call is issued, the guest uses mm_pin_all to prevent this scenario from happening. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
At 02:14 +0530 on 20 Feb (1203473672), pradeep singh rautela wrote:> I suspect Xen translates the mfns of the PV guests PT pages to > equivalent pfns before they can be actually swapped out on to a > physical disk.Xen is not involved in the guest''s swapping/paging activities. If a guest were to page its pagetables out to disk and then be migrated, they would indeed be incorrect when they were reloaded. The canonicalisation happens only for pages that are currently in memory and marked with a page-table type.> > decided; if swapping of PT pages were allowed, then wouldn''t certain > > page table pages not be canonicalized (since they would be on disk, > > not in any of the machine frames). This obviously be bad. > > > > Am I understanding things incorrectly?You''re right. If a guest wanted to use a pagetable after it had been paged out, it would have to do the same MFN->PFN canonicalization on the on-disk form, and PFN->MFN when reloading. (That''s PV guests, BTW. HVM guests that swapped their pagetables could potentially experience memory corruption if they used the emulated disk controller, but should work fine with PV drivers, or with NPT.) Tim. -- Tim Deegan <Tim.Deegan@citrix.com> Principal Software Engineer, Citrix Systems (R&D) Ltd. [Company #02300071, SL9 0DZ, UK.] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Thanks Tim, this is very interesting. So is it safe for me to assume that the current Linux PV implementation does not allow page table pages to be swapped out (to ensure that it can be migrated correctly)? Mike> Xen is not involved in the guest''s swapping/paging activities. If a > guest were to page its pagetables out to disk and then be migrated, they > would indeed be incorrect when they were reloaded. The canonicalisation > happens only for pages that are currently in memory and marked with a > page-table type.> You''re right. If a guest wanted to use a pagetable after it had been > paged out, it would have to do the same MFN->PFN canonicalization on the > on-disk form, and PFN->MFN when reloading. > > (That''s PV guests, BTW. HVM guests that swapped their pagetables could > potentially experience memory corruption if they used the emulated disk > controller, but should work fine with PV drivers, or with NPT.)_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
At 10:55 -0500 on 20 Feb (1203504929), Mike Sun wrote:> Thanks Tim, this is very interesting. So is it safe for me to assume > that the current Linux PV implementation does not allow page table > pages to be swapped out (to ensure that it can be migrated correctly)?This assumption is already made in the migration tools, so I don''t see why not. :) Tim. -- Tim Deegan <Tim.Deegan@citrix.com> Principal Software Engineer, Citrix Systems (R&D) Ltd. [Company #02300071, SL9 0DZ, UK.] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel