MICRO 202659th IEEE/ACM International Symposium on Microarchitecture
AvailableReviewedReproducible

SagePTE

Co-Locating Guest and Host PTEs to Accelerate Virtual Memory Translation
Amir NoohiUniversity of Edinburgh
Mostafa DerispourUniversity of Edinburgh
Rodrigo C. O. RochaHuawei
Antonio BarbalaceUniversity of Edinburgh
Artemiy MargaritovHuawei
Athens, Greece31 October – 4 November 2026
Background

Virtualization

Virtualization is ubiquitousEvery cloud server runs many virtual machines, each with its own operating system, isolated from the others by a hypervisor.
Native: one translationThe OS’s page table maps each page of a process to a page of memory.
In a VM: two translationsThe guest’s page table maps the page only to guest memory; the hypervisor’s page table maps that to host memory. Every memory access needs both.
Native systemVirtualized systemprocessVAOS page tablememoryPAVMprocessGVAguest page tableguest memoryGPAhypervisor page tablehost memoryHPA
Amir Noohiamir.noohi@ed.ac.uk
Background

Address translation in virtualization

Nativethe OS’s page tableCR3TTBR0root register1PGDL02PUDL13PMDL24PTEL3PAdata pageVIRTUALIZEDguest page tablehost page tableshadow page tableguest’s own tablewrite-protected, not walkedPGDPUDPMDPTEVM exitshadowed by the hypervisora guest PTE write trapsthe hypervisor updates the shadow PTEShadow paginghypervisor’s tableCR3TTBR0shadow root1PGD2PUD3PMD4PTEHPAdata pageNested pagingguest tables hold GPAsCR3TTBR0guest root, a GPA12345PGD678910PUD1112131415PMD1617181920PTE21222324HPAdata page
Shadow paging
the hypervisor merges both tables into one
THE GAPboth at once?
Nested paging
Intel EPTAMD NPTArm Stage 2
TLB missone page walk
4memory accesses
fewer accesses
24memory accesses
Guest PTE updatemmap, fork, page fault
VM exiton every update
no VM exit
no VM exit
Amir Noohiamir.noohi@ed.ac.uk
Motivation

Nested page walk latency

Where one nested walk spends its time
host walkguest page tableh-final phase
0%10%20%30%share of walk latency10.020.030.140.55PGDL00.560.070.080.290.610PUDL11.0110.3120.3131.1142.215PMDL27%160.3170.4181.3198%20PTEL333%guest leaf211.0221.4237%2433%host leafHPAdata pagethe h-final phase: 43%
Workload
ApplicationRedis
Memory155 GB, 229 keys
Requestsuniform SETs, GETs
Pages4 KB
Simulated system
L1 DTLB64 entries
L2 TLB1,536 entries
PWCs2, 4, 32 entries
L1D32 KiB
L21 MiB
LLC22 MiB
LatencyPWC 1, L1 4, L2 14, LLC 54, DRAM 200 cycles
Amir Noohiamir.noohi@ed.ac.uk
Idea

Colocation of PTEs

host walkguest page tableh-final phase
Nested paging today24 dependent accesses
host walk, Stage 2CR3TTBR0guest roota GPA12345PGDL0678910PUDL11112131415PMDL21617181920PTEL3HPAdata page21222324the h-final phase: up to 47% of the walk
Colocatedthe host PTE sits next to the guest PTE
host walk, Stage 2CR3TTBR0guest roota GPA12345PGDL0678910PUDL11112131415PMDL216171819HPAdata page212223the h-final phase: up to 47% of the walk21222324accesses 21 to 24: never issuedguest PTE20PTEL3128-bit ePTEs24host PTE
no new atomicstwo 16-byte operations that cores already have
128-bit atomic readreturns both PTEs in one access
128-bit compare-and-swapfills the host PTE if the guest PTE is unchanged
ArmFEAT_LSE128x86CMPXCHG16B
Amir Noohiamir.noohi@ed.ac.uk
Design

SagePTE in action

GVAMMUTLBmissfillpage walkerinside the page walkerhost walkguest tableadded by SagePTEfull Stage 2 walkhit pathmiss pathpage-walk cachechecked at each step of accesses 1 to 19; a hit skips the memory access12345PGD678910PUD1112131415PMD16171819SagePTEenabled?no20PTE21222324HPAthe walker gets the HPA and fills the TLBSagePTE extensionyesExpanded?Hypervisor (KVM)Stage 2 faultexpand the tablenoretry the accessyesaccess 20: one 128-bit readreturns the guest PTE and host PTEhost PTE valid?yeshit: 21 to 24 never issuednomiss: full page walkfill the ePTE128-bit compare-and-swap
Amir Noohiamir.noohi@ed.ac.uk
Design

The extended PTE

Layout of a guest leaf tablewhat the guest sees, what memory holds
Conventional virtualizationSagePTEpagepageguest physical address spacehost physical address space4 KBexpanded, 8 KBPTE 0PTE 1PTE 2…PTE 511512 PTEs × 64 bitsMMU doubles the stridebase + index × 16gePTE 0hePTE 0gePTE 1hePTE 1gePTE 2hePTE 2…gePTE 511hePTE 511512 ePTEs × 128 bits
The ePTE format128 bits
GenRes.Cached HPA [47:12]Attr.12764hePTE: the host’s half, hidden from the guestRes./SWGPAAttrs630TVgePTE: the guest’s PTE, standard Armv8 format
Gengeneration, 0 = invalid
Res.reserved, PA [51:48]
Cached HPAStage 2 output [47:12]
Attr.cached host attributes
Res./SWreserved, software bits
GPAguest physical [47:12]
Attrspermissions, attributes
T, Vdescriptor type, valid
Amir Noohiamir.noohi@ed.ac.uk
Design

Invalidation

Guest write to a PTEthe hardware compares the old GPA with the new one
guest storeSTR x1, [pte]load-store unit128-bit read-modify-writeGPA [47:12]changed?yesnogen ← 0hePTE invalidhePTE keptpermissions, A, D bitsthe next walk refills itstill the right HPA
no VM exit, no trap: the store completes in the load-store unit
Host-wide invalidationpage migration, KSM, remaps
host epoch6 → 7ACTLR_EL1[24:21], written by the hypervisora leaf table in memorygePTEHPA, gen 6stale: 6 ≠ 7gePTEHPA, gen 6stale: 6 ≠ 7gePTEHPA, gen 7valid, refilled after the bumpgePTEHPA, gen 0invalid, after a guest write
no scan: the walker checks each hePTE’s generation against the epoch when it reads it, and refills stale ones lazily
Amir Noohiamir.noohi@ed.ac.uk
Design

Requirements

added by SagePTEunchanged
SOFTWAREHARDWAREGUEST VMguest OS64-bit page tablesapplicationsHYPERVISOR (KVM)Stage 2 fault handlerStage 2 page tablesCOREload-store unitMMUpage walkerpage-walk cacheTLBSYSTEM REGISTERSVTCR_EL263 … 0ACTLR_EL163 … 0caches and interconnecta 128-bit access is part of a 64-byte linePTE loads and storesStage 2 faultmiss+ expand or reclaim a leaf table+ 128-bit leaf read, CAS fill+ PTE address calculation+1 bitSagePTE enable, 1 bithost epoch, 4 bits
Amir Noohiamir.noohi@ed.ac.uk
Evaluation

Methodology

Measure the walk time, simulate the walk speedupas in ASAP and DMT
SIMULATED FOR EVERY DESIGNworkload in a VMQEMU/KVM guestmemory traceDynamoRIO drmemtracepage-table dumpsguest GVA→GPA, host GPA→HPAsimulatorbuilt on DynamoRIO drcachesimwalk speedupper designMEASURED ON REAL HARDWAREworkload in a VMnested pagingLinux perf statAmpere Altra Max PMUtime in walksper workload
Redis, 4 KB pagesnested pagingmeasuredSagePTEprojectedoutside walks, 52.2%outside walks, 52.2%in walks, 47.8%÷ 1.73, the simulated walk speedup1.25×faster
Simulated systemas in the Ampere Altra Max M96-30
CoreArm Neoverse N1, 96 cores
L1 TLBs (I, D)48 entries, fully associative
L2 TLB1,280 entries, 5-way
Guest, host PWCs2, 4, 32 entries for L0, L1, L2
L1I, L1D64 KiB, 4-way
L21 MiB, 8-way
System-level cache16 MiB, 16-way, shared
Cache line64 B
Latency, cyclesPWC 1, L1 4, L2 14, SLC 54, DRAM 200
Pages4 KB, or THP in guest and host
Trace2 B references, 300 M warm-up
functional prototype: QEMU, Linux and KVM
Amir Noohiamir.noohi@ed.ac.uk
Evaluation

Last-level PTE latency

Lv0Lv1Lv2Lv3h-final
4 KB pagesaccesses 21–24
0%10%20%30%40%50%share of walk latencyBTreeCannealGUPSGraph500MemcachedRedisXSBench44.7747.0444.1927.9742.5442.7444.01
Transparent huge pagesaccesses 21–23
0%10%20%30%40%50%share of walk latencyBTreeCannealGUPSGraph500MemcachedRedisXSBench41.0142.3947.5621.1441.1545.7835.18
Share of nested page-walk latency spent in each host level of the h-final phase (Lv0 to Lv3), and in the whole phase. With huge pages the h-final walk resolves the 2 MB data page in three accesses, Lv0 to Lv2.
Amir Noohiamir.noohi@ed.ac.uk
Evaluation

Page-walk speedup

SagePTE(our work)TPTDMTFPTECPTAgile PagingASAPnested paging(baseline)
4 KB pages1.0×1.5×2.0×2.5×3.0×speedupRedisMemcachedGUPSBTreeCannealXSBenchGraph500Geomean1.73×1.74×1.79×1.81×1.89×1.79×1.39×1.71×
transparent huge pages1.0×1.5×2.0×2.5×3.0×speedupRedisMemcachedGUPSBTreeCannealXSBenchGraph500Geomean1.84×1.70×1.91×1.70×1.74×1.54×1.27×1.66×
Geomean speedup: 1.71× with 4 KB pages and 1.66× with huge pages; DMT, the best prior design, reaches 1.40× and 1.55×. SagePTE trails where the leaf is warm: Graph500, and XSBench with huge pages.
Amir Noohiamir.noohi@ed.ac.uk
Evaluation

End-to-end speedup

SagePTE(our work)TPTDMTFPTECPTAgile PagingASAPnested paging(baseline)
4 KB pages1.0×1.2×1.4×1.6×1.8×2.0×speedupRedisMemcachedGUPSBTreeCannealXSBenchGraph500Geomean1.25×1.06×1.74×1.25×1.58×1.37×1.06×1.30×
transparent huge pages1.0×1.2×1.4×1.6×1.8×2.0×speedupRedisMemcachedGUPSBTreeCannealXSBenchGraph500Geomean1.26×1.06×1.82×1.20×1.21×1.10×1.02×1.22×
time in page walks4 KBTHP
Redis47.8%44.7%
Memcached13.9%12.7%
GUPS96.3%94.5%
BTree44.5%40.1%
Canneal78.2%41.5%
XSBench61.4%25.6%
Graph50020.4%7.9%
SagePTE over4 KBTHP
TPT1.17×1.11×
DMT1.15×1.09×
FPT1.17×1.18×
ECPT1.15×1.11×
Agile Paging1.17×1.15×
ASAP1.21×1.18×
Geomean speedup: 1.30× with 4 KB pages and 1.22× with huge pages. The gain follows the time each workload spends in page walks.
Amir Noohiamir.noohi@ed.ac.uk
Evaluation

Overheads

Memory overheadonly the leaf page tables double, 4 KB → 8 KB
< 0.27%of VM memory
guest page tables per workloadBTree719 MBRedis303 MBGUPS256 MBGraph500198 MBXSBench167 MBMemcached115 MBCanneal57 MB
Expansion latencyone-time, per leaf table: 3.01 µs
< 0.12%of execution
TLB shootdown1.34 µs, 44.6%copy1.12 µs, 37.5%locks, barriers0.55 µs
expansions per run
workload, 4 KB pagesexpansionstime, msof runtimeTHP
BTree183,835553.50.089%361
Redis77,657233.80.117%158
GUPS65,554197.40.070%132
Graph50050,720152.70.060%111
XSBench42,724128.20.012%87
Memcached29,56189.00.008%58
Canneal14,58143.90.002%31
THP: expansions with huge pages. Expansions trap to the hypervisor; guest PTE updates never do.
Amir Noohiamir.noohi@ed.ac.uk
Conclusion

Takeaways

1The cost is concentrated at the leaf of the page walk
accesses 21 to 24
the h-final phase: up to 47% of page-walk latency
2Colocate the host and guest PTEs
gePTEguest, 64 bits
hePTEhost, 64 bits
one 128-bit ePTE, one read
no guest OS changes, no VM exits, the 128-bit atomics cores already have
3Faster walks, efficient virtualization
4 KB pageshuge pagespage walks1.71×1.66×end to end1.30×1.22×
geomean speedup over nested paging
Thank you.Questions?
artifactgithub.com/amirmnoohi/SagePTE-AEdoi:10.5281/zenodo.21876937
AvailableReviewedReproducible
Amir Noohiamir.noohi@ed.ac.uk
Backup

Guest and host accesses

Guest accesses to its own PTEssteered by one TLB bit, E
guest loadLDR x0, [pte]GVATLB ENTRYEGVA → HPAattr1E = 1load-store unitoffset × 2: the 16-byte ePTE+5–10 cyclesHPA + 16 × iFROM L1DgePTE imasked64 bitsx0gePTE i, 64 bitsthe guest sees its own PTEguest storeSTR x1, [pte]GVA, x1TLB ENTRYEGVA → HPAattr1E = 1load-store unitone 128-bit atomic RMW+10–30 cyclesHPA + 16 × iOLD ePTEgePTEhePTE, gen 7old vs new GPAGPA [47:12]changed?yesnogen ← 0hePTE invalidhePTE keptA, D, permissions
no VM exit, no trap: both complete in the load-store unit
Host accessesits own mappings never set E
host loadKVM, QEMUhost VATLB ENTRYEVA → PAattr0E = 0load-store unitordinary 8-byte loadPA + 8 × jMEMORYgePTE ihePTE i+16 × i+16 × i + 8hardware unchangedsoftware sees both halves,16 bytes aparthost remapmigration, KSMSTAGE 2 ENTRYGPA → new HPAhost epoch, ACTLR_EL1[24:21]6 → 7TLB shootdownA LEAF TABLEgePTEHPA, gen 6stalegePTEHPA, gen 7validnext walk on a stale hePTE:full page walk, then CAS refill+10–20 cycles, once per page
no scan: each hePTE is checked against the epoch when it is read
Cycles are estimates for an N1-class core; SagePTE was not synthesized. Data loads and stores (E = 0) add nothing; a page walk adds about 1 cycle.
Amir Noohiamir.noohi@ed.ac.uk
Backup

What each design removes

keptnever issuedprefetched earlyguest tableh-final phasePpermission readDESIGNPGDPUDPMDPTEh-finalACCESSESEXTRAWALK SPEEDUPgeomean, 4 KBNested pagingthe baseline: 2D walk12345678910111213141516171819202122232424–1.00×ASAPprefetches the deepest levels1234567891011121314151617181920212223242412 prefetched early1.20×Agile Pagingshadow, then the final host walk1234567891011121314151617181920212223248VM exits on updates1.29×FPTflattened: 2 levels each1234567891011121314151617181920212223248–1.29×ECPThashed page tables1234567891011121314151617181920212223243+ hash computation1.36×DMTrange descriptors1234567891011121314151617181920212223243–1.40×TPTHPAs in the guest table1234567891011121314151617181920212223244 + 4PPPP1.30×SagePTEhost PTE next to guest PTE12345678910111213141516171819202122232420miss: full walk + CAS1.71×
Each design’s accesses as the evaluation’s simulator models them, 4 KB pages. ASAP issues all 24 and prefetches the two deepest levels of both dimensions (its Figure 7). Walk speedup: geomean over the seven workloads.
Amir Noohiamir.noohi@ed.ac.uk
Backup

Which level serves each access

PWCL1 cacheL2 cacheLLC/SLCmemoryskip
0%25%50%75%100%accesses served by53535353511737243029825124155234327822343472912594720326392610015854325316330123456789101112131415161718192021222324for guest L0for guest L1for guest L2for guest L3for the data page33%1.0%1.4%7.4%33%43% of the walkguest leafshare of walk latency per access
Amir Noohiamir.noohi@ed.ac.uk
Backup

Memory access patterns

Redis155 GB48%
Random lookup, then a short chasebucket array4 GBkeys and values144 GB1234one GET: a random bucket, then the entry, its key and its value, side by side
Memcached95 GB14%
Random item, short sequential readhash tableitems, 1.1 KB each95 GB123one GET: a random bucket, then one item: its key, then its value in order
GUPS128 GB96%
Random updates, no localityran[128]1 KBtable128 GB123one update: ran[j], then table[x] and its mirror, table[N − x]
BTree125 GB44%
Pointer chase down the treetree nodeskey arraysrecords, elements12345678one lookup: about 10 nodes, each then its keys; the top levels stay cached
Canneal62 GB78%
Random element, two hops eachelementslocationsneighbour lists1234567one move: an element, its location and its neighbours, then two hops per neighbour
XSBench84 GB61%
Binary search, then strided readsunionized grid966 MBindex matrix86 GBisotope grids2.9 GB126 probes23one per isotope, 8 MB apartone lookup: a binary search, one row of the index, then one point in each isotope's grid
Graph500123 GB20%
Sequential scans, random checksqueue1 GBoffsets2 GBadjacency64 GBparents1 GB1234one per edgeone vertex: from the queue, its offsets and its edges in order, then each neighbour's parent
How to reada data structure, not to scale1an access, numbered in order2an access that stays in the cache3a run read in ordermany alike accessesrun time in page walks, 4 KB pages
One operation of each workload, as its source code does it at the inputs it runs with: its main data structures, and its accesses in order.
Amir Noohiamir.noohi@ed.ac.uk