Chapter 5: Q14E (page 493)
To support multiple virtual machines, two levels of memory virtualization are needed. Each virtual machine still controls the mapping of virtual address (VA) to physical address (PA), while the hypervisor maps the physical address (PA) of each virtual machine to the actual machine address (MA). To accelerate such mappings, a software approach called “shadow paging” duplicates each virtual machine’s page tables in the hypervisor, and intercepts VA to PA mapping changes to keep both copies consistent. To remove the complexity of shadow page tables, a hardware approach called nested page table (NPT) explicitly supports two classes of page tables (VAPA and PA
MA) and can walk such tables purely in hardware.
Consider the following sequence of operations: (1) Create process; (2) TLB miss; (3) page fault; (4) context switch;
(5.14.1) What would happen for the given operation sequence for shadow page table and nested page table, respectively?
(5.14.2) Assuming an x86-based 4-level page table in both guest and nested page table, how many memory references are needed to service a TLB miss for native vs. nested page table?
(5.14.3) Among TLB miss rate, TLB miss latency, page fault rate, and page fault latency, which metrics are more important for shadow page table? Which are important for nested page table?
Assume the following parameters for a shadow paging system
TLB Misses per 1000 instructions | NPT TLB Miss Latency | Page Faults per 1000 instructions | Shadowing Page Fault Overhead |
0.2 | 200 cycles | 0.001 | 30,000 cycles |
(5.14.4) For a benchmark with native execution CPI of 1, what are the CPI numbers if using shadow page tables vs. NPT (assuming only page table virtualization overhead)?
(5.14.5) What techniques can be used to reduce page table shadowing induced overhead?
(5.14.6) What techniques can be used to reduce NPT induced overhead?
Short Answer
(5.14.1)
In shadow paging, on the creation of a new process, the hypervisor updates the shadow paging table. On TLB miss, there is no change in a page table. On page fault, mapping is updated. And on context switch, mapping is invalidated.
In a nested page table, creating a new process creates two tables for the translation of addresses. On TLB miss, both tables need to be accessed. On page fault, both tables are updated and on context switch, the page tables are invalidated.
(5.14.2)
Four memory references are needed for the native page table and 24 are needed for the nested page table.
(5.14.3)
Page fault rate is an important metric for shadow paging and TLB miss rate is an important metric for the nested page table.
(5.14.4)
CPI number for shadow paging is 1.03 and for nested page table is 1.04.
(5.14.5)
Page table shadowing induced overhead is reduced by combining the updates of multiple page tables.
(5.14.6)
NPT induced overhead can be reduced by using agile paging.