VirtualBox

Changeset 65466 in vbox for trunk/src/VBox/VMM/include


Ignore:
Timestamp:
Jan 26, 2017 7:00:23 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
113092
Message:

PGM: Guest page table walking optimizations (incomplete) and statistics.

  • Optimizing guest page table walking (predictions, eff flags). More to do here, esp. with IEM TLB.
  • Added a bunch of page pools access handler stats, doing some cleanup while there.
  • Used bit 9 in PDEs for remembering whether it's from a large or 4KB page. Only for statistics for now.
Location:
trunk/src/VBox/VMM/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/include/PGMGstDefs.h

    r62478 r65466  
    143143# define GST_GET_PDE_SHW_FLAGS(pVCpu, Pde)      ((Pde).u & (X86_PDE_P | X86_PDE_RW | X86_PDE_US | X86_PDE_A))
    144144# define GST_GET_BIG_PDE_SHW_FLAGS(pVCpu, Pde) \
    145     ((Pde).u & (X86_PDE4M_P | X86_PDE4M_RW | X86_PDE4M_US | X86_PDE4M_A))
     145    ( ((Pde).u & (X86_PDE4M_P | X86_PDE4M_RW | X86_PDE4M_US | X86_PDE4M_A)) | PGM_PDFLAGS_BIG_PAGE )
    146146# define GST_GET_BIG_PDE_SHW_FLAGS_4_PTE(pVCpu, Pde) \
    147147    ((Pde).u & (X86_PDE4M_P | X86_PDE4M_RW | X86_PDE4M_US | X86_PDE4M_A | X86_PDE4M_D | X86_PDE4M_G))
     
    183183# define GST_GET_PTE_SHW_FLAGS(pVCpu, Pte)      ((Pte).u & (pVCpu)->pgm.s.fGst64ShadowedPteMask )
    184184# define GST_GET_PDE_SHW_FLAGS(pVCpu, Pde)      ((Pde).u & (pVCpu)->pgm.s.fGst64ShadowedPdeMask )
    185 # define GST_GET_BIG_PDE_SHW_FLAGS(pVCpu, Pde)  ((Pde).u & (pVCpu)->pgm.s.fGst64ShadowedBigPdeMask )
     185# define GST_GET_BIG_PDE_SHW_FLAGS(pVCpu, Pde)  ( ((Pde).u & (pVCpu)->pgm.s.fGst64ShadowedBigPdeMask ) | PGM_PDFLAGS_BIG_PAGE)
    186186# define GST_GET_BIG_PDE_SHW_FLAGS_4_PTE(pVCpu, Pde)  ((Pde).u & (pVCpu)->pgm.s.fGst64ShadowedBigPde4PteMask )
    187187
  • trunk/src/VBox/VMM/include/PGMInternal.h

    r65300 r65466  
    178178 * the page directory entries.
    179179 * @{ */
     180/** Indicates the original entry was a big page.
     181 * @remarks This is currently only used for statistics and can be recycled.  */
     182#define PGM_PDFLAGS_BIG_PAGE            RT_BIT_64(9)
    180183/** Mapping (hypervisor allocated pagetable). */
    181184#define PGM_PDFLAGS_MAPPING             RT_BIT_64(10)
     
    24962499    /** The number of failing pgmPoolTrackPhysExtAlloc calls. */
    24972500    STAMCOUNTER                 StamTrackPhysExtAllocFailures;
    2498     /** Profiling the RC/R0 access handler. */
     2501
     2502    /** Profiling the RC/R0 \#PF access handler. */
     2503    STAMPROFILE                 StatMonitorPfRZ;
     2504    /** Profiling the RC/R0 access we've handled (except REP STOSD). */
     2505    STAMPROFILE                 StatMonitorPfRZHandled;
     2506    /** Times we've failed interpreting the instruction. */
     2507    STAMCOUNTER                 StatMonitorPfRZEmulateInstr;
     2508    /** Profiling the pgmPoolFlushPage calls made from the RC/R0 access handler. */
     2509    STAMPROFILE                 StatMonitorPfRZFlushPage;
     2510    /* Times we've detected a page table reinit. */
     2511    STAMCOUNTER                 StatMonitorPfRZFlushReinit;
     2512    /** Counting flushes for pages that are modified too often. */
     2513    STAMCOUNTER                 StatMonitorPfRZFlushModOverflow;
     2514    /** Times we've detected fork(). */
     2515    STAMCOUNTER                 StatMonitorPfRZFork;
     2516    /** Times we've failed interpreting a patch code instruction. */
     2517    STAMCOUNTER                 StatMonitorPfRZIntrFailPatch1;
     2518    /** Times we've failed interpreting a patch code instruction during flushing. */
     2519    STAMCOUNTER                 StatMonitorPfRZIntrFailPatch2;
     2520    /** The number of times we've seen rep prefixes we can't handle. */
     2521    STAMCOUNTER                 StatMonitorPfRZRepPrefix;
     2522    /** Profiling the REP STOSD cases we've handled. */
     2523    STAMPROFILE                 StatMonitorPfRZRepStosd;
     2524
     2525    /** Profiling the R0/RC regular access handler. */
    24992526    STAMPROFILE                 StatMonitorRZ;
    2500     /** Times we've failed interpreting the instruction. */
    2501     STAMCOUNTER                 StatMonitorRZEmulateInstr;
    2502     /** Profiling the pgmPoolFlushPage calls made from the RC/R0 access handler. */
     2527    /** Profiling the pgmPoolFlushPage calls made from the regular access handler in R0/RC. */
    25032528    STAMPROFILE                 StatMonitorRZFlushPage;
    2504     /* Times we've detected a page table reinit. */
    2505     STAMCOUNTER                 StatMonitorRZFlushReinit;
    2506     /** Counting flushes for pages that are modified too often. */
    2507     STAMCOUNTER                 StatMonitorRZFlushModOverflow;
    2508     /** Times we've detected fork(). */
    2509     STAMCOUNTER                 StatMonitorRZFork;
    2510     /** Profiling the RC/R0 access we've handled (except REP STOSD). */
    2511     STAMPROFILE                 StatMonitorRZHandled;
    2512     /** Times we've failed interpreting a patch code instruction. */
    2513     STAMCOUNTER                 StatMonitorRZIntrFailPatch1;
    2514     /** Times we've failed interpreting a patch code instruction during flushing. */
    2515     STAMCOUNTER                 StatMonitorRZIntrFailPatch2;
    2516     /** The number of times we've seen rep prefixes we can't handle. */
    2517     STAMCOUNTER                 StatMonitorRZRepPrefix;
    2518     /** Profiling the REP STOSD cases we've handled. */
    2519     STAMPROFILE                 StatMonitorRZRepStosd;
     2529    /** Per access size counts indexed by size minus 1, last for larger. */
     2530    STAMCOUNTER                 aStatMonitorRZSizes[17];
     2531    /** Missaligned access counts indexed by offset - 1. */
     2532    STAMCOUNTER                 aStatMonitorRZMisaligned[7];
     2533
    25202534    /** Nr of handled PT faults. */
    25212535    STAMCOUNTER                 StatMonitorRZFaultPT;
     
    25292543    /** Profiling the R3 access handler. */
    25302544    STAMPROFILE                 StatMonitorR3;
    2531     /** Times we've failed interpreting the instruction. */
    2532     STAMCOUNTER                 StatMonitorR3EmulateInstr;
    25332545    /** Profiling the pgmPoolFlushPage calls made from the R3 access handler. */
    25342546    STAMPROFILE                 StatMonitorR3FlushPage;
    2535     /* Times we've detected a page table reinit. */
    2536     STAMCOUNTER                 StatMonitorR3FlushReinit;
    2537     /** Counting flushes for pages that are modified too often. */
    2538     STAMCOUNTER                 StatMonitorR3FlushModOverflow;
    2539     /** Times we've detected fork(). */
    2540     STAMCOUNTER                 StatMonitorR3Fork;
    2541     /** Profiling the R3 access we've handled (except REP STOSD). */
    2542     STAMPROFILE                 StatMonitorR3Handled;
    2543     /** The number of times we've seen rep prefixes we can't handle. */
    2544     STAMCOUNTER                 StatMonitorR3RepPrefix;
    2545     /** Profiling the REP STOSD cases we've handled. */
    2546     STAMPROFILE                 StatMonitorR3RepStosd;
     2547    /** Per access size counts indexed by size minus 1, last for larger. */
     2548    STAMCOUNTER                 aStatMonitorR3Sizes[17];
     2549    /** Missaligned access counts indexed by offset - 1. */
     2550    STAMCOUNTER                 aStatMonitorR3Misaligned[7];
    25472551    /** Nr of handled PT faults. */
    25482552    STAMCOUNTER                 StatMonitorR3FaultPT;
     
    25532557    /** Nr of handled PML4 faults. */
    25542558    STAMCOUNTER                 StatMonitorR3FaultPML4;
    2555     /** The number of times we're called in an async thread an need to flush. */
    2556     STAMCOUNTER                 StatMonitorR3Async;
     2559
    25572560    /** Times we've called pgmPoolResetDirtyPages (and there were dirty page). */
    25582561    STAMCOUNTER                 StatResetDirtyPages;
     
    27922795    /** The effective X86_PTE_NX flag for the address. */
    27932796    bool            fEffectiveNX;
     2797    bool            afPadding1[2];
     2798    /** Effective flags thus far: RW, US, PWT, PCD, A, ~NX >> 63.
     2799     * The NX bit is inverted and shifted down 63 places to bit 0. */
     2800    uint32_t        fEffective;
    27942801} PGMPTWALKCORE;
     2802
     2803/** @name PGMPTWALKCORE::fEffective bits.
     2804 * @{ */
     2805/** Effective execute bit (!NX).   */
     2806#define PGMPTWALK_EFF_X     UINT32_C(1)
     2807/** Effective write access bit. */
     2808#define PGMPTWALK_EFF_RW    X86_PTE_RW
     2809/** Effective user-mode access bit. */
     2810#define PGMPTWALK_EFF_US    X86_PTE_US
     2811/** Effective write through cache bit. */
     2812#define PGMPTWALK_EFF_PWT   X86_PTE_PWT
     2813/** Effective cache disabled bit. */
     2814#define PGMPTWALK_EFF_PCD   X86_PTE_PCD
     2815/** Effective accessed bit. */
     2816#define PGMPTWALK_EFF_A     X86_PTE_A
     2817/** The dirty bit of the final entry. */
     2818#define PGMPTWALK_EFF_D     X86_PTE_D
     2819/** The PAT bit of the final entry. */
     2820#define PGMPTWALK_EFF_PAT   X86_PTE_PAT
     2821/** The global bit of the final entry. */
     2822#define PGMPTWALK_EFF_G     X86_PTE_G
     2823/** @} */
    27952824
    27962825
     
    37663795    STAMCOUNTER StatRZInvalidatePagePDNPs;          /**< RC/R0: The number of times PGMInvalidatePage() was called for a not present page directory. */
    37673796    STAMCOUNTER StatRZInvalidatePagePDOutOfSync;    /**< RC/R0: The number of times PGMInvalidatePage() was called for an out of sync page directory. */
     3797    STAMCOUNTER StatRZInvalidatePageSizeChanges ;   /**< RC/R0: The number of times PGMInvalidatePage() was called on a page size change (4KB <-> 2/4MB). */
    37683798    STAMCOUNTER StatRZInvalidatePageSkipped;        /**< RC/R0: The number of times PGMInvalidatePage() was skipped due to not present shw or pending pending SyncCR3. */
    37693799    STAMCOUNTER StatRZPageOutOfSyncUser;            /**< RC/R0: The number of times user page is out of sync was detected in \#PF or VerifyAccessSyncPage. */
     
    38133843    STAMCOUNTER StatR3InvalidatePagePDMappings;     /**< R3: The number of times PGMInvalidatePage() was called for a page directory containing mappings (no conflict). */
    38143844    STAMCOUNTER StatR3InvalidatePagePDOutOfSync;    /**< R3: The number of times PGMInvalidatePage() was called for an out of sync page directory. */
     3845    STAMCOUNTER StatR3InvalidatePageSizeChanges ;   /**< R3: The number of times PGMInvalidatePage() was called on a page size change (4KB <-> 2/4MB). */
    38153846    STAMCOUNTER StatR3InvalidatePageSkipped;        /**< R3: The number of times PGMInvalidatePage() was skipped due to not present shw or pending pending SyncCR3. */
    38163847    STAMCOUNTER StatR3PageOutOfSyncUser;            /**< R3: The number of times user page is out of sync was detected in \#PF or VerifyAccessSyncPage. */
     
    42614292PGM_ALL_CB2_PROTO(FNPGMPHYSHANDLER) pgmPoolAccessHandler;
    42624293#ifndef IN_RING3
    4263 DECLEXPORT(FNPGMRZPHYSPFHANDLER)    pgmPoolAccessPfHandler;
     4294DECLEXPORT(FNPGMRZPHYSPFHANDLER)    pgmRZPoolAccessPfHandler;
    42644295#endif
    42654296
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette