VirtualBox

Changeset 8677 in vbox


Ignore:
Timestamp:
May 7, 2008 6:13:32 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
30610
Message:

Fixed lock accounting for locks aquired via VMM[GC|R0]CallHost.

Location:
trunk
Files:
4 edited

Legend:

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

    r8155 r8677  
    7474
    7575/**
    76  * Leaves a critical section entered with PDMCritSectEnter().
     76 * Enters a PDM critical section.
    7777 *
    7878 * @returns VINF_SUCCESS if entered successfully.
     
    8585 */
    8686PDMDECL(int) PDMCritSectEnter(PPDMCRITSECT pCritSect, int rcBusy);
     87
     88/**
     89 * Enters a PDM critical section.
     90 *
     91 * @returns VINF_SUCCESS if entered successfully.
     92 * @returns rcBusy when encountering a busy critical section in GC/R0.
     93 * @returns VERR_SEM_DESTROYED if the critical section is dead.
     94 *
     95 * @param   pCritSect           The PDM critical section to enter.
     96 * @param   fCallHost           Whether this is a VMMGCCallHost() or VMMR0CallHost() request.
     97 */
     98PDMR3DECL(int) PDMR3CritSectEnterEx(PPDMCRITSECT pCritSect, bool fCallHost);
    8799
    88100/**
  • trunk/src/VBox/VMM/PDM.cpp

    r8155 r8677  
    11821182
    11831183/**
    1184  * Serivce a VMMCALLHOST_PDM_LOCK call.
     1184 * Service a VMMCALLHOST_PDM_LOCK call.
    11851185 *
    11861186 * @returns VBox status code.
     
    11891189PDMR3DECL(int) PDMR3LockCall(PVM pVM)
    11901190{
    1191     return pdmLockEx(pVM, VERR_INTERNAL_ERROR);
    1192 }
    1193 
     1191#ifdef VBOX_WITH_PDM_LOCK
     1192    return PDMR3CritSectEnterEx(&pVM->pdm.s.CritSect, true /* fHostCall */);
     1193#else
     1194    return VINF_SUCCESS;
     1195#endif
     1196}
     1197
  • trunk/src/VBox/VMM/PGM.cpp

    r8624 r8677  
    23132313PDMR3DECL(int) PGMR3LockCall(PVM pVM)
    23142314{
    2315     return pgmLock(pVM);
     2315    int rc = PDMR3CritSectEnterEx(&pVM->pgm.s.CritSect, true /* fHostCall */);
     2316    AssertRC(rc);
     2317    return rc;
    23162318}
    23172319
  • trunk/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp

    r8155 r8677  
    3636#ifdef IN_RING3
    3737# include <iprt/semaphore.h>
    38 #endif 
    39 
    40 
    41 /**
    42  * Leaves a critical section entered with PDMCritSectEnter().
     38#endif
     39
     40
     41/**
     42 * Enters a PDM critical section.
    4343 *
    4444 * @returns VINF_SUCCESS if entered successfully.
     
    9696#endif
    9797}
     98
     99
     100#ifdef IN_RING3
     101/**
     102 * Enters a PDM critical section.
     103 *
     104 * @returns VINF_SUCCESS if entered successfully.
     105 * @returns rcBusy when encountering a busy critical section in GC/R0.
     106 * @returns VERR_SEM_DESTROYED if the critical section is dead.
     107 *
     108 * @param   pCritSect           The PDM critical section to enter.
     109 * @param   fCallHost           Whether this is a VMMGCCallHost() or VMMR0CallHost() request.
     110 */
     111PDMR3DECL(int) PDMR3CritSectEnterEx(PPDMCRITSECT pCritSect, bool fCallHost)
     112{
     113    int rc = PDMCritSectEnter(pCritSect, VERR_INTERNAL_ERROR);
     114    if (    rc == VINF_SUCCESS
     115        &&  fCallHost
     116        &&  pCritSect->s.Core.Strict.ThreadOwner != NIL_RTTHREAD)
     117    {
     118        RTThreadWriteLockDec(pCritSect->s.Core.Strict.ThreadOwner);
     119        ASMAtomicUoWriteSize(&pCritSect->s.Core.Strict.ThreadOwner, NIL_RTTHREAD);
     120    }
     121    return rc;
     122}
     123#endif /* IN_RING3 */
    98124
    99125
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