Skip to contentSkip to conversation

Shadow Page Tables in Xen

DISCUSSION priya sehgal 3 participants 3 messages Apr 20, 2009 – Apr 21, 2009

lore
Share & tools
lore
#0 lore raw

Hi,
I was going through the memory management in Xen and little confused
about shadow page tables for HVM guest and how they work.
Few of my questions are :
1. A shadow page table, is a copy of the guest page table, with actual machine frame numbers (MFN), as against the physical page number(PFN) in case of guests. 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)?

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 ? 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?

Thanks.
Priya

#1 lore raw

Hi,

Quoted 2 lines · priya sehgal

I was going through the memory management in Xen and little confused about shadow page tables for HVM guest and how they work.

Why are you interested? Do you have a project in mind?

Quoted 3 lines

Few of my questions are :
1. A shadow page table, is a copy of the guest page table, with actual machine frame numbers (MFN), as against the physical page number(PFN) in case of guests. 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 2 lines

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 ? 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-devel

Signature · 3 lines
Tim Deegan <[email protected]>
Principal Software Engineer, Citrix Systems (R&D) Ltd.
[Company #02300071, SL9 0DZ, UK.]
#2 lore raw
In reply to priya sehgal
Quoted 6 lines · priya sehgal

Hi,
I was going through the memory management in Xen and little confused
about shadow page tables for HVM guest and how they work.
Few of my questions are :
1. A shadow page table, is a copy of the guest page table, with actual machine frame numbers (MFN), as against the physical page number(PFN) in case of guests.

yes thats true.

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)?

Its gPT that is write protected and it is one of the mechanism to detect the gPT modification to keep sPT and gPT in sync.
others mechanisms are like syncing based on processor’s page-fault behaviour Hypervisor has to sync accessed and PTE dirty bit every time there is a change in sPT by processor.

As far as the write protection is concerned it does for all the PTE entry in gPT.

Quoted 3 lines

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 ? 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?

Yes its hypervisor job to keep sPT and gPT in sync during migration.

Quoted 12 lines

Thanks.
Priya

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel