VirtualBox

Changeset 19903 in vbox


Ignore:
Timestamp:
May 22, 2009 9:41:32 AM (16 years ago)
Author:
vboxsync
Message:

Invalidation cleanup

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/hwacc_svm.h

    r14366 r19903  
    669669#ifdef IN_RING0
    670670VMMR0DECL(int) SVMR0InvalidatePage(PVM pVM, PVMCPU pVCpu, RTGCPTR GCVirt);
    671 VMMR0DECL(int) SVMR0InvalidatePhysPage(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys);
    672671#endif /* IN_RING0 */
    673672
  • trunk/include/VBox/hwaccm.h

    r19816 r19903  
    8181#ifndef IN_RC
    8282VMMDECL(int)     HWACCMFlushTLB(PVMCPU pVCpu);
    83 VMMDECL(int)     HWACCMFlushAllTLBs(PVM pVM);
    84 VMMDECL(int)     HWACCMInvalidatePhysPage(PVMCPU pVCpu, RTGCPHYS GCPhys);
     83VMMDECL(int)     HWACCMFlushTLBOnAllVCpus(PVM pVM);
     84VMMDECL(int)     HWACCMInvalidatePageOnAllVCpus(PVM pVM, RTGCPTR GCVirt);
     85VMMDECL(int)     HWACCMInvalidatePhysPage(PVM pVM, RTGCPHYS GCPhys);
    8586VMMDECL(bool)    HWACCMIsNestedPagingActive(PVM pVM);
    8687VMMDECL(PGMMODE) HWACCMGetShwPagingMode(PVM pVM);
     
    8990# define HWACCMFlushTLB(pVCpu)                  do { } while (0)
    9091# define HWACCMIsNestedPagingActive(pVM)        false
    91 # define HWACCMFlushAllTLBs(pVM)                do { } while (0)
     92# define HWACCMFlushTLBOnAllVCpus(pVM)          do { } while (0)
    9293#endif
    9394
  • trunk/src/VBox/VMM/PGMInternal.h

    r19872 r19903  
    327327
    328328/** @def PGM_INVL_PG
    329  * Invalidates a page when in GC does nothing in HC.
    330  *
     329 * Invalidates a page.
     330 *
     331 * @param   pVCpu       The VMCPU handle.
    331332 * @param   GCVirt      The virtual address of the page to invalidate.
    332333 */
     
    339340#endif
    340341
     342/** @def PGM_INVL_PG
     343 * Invalidates a page on all VCPUs
     344 *
     345 * @param   pVM         The VM handle.
     346 * @param   GCVirt      The virtual address of the page to invalidate.
     347 */
     348#ifdef IN_RC
     349# define PGM_INVL_ALL_VCPU_PG(pVM, GCVirt)      ASMInvalidatePage((void *)(GCVirt))
     350#elif defined(IN_RING0)
     351# define PGM_INVL_ALL_VCPU_PG(pVM, GCVirt)      HWACCMInvalidatePageOnAllVCpus(pVM, (RTGCPTR)(GCVirt))
     352#else
     353# define PGM_INVL_ALL_VCPU_PG(pVM, GCVirt)      HWACCMInvalidatePageOnAllVCpus(pVM, (RTGCPTR)(GCVirt))
     354#endif
     355
    341356/** @def PGM_INVL_BIG_PG
    342  * Invalidates a 4MB page directory entry when in GC does nothing in HC.
    343  *
     357 * Invalidates a 4MB page directory entry.
     358 *
     359 * @param   pVCpu       The VMCPU handle.
    344360 * @param   GCVirt      The virtual address within the page directory to invalidate.
    345361 */
     
    354370/** @def PGM_INVL_VCPU_TLBS()
    355371 * Invalidates the TLBs of the specified VCPU
     372 *
     373 * @param   pVCpu       The VMCPU handle.
    356374 */
    357375#ifdef IN_RC
     
    365383/** @def PGM_INVL_ALL_VCPU_TLBS()
    366384 * Invalidates the TLBs of all VCPUs
     385 *
     386 * @param   pVM         The VM handle.
    367387 */
    368388#ifdef IN_RC
    369389# define PGM_INVL_ALL_VCPU_TLBS(pVM)            ASMReloadCR3()
    370390#elif defined(IN_RING0)
    371 # define PGM_INVL_ALL_VCPU_TLBS(pVM)            HWACCMFlushAllTLBs(pVM)
     391# define PGM_INVL_ALL_VCPU_TLBS(pVM)            HWACCMFlushTLBOnAllVCpus(pVM)
    372392#else
    373 # define PGM_INVL_ALL_VCPU_TLBS(pVM)            HWACCMFlushAllTLBs(pVM)
     393# define PGM_INVL_ALL_VCPU_TLBS(pVM)            HWACCMFlushTLBOnAllVCpus(pVM)
    374394#endif
    375395
  • trunk/src/VBox/VMM/VMMAll/HWACCMAll.cpp

    r19848 r19903  
    7575    LogFlow(("HWACCMFlushTLB\n"));
    7676
    77     pVCpu->hwaccm.s.fForceTLBFlush = true;
     77    VMCPU_FF_SET(pVCpu, VMCPU_FF_TLB_FLUSH);
    7878    STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushTLBManual);
    7979    return VINF_SUCCESS;
     
    8282#ifndef IN_RC
    8383/**
     84 * Invalidates a guest page on all VCPUs.
     85 *
     86 * @returns VBox status code.
     87 * @param   pVM         The VM to operate on.
     88 * @param   GCVirt      Page to invalidate
     89 */
     90VMMDECL(int) HWACCMInvalidatePageOnAllVCpus(PVM pVM, RTGCPTR GCPtr)
     91{
     92    /* @todo */
     93    HWACCMInvalidatePage(VMMGetCpu(pVM), GCPtr);
     94    return VINF_SUCCESS;
     95}
     96
     97/**
    8498 * Flush the TLBs of all VCPUs
    8599 *
     
    87101 * @param   pVM       The VM to operate on.
    88102 */
    89 VMMDECL(int) HWACCMFlushAllTLBs(PVM pVM)
     103VMMDECL(int) HWACCMFlushTLBOnAllVCpus(PVM pVM)
    90104{
    91105    if (pVM->cCPUs == 1)
     
    153167 *
    154168 * @returns VBox status code.
    155  * @param   pVCpu       The VMCPU to operate on.
     169 * @param   pVM         The VM to operate on.
    156170 * @param   GCPhys      Page to invalidate
    157171 */
    158 VMMDECL(int) HWACCMInvalidatePhysPage(PVMCPU pVCpu, RTGCPHYS GCPhys)
    159 {
    160     PVM pVM = pVCpu->CTX_SUFF(pVM);
    161 
     172VMMDECL(int) HWACCMInvalidatePhysPage(PVM pVM, RTGCPHYS GCPhys)
     173{
    162174    if (!HWACCMIsNestedPagingActive(pVM))
    163175        return VINF_SUCCESS;
    164176
     177    PVMCPU pVCpu = VMMGetCpu(pVM);
    165178#ifdef IN_RING0
    166179    if (pVM->hwaccm.s.vmx.fSupported)
     180    {
     181        /* @todo for all vcpus */
    167182        return VMXR0InvalidatePhysPage(pVM, pVCpu, GCPhys);
     183    }
    168184
    169185    Assert(pVM->hwaccm.s.svm.fSupported);
    170     SVMR0InvalidatePhysPage(pVM, pVCpu, GCPhys);
     186    HWACCMFlushTLBOnAllVCpus(pVM);
    171187#else
    172     HWACCMFlushTLB(pVCpu);
     188    HWACCMFlushTLBOnAllVCpus(pVM);
    173189#endif
    174190    return VINF_SUCCESS;
  • trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp

    r19833 r19903  
    169169        pVM->pgm.s.fPhysCacheFlushPending = true;
    170170        pgmUnlock(pVM);
    171         HWACCMFlushAllTLBs(pVM);
     171        HWACCMFlushTLBOnAllVCpus(pVM);
    172172#ifndef IN_RING3
    173173        REMNotifyHandlerPhysicalRegister(pVM, enmType, GCPhys, GCPhysLast - GCPhys + 1, !!pfnHandlerR3);
     
    271271        pgmHandlerPhysicalDeregisterNotifyREM(pVM, pCur);
    272272        pgmUnlock(pVM);
    273         HWACCMFlushAllTLBs(pVM);
     273        HWACCMFlushTLBOnAllVCpus(pVM);
    274274        MMHyperFree(pVM, pCur);
    275275        return VINF_SUCCESS;
     
    417417        PGM_INVL_VCPU_TLBS(VMMGetCpu0(pVM));
    418418# else
    419     HWACCMFlushAllTLBs(pVM);
     419    HWACCMFlushTLBOnAllVCpus(pVM);
    420420# endif
    421421    pVM->pgm.s.fPhysCacheFlushPending = true;
     
    553553#endif
    554554                    pgmUnlock(pVM);
    555                     HWACCMFlushAllTLBs(pVM);
     555                    HWACCMFlushTLBOnAllVCpus(pVM);
    556556                    Log(("PGMHandlerPhysicalModify: GCPhysCurrent=%RGp -> GCPhys=%RGp GCPhysLast=%RGp\n",
    557557                         GCPhysCurrent, GCPhys, GCPhysLast));
     
    848848                    rc = pgmHandlerPhysicalSetRamFlagsAndFlushShadowPTs(pVM, pCur, pRam);
    849849                    pVM->pgm.s.fPhysCacheFlushPending = true;
    850                     HWACCMFlushAllTLBs(pVM);
     850                    HWACCMFlushTLBOnAllVCpus(pVM);
    851851                }
    852852
     
    920920            PGM_PAGE_SET_HNDL_PHYS_STATE(pPage, PGM_PAGE_HNDL_PHYS_STATE_DISABLED);
    921921#ifndef IN_RC
    922             HWACCMInvalidatePhysPage(VMMGetCpu(pVM), GCPhysPage);
     922            HWACCMInvalidatePhysPage(pVM, GCPhysPage);
    923923#endif
    924924            return VINF_SUCCESS;
     
    10371037
    10381038#ifndef IN_RC
    1039             HWACCMInvalidatePhysPage(VMMGetCpu(pVM), GCPhysPage);
     1039            HWACCMInvalidatePhysPage(pVM, GCPhysPage);
    10401040#endif
    10411041            return VINF_SUCCESS;
  • trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp

    r19872 r19903  
    12971297     */
    12981298    int rc = pgmPoolFlushPage(pPool, pPage);
     1299    /* This flush was initiated by us and not the guest, so explicitly flush the TLB. */
    12991300    if (rc == VINF_SUCCESS)
    1300         PGM_INVL_VCPU_TLBS(VMMGetCpu(pVM)); /* see PT handler. */
     1301        PGM_INVL_ALL_VCPU_TLBS(pVM);
    13011302    return rc;
    13021303}
     
    39633964static int pgmPoolMakeMoreFreePages(PPGMPOOL pPool, PGMPOOLKIND enmKind, uint16_t iUser)
    39643965{
     3966    PVM pVM = pPool->CTX_SUFF(pVM);
     3967
    39653968    LogFlow(("pgmPoolMakeMoreFreePages: iUser=%#x\n", iUser));
    39663969
     
    39783981        STAM_PROFILE_ADV_SUSPEND(&pPool->StatAlloc, a);
    39793982#ifdef IN_RING3
    3980         int rc = PGMR3PoolGrow(pPool->pVMR3);
     3983        int rc = PGMR3PoolGrow(pVM);
    39813984#else
    3982         int rc = CTXALLMID(VMM, CallHost)(pPool->CTX_SUFF(pVM), VMMCALLHOST_PGM_POOL_GROW, 0);
     3985        int rc = CTXALLMID(VMM, CallHost)(pVM, VMMCALLHOST_PGM_POOL_GROW, 0);
    39833986#endif
    39843987        if (RT_FAILURE(rc))
  • trunk/src/VBox/VMM/VMMAll/PGMAllShw.h

    r19874 r19903  
    363363                Assert(pPT->a[iPTE].n.u1Present);
    364364# if PGM_SHW_TYPE == PGM_TYPE_EPT
    365                 HWACCMInvalidatePhysPage(pVCpu, (RTGCPHYS)GCPtr);
     365                HWACCMInvalidatePhysPage(pVM, (RTGCPHYS)GCPtr);
    366366# else
    367                 PGM_INVL_PG(pVCpu, GCPtr);
     367                PGM_INVL_ALL_VCPU_PG(pVM, GCPtr);
    368368# endif
    369369            }
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp

    r19829 r19903  
    23522352
    23532353
     2354#if 0 /* obsolete, but left here for clarification. */
    23542355/**
    23552356 * Invalidates a guest page by physical address
     
    23682369    return VINF_SUCCESS;
    23692370}
     2371#endif
    23702372
    23712373#if HC_ARCH_BITS == 32 && defined(VBOX_ENABLE_64_BITS_GUESTS) && !defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
Note: See TracChangeset for help on using the changeset viewer.

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