Shadow Page Tables in Xen
Thanks Tim.
Quoted 2 lines
Why are you interested? Do you have a project in mind?
We have a course project, in which we have to improve the performance of live migration for HVM guests. It seems that to support live migration, all the page table entries in the shadow page table are marked as write protected, so as to know which pages are dirtied and to be sent to the other machine. Since, there will be many page faults leading to performance degradation, we want to reduce these page faults. In our course project, we are supposed to form groups of pages and if any page in the group hits the page fault (due to write-protection), we mark all the pages in the group as RW. This way we can reduce the page faults.
This is based on some hueristic that if a page is written, its immediate neighbors will also be written.
My concern was that since we will be touching the same shadow page table and marking its PTEs as RO or RW during different epochs we should not break something existing.
Priya.I
Quoted 64 lines · Tim Deegan
From: Tim Deegan <[email protected]>
Subject: Re: [Xen-devel] Shadow Page Tables in Xen
To: "priya sehgal" <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Tuesday, April 21, 2009, 2:07 PM
Hi,Quoted 1 line · priya sehgal
I was going through the memory management in Xen and
little confused
Quoted 1 line
about shadow page tables for HVM guest and how they
work.
Why are you interested? Do you have a project in mind?
Quoted 2 lines
Few of my questions are :
1. A shadow page table, is a copy of the guest pagetable, with actual machine frame numbers (MFN), as against the physical page number(PFN) in case of guests.
Quoted 1 line
Do the shadow page tables write protect each of the
PTE it contains, or only the pages containing the "guest page table" are write protected (to check if the guest has modified any entry)?
They write-protect all pagetables and some other things but not all of
memory; that wouldn't be very useful.Quoted 1 line
2. I know that live migration is supported on xen, but
not sure if it works for HVM guests. In this case also, xen will need to keep a shadow page table, which should detect which pages have been modified since the last time the pages were migrated. For this, shadow page table should mark all the PTEs as write protected. Does xen implement live migration of HVM guests in this way ?
Quoted 1 line
If yes, then is this shadow table same as the one used
in (1), or there are multiple copies of the shadow tables for different purposes?
There's only one set of shadows, since the MMU can only use one at a
time.Cheers,
Tim.
Quoted 10 lines
Thanks.
Priya_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-develSignature · 3 lines
Tim Deegan <[email protected]> Principal Software Engineer, Citrix Systems (R&D) Ltd. [Company #02300071, SL9 0DZ, UK.]
Hi,
Quoted 10 lines · priya sehgal
We have a course project, in which we have to improve the performance of live migration for HVM guests. It seems that to support live migration, all the page table entries in the shadow page table are marked as write protected, so as to know which pages are dirtied and to be sent to the other machine. Since, there will be many page faults leading to performance degradation, we want to reduce these page faults. In our course project, we are supposed to form groups of pages and if any page in the group hits the page fault (due to write-protection), we mark all the pages in the group as RW. This way we can reduce the page faults.
I see. Yes, in the shadow pagetables that should be easy enough; the shadow_set_l1e() function is where the read-only mapping will be replaced by a read-write one, which should be a hint that you might want to reconsider its neighbours.
Quoted 2 lines
This is based on some hueristic that if a page is written, its immediate neighbors will also be written.
I'd be interested to hear how it trades off against increaded bandwicth use.
Cheers,
Tim.
Quoted 79 lines
My concern was that since we will be touching the same shadow page table and marking its PTEs as RO or RW during different epochs we should not break something existing.
Priya.I
Quoted 52 lines · Tim Deegan
From: Tim Deegan <[email protected]>
Subject: Re: [Xen-devel] Shadow Page Tables in Xen
To: "priya sehgal" <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Tuesday, April 21, 2009, 2:07 PM
Hi,Quoted 1 line · priya sehgal
I was going through the memory management in Xen and
little confused
Quoted 1 line
about shadow page tables for HVM guest and how they
work.
Why are you interested? Do you have a project in mind?
Quoted 2 lines
Few of my questions are :
1. A shadow page table, is a copy of the guest pagetable, with actual machine frame numbers (MFN), as against the physical page number(PFN) in case of guests.
Quoted 1 line
Do the shadow page tables write protect each of the
PTE it contains, or only the pages containing the "guest page table" are write protected (to check if the guest has modified any entry)?
They write-protect all pagetables and some other things but not all of
memory; that wouldn't be very useful.Quoted 1 line
2. I know that live migration is supported on xen, but
not sure if it works for HVM guests. In this case also, xen will need to keep a shadow page table, which should detect which pages have been modified since the last time the pages were migrated. For this, shadow page table should mark all the PTEs as write protected. Does xen implement live migration of HVM guests in this way ?
Quoted 1 line
If yes, then is this shadow table same as the one used
in (1), or there are multiple copies of the shadow tables for different purposes?
There's only one set of shadows, since the MMU can only use one at a
time.Cheers,
Tim.
Quoted 4 lines
Thanks.
PriyaQuoted 12 lines
Quoted 6 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-develSignature · 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
Signature · 3 lines
Tim Deegan <[email protected]> Principal Software Engineer, Citrix Systems (R&D) Ltd. [Company #02300071, SL9 0DZ, UK.]
Hi,
Quoted 7 lines · priya sehgal
Thanks Tim.
Quoted 2 lines
Why are you interested? Do you have a project in
mind?We have a course project, in which we have to improve the performance of live migration for HVM guests. It seems that to support live migration, all the page table entries in the shadow page table are marked as write protected, so as to know which pages are dirtied and to be sent to the other machine. Since, there will be many page faults leading to performance degradation, we want to reduce these page faults. In our course project, we are supposed to form groups of pages and if any page in the group hits the page fault (due to write-protection), we mark all the pages in the group as RW. This way we can reduce the page faults.
Have you actually measured this? I think that the major cause of page faults and VM slowdown is -- rather than page faults on write access -- the fact that we blow the shadow pagetables away everytime we clean the dirty bitmap, and this requires a long operation to remove from top to bottom all reference counts and reconstructing later the shadow pagetables on the next memory accesses.
Thanks,
Gianluca
Signature · 4 lines
It was a type of people I did not know, I found them very strange and
they did not inspire confidence at all. Later I learned that I had been
introduced to electronic engineers.
E. W. DijkstraQuoted 6 lines
Have you actually measured this? I think that the major cause of page faults and VM slowdown is -- rather than page faults on write access -- the fact that we blow the shadow pagetables away everytime we clean the dirty bitmap, and this requires a long operation to remove from top to bottom all reference counts and reconstructing later the shadow pagetables on the next memory accesses.
Yep, ideally we'd just walking all the shadow leaf PTE's to just remove write access. I'd guess that this would be a much more worthwhile optimization than trying to 'pre-fetch' write faults.
Ian