Intel 5-level paging

From HandWiki
Short description: Processor extension for the x86-64 line of processors
A diagram of five levels of paging

Intel 5-level paging, referred to simply as 5-level paging in Intel documents, is a processor extension for the x86-64 line of processors.[1]:11 It extends the size of virtual addresses from 48 bits to 57 bits, increasing the addressable virtual memory from 256 TB to 128 PB. The extension was first implemented in the Ice Lake processors,[2] and the 4.14 Linux kernel adds support for it.[3] Windows 10 and 11 with server versions also support this extension in their latest updates, where it is provided by a separate kernel of the system called ntkrla57.exe.[4]

Technology

x86-64 processors without this feature use a four-level page table structure when operating in 64-bit mode.[5](p4-22) A similar situation arose when the 32 bit IA-32 processors used two levels, allowing up to four GB of memory (both virtual and physical). To support more than 4 GB of RAM, an additional mode of address translation called Physical Address Extension (PAE) was defined, involving a third level.[6] This was enabled by setting a bit in the CR4 register.[5](p4-14) Likewise, the new extension is enabled by setting bit 12 of the CR4 register (known as LA57).[1]:16 This is only used when the processor is operating in 64 bit mode, and only may be modified when it is not.[1]:16 If the bit is not set, the processor operates with four paging levels.

As adding another page table multiplies the address space by 512, the virtual limit has increased from 256 TB to 128 PB. An extra nine bits of the virtual address index the new table, so while formerly bits 0 through 47 were in use, now bits 0 through 56 are in use.

As with four level paging, the high-order bits of a virtual address that do not participate in address translation must be the same as the most significant implemented bit. With five-level paging enabled, this means that bits 57 through 63 must be copies of bit 56.[1]:17 Intel has renamed the existing paging system as "4-level paging", which used to be known as IA-32e paging.[5](p4-2)

Extending page table entry to 128 bits allows full 64-bit address space in 4-level paging scheme, and makes possible arbitrary allocation unit sizes in 5-level scheme.[7]

Implementation

5-level paging is implemented by the Ice Lake microarchitecture,[2] EPYC 9004 Series Processors[8] and Storm peak Ryzen Threadripper PRO 7900WX series.[9]

Support for the extension was submitted as a set of patches to the Linux kernel on 8 December 2016.[10] As was reported on the Linux kernel mailing list, it consisted of extending the Linux memory model to use five levels rather than four.[11] This is because, although Linux abstracts the details of the page tables, it still depends on having a number of levels in its own representation. When an architecture supports fewer levels, Linux emulates extra levels that do nothing.[12] A similar change was previously made to extend from three levels to four.[13]

Drawbacks

Adding another level of indirection makes page table "walks" longer.[14] A page table walk occurs when either the processor's memory management unit or the memory management code in the operating system navigates the tree of page tables to find the page table entry corresponding to a virtual address.[15][5](p4-22) This means that, in the worst case, the processor or the memory manager has to access physical memory six times for a single virtual memory access, rather than five for the previous iteration of x86-64 processors. This results in slightly reduced memory access speed.[16] In practice this cost is greatly mitigated by caches such as the translation lookaside buffer (TLB).[16] Further extensions may reduce page walks by using 4096 128-bit page table entries, and allow a larger 64 KB page size and backward compatibility with 4 KB page operations.[7]

References

  1. 1.0 1.1 1.2 1.3 "5-Level Paging and 5-Level EPT". Intel Corporation. May 2017. https://www.intel.com/content/www/us/en/content-details/671442/5-level-paging-and-5-level-ept-white-paper.html. 
  2. 2.0 2.1 Cutress, Ian. "Sunny Cove Microarchitecture: A Peek At the Back End". Intel's Architecture Day 2018: The Future of Core, Intel GPUs, 10nm, and Hybrid x86. https://www.anandtech.com/show/13699/intel-architecture-day-2018-core-future-hybrid-x86/2. 
  3. Tung, Liam. "First Linux 4.14 release adds "very core" features, arrives in time for kernel's 26th birthday | ZDNet" (in en). ZDNet. https://www.zdnet.com/article/first-linux-4-14-release-adds-very-core-features-arrives-in-time-for-kernels-26th-birthday/. 
  4. @aionescu. "Old farts like me will remember the days of ntoskrnl.exe, ntkrnlpa.exe, ntkrnlmp.exe and ntkrpamp.exe.". https://twitter.com/aionescu/status/1142637363840946176.  Missing or empty |date= (help)
  5. 5.0 5.1 5.2 5.3 Intel® 64 and IA-32 Architectures Software Developer's Manual. 3A. Intel Corporation. https://www.intel.com/content/www/us/en/developer/articles/technical/intel-sdm.html. 
  6. Hudek, Ted (June 2017). "Operating Systems and PAE Support - Windows 10 hardware dev" (in en-us). https://learn.microsoft.com/en-us/previous-versions/windows/hardware/design/dn613969(v=vs.85). 
  7. 7.0 7.1 "64KB page system that supports 4KB page operation" US patent 9858198, published 2016-12-29, issued 2018-01-02, assigned to Intel Corp.
  8. "Tuning Guide for AMD EPYC™ 9004 Processors". AMD. September 2023. https://www.amd.com/content/dam/amd/en/documents/epyc-technical-docs/tuning-guides/58020-epyc-9004-tg-high-perf-toolchain.pdf. 
  9. "CPUID dump for 96-Core AMD Ryzen Threadripper PRO 7995WX (Storm Peak) Zen4". October 19, 2023. https://github.com/InstLatx64/InstLatx64/blob/37bd7b1ac29d95ddcf1fed90efaf7e82c89ab65d/AuthenticAMD/AuthenticAMD0A10F81_K19_StormPeak_01_CPUID.txt#L81C17-L81C25. 
  10. Michael Larabel (9 December 2016). "Intel Working On 5-Level Paging To Increase Linux Virtual/Physical Address Space - Phoronix" (in en). https://www.phoronix.com/scan.php?page=news_item&px=Intel-5-Level-Paging. 
  11. Shutemov, Kirill A. (December 8, 2016). "[RFC, PATCHv1 00/28] 5-level paging". Linux kernel mailing list (Mailing list). Retrieved 2018-04-26.
  12. "Page Table Management". https://www.kernel.org/doc/gorman/html/understand/understand006.html. 
  13. "Four-level page tables [LWN.net"]. October 12, 2004. https://lwn.net/Articles/106177/. 
  14. "CSALT: Context Switch Aware Large TLB". Cambridge, MA: Institute of Electrical and Electronics Engineers., IEEE Computer Society., ACM Special Interest Group on Microprogramming. 14 October 2017. p. 450. doi:10.1145/3123939.3124549. ISBN 978-1-4503-4952-9. OCLC 1032337814. 
  15. "ARM Information Center". http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0301h/I1026235.html. 
  16. 16.0 16.1 Levy, Hank (Autumn 2008). "CSE 451: Operating Systems: Paging & TLBs". https://courses.cs.washington.edu/courses/cse451/08au/lectures/10-paging_TLBs.pdf.