• Re: Styles of addressing

    From scott@scott@slp53.sl.home (Scott Lurndal) to comp.arch on Fri Nov 13 19:25:58 2026
    From Newsgroup: comp.arch

    Paul Clayton <paaronclayton@gmail.com> writes:
    On 9/28/26 11:24 AM, Scott Lurndal wrote:
    Paul Clayton <paaronclayton@gmail.com> writes:
    [snip]
    I have a personal dislike of nested page tables and some

    Care to elaborate? As someone who worked with hypervisors
    both before and after AMD introduced nested page tables,
    I have nothing good to say about the alternatives to
    NPT.

    Nested page tables are necessarily wasteful of storage and
    add latency.

    I disagree. We have TLBs specifically to address the
    latency issues, and most table walkers also internally cache
    intermediate page table addresses.


    I am inclined (likely from ignorance) to prefer
    paravirtualization. For a new architecture, forcing all OSes
    to use the architected (paravirtualization) interface may
    not be entirely impractical.

    Actually it is hugely impractical. Having worked with
    early Xen (which paravirtualized the guest address space),
    NPT wins hands-down; both from an hypervisor complexity
    standpoint, as well as from a performance standpoint.

    It's not uncommon to assign guest memory regions in
    units of 1GB, which significantly reduces the number
    of page table entry lookups during a guest page table
    walk.

    Guest Page Size Nested Page Size Memory References Required

    4K 4K 24
    4K 2M 19
    4K 1G 14
    4K N/A 4

    2M 4K 19
    2M 2M 15
    2M 1G 11
    2M N/A 3

    1G 4K 14
    1G 2M 11
    1G 1G 8
    1G N/A 2

    Table 2 - Page Table Walk Memory References


    (For an existing ISA with existing OSes, a transition to
    paravirtualization would seem to require limited binary
    translation.)

    Paravirtualization does have problems. Nested virtualization,
    where a host OS treats a guest OS as an application, does not
    seem to fit this model well. On the other hand, application-
    level code could (in theory?) directly interact with the
    architected hypervisor, though I suspect such would cause
    responsibility tracking headaches.

    I know extremely little about virtualization, but the
    obvious inefficiency of nested page tables bothers me.

    It's not inefficient, when compared to the paravirt
    alternatives. Not to mention that security (between
    guests and between guests and hypervisor) is far more
    difficult to ensure in a paravirt implementation.

    (Nested page tables may be the best selection when
    considering all the tradeoffs even for a new architecture.
    The arguments that I have read focus on compatibility/
    invisibility, which tends to exclude paravirtualization.)

    Nested page tables also work around some page coalescing
    issues (base physical pages can be mapped to large virtual
    physical pages), though if such is not very common something
    like Shadow Memory ("Increasing TLB Reach Using Superpages
    Backed by Shadow Memory", Mark Swanson et al., 1998) might
    be used to provide a limited amount of "double translated"
    pages.
    --- Synchronet 3.22a-Linux NewsLink 1.2