From: cross@spitfire.i.gajendra.net   
      
   In article , BGB wrote:   
   >On 5/23/2023 1:26 PM, Dan Cross wrote:   
   >[snip]   
   >>> On a 50 MHz core, only about 0.2% of the CPU time is going into handling   
   >>> TLB misses.   
   >>   
   >> That's not the issue.   
   >>   
   >> The hypervisor has to invoke the guest's   
   >> TLB miss handler, which will have to fault _again_ once it tries   
   >> to write to the TLB to insert an entry; this can lead to several   
   >> round-trips, bouncing between the host and guest several times.   
   >> With nested VMs, this gets significantly worse.   
   >>   
   >   
   >So?...   
      
   I wonder: have you looked into why essentially every modern   
   architecture in common use today uses hardware page tables?   
   The hardware engineers working on are not stupid, and they are   
   perfectly well aware of everything you said about e.g. larger   
   TLBs. Yet there is a reason they chose to implement things   
   the way essentially every extant modern architecture has.   
   Perhaps they are aware of something you would find illuminating.   
      
   The issues I'm talking about very much exist and very much   
   affect world-world designs. I'll take the slightly larger cost   
   in transistors over the disadvantages, including forcing   
   pipeline flushes, thrashing the icache to handle TLB fault   
   misses, and significantly more complex virtualization.   
      
   Besides....what do you do if a guest decides it wants to insert   
   a mapping covering part the hypervisor itself into the TLB?   
      
   > [snip]   
   >>> One could also have the guest OS use page-tables FWIW.   
   >>   
   >> How does the hypervisor know the format of the guest's page   
   >> tables, in general?   
   >>   
   >   
   >They have designated registers and the tree formats are documented as   
   >part of the ISA/ABI specs...   
      
   The point of a hypervisor is to provide a faithful emulation   
   of the _hardware_: it's up to the guest to decide what ABI it   
   uses. The hypervisor can't really force that onto the guest,   
   and sothere's no "ABI" as such in a non-paravirtualized   
   hypervisor. The whole point is that unmodified guests can run   
   without change and think that they're running directly on the   
   bare metal.   
      
   It's unclear what the point of an ISA-mandated page table format   
   would be in a system that doesn't use them. What prevents a   
   guest from just ignoring them and doing its own thing?   
      
    - Dan C.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|