VirtualBox

Changeset 20753 in vbox


Ignore:
Timestamp:
Jun 21, 2009 11:11:24 PM (15 years ago)
Author:
vboxsync
Message:

VMM: Added PDMR3CritSectLeaveAll for bulk unlocking during guru meditation.

Location:
trunk
Files:
4 edited

Legend:

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

    r20374 r20753  
    7171VMMDECL(void)       PDMCritSectFF(PVMCPU pVCpu);
    7272VMMR3DECL(uint32_t) PDMR3CritSectCountOwned(PVM pVM, char *pszNames, size_t cbNames);
     73VMMR3DECL(void)     PDMR3CritSectLeaveAll(PVM pVM);
    7374
    7475/** @} */
  • trunk/src/VBox/VMM/PDMCritSect.cpp

    r20087 r20753  
    2626#define LOG_GROUP LOG_GROUP_PDM//_CRITSECT
    2727#include "PDMInternal.h"
    28 #include <VBox/pdm.h>
     28#include <VBox/pdmcritsect.h>
    2929#include <VBox/mm.h>
    3030#include <VBox/vm.h>
     
    476476    return cCritSects;
    477477}
     478
     479
     480/**
     481 * Leave all critical sections the calling thread owns.
     482 *
     483 * @param   pVM         The VM handle.
     484 */
     485void PDMR3CritSectLeaveAll(PVM pVM)
     486{
     487    RTNATIVETHREAD const hNativeSelf = RTThreadNativeSelf();
     488
     489    RTCritSectEnter(&pVM->pdm.s.MiscCritSect);
     490    for (PPDMCRITSECTINT pCur = pVM->pdm.s.pCritSects;
     491         pCur;
     492         pCur = pCur->pNext)
     493    {
     494        while (     pCur->Core.NativeThreadOwner == hNativeSelf
     495               &&   pCur->Core.cNestings > 0)
     496            PDMCritSectLeave((PPDMCRITSECT)pCur);
     497    }
     498    RTCritSectLeave(&pVM->pdm.s.MiscCritSect);
     499}
     500
  • trunk/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp

    r20702 r20753  
    2626#define LOG_GROUP LOG_GROUP_PDM//_CRITSECT
    2727#include "PDMInternal.h"
    28 #include <VBox/pdm.h>
     28#include <VBox/pdmcritsect.h>
    2929#include <VBox/mm.h>
    3030#include <VBox/vm.h>
  • trunk/src/VBox/VMM/VMMGuruMeditation.cpp

    r19797 r20753  
    2626#include <VBox/vmm.h>
    2727#include <VBox/pdmapi.h>
     28#include <VBox/pdmcritsect.h>
    2829#include <VBox/trpm.h>
    2930#include <VBox/dbgf.h>
     
    213214
    214215    /* Release owned locks to make sure other VCPUs can continue in case they were waiting for one. */
     216#if 1
     217    PDMR3CritSectLeaveAll(pVM);
     218#else
    215219    MMR3ReleaseOwnedLocks(pVM);
    216220    PGMR3ReleaseOwnedLocks(pVM);
     
    218222    IOMR3ReleaseOwnedLocks(pVM);
    219223    EMR3ReleaseOwnedLocks(pVM);
     224#endif
    220225
    221226    /*
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