Swapping of PT pages
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
Quoted 7 lines · Mike Sun
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
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.
May be I am wrong i guess as i do not have the source handy at the moment.
Please CMIIW.
Thanks,
Quoted 14 lines
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
[email protected]
http://lists.xensource.com/xen-devel
Signature · 3 lines
Pradeep Singh Rautela http://eagain.wordpress.com http://emptydomain.googlepages.com
Quoted 3 lines · pradeep singh rautela
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.
Quoted 5 lines
Quoted 5 lines
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.
Signature · 3 lines
Tim Deegan <[email protected]> Principal Software Engineer, Citrix Systems (R&D) Ltd. [Company #02300071, SL9 0DZ, UK.]
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
Quoted 13 lines
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->PFNcanonicalization on the on-disk form, andPFN->MFNwhen 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.)
Quoted 3 lines · Mike Sun
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.
Signature · 3 lines
Tim Deegan <[email protected]> Principal Software Engineer, Citrix Systems (R&D) Ltd. [Company #02300071, SL9 0DZ, UK.]
Quoted 11 lines · Mike Sun
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.
Quoted 1 line
Am I understanding things incorrectly?
Have a look at take_machine_down inlinux-.../drivers/xen/core/machine_reboot.c.
Before the suspend call is issued, the guest uses mm_pin_all to prevent this scenario from happening.