VirtualBox

Changeset 31350 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Aug 4, 2010 8:58:21 AM (14 years ago)
Author:
vboxsync
Message:

Rearranged mutex and preemption disabling order.

Location:
trunk/src/VBox/VMM/VMMR0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/GMMR0.cpp

    r30902 r31350  
    40974097#endif
    40984098
    4099 #ifdef DEBUG_sandervl
    41004099/**
    41014100 * Setup for a GMMR0CheckSharedModules call (to allow log flush jumps back to ring 3)
     
    41424141    return VINF_SUCCESS;
    41434142}
    4144 #endif
    41454143
    41464144/**
     
    41644162        return rc;
    41654163
    4166 # ifndef DEBUG_sandervl
    4167     /*
    4168      * Take the sempahore and do some more validations.
    4169      */
    4170     rc = RTSemFastMutexRequest(pGMM->Mtx);
    4171     AssertRC(rc);
    4172 # endif
    41734164    if (GMM_CHECK_SANITY_UPON_ENTERING(pGMM))
    41744165    {
     
    41914182        rc = VERR_INTERNAL_ERROR_5;
    41924183
    4193 # ifndef DEBUG_sandervl
    4194     RTSemFastMutexRelease(pGMM->Mtx);
    4195 # endif
    41964184    return rc;
    41974185#else
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r31348 r31350  
    965965            PVMCPU pVCpu = &pVM->aCpus[idCpu];
    966966
    967 # ifdef VBOX_WITH_VMMR0_DISABLE_PREEMPTION
    968             RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
    969             RTThreadPreemptDisable(&PreemptState);
    970 # elif !defined(RT_OS_WINDOWS)
    971             RTCCUINTREG uFlags = ASMIntDisableFlags();
    972 # endif
    973             /* Select a valid VCPU context. */
    974             ASMAtomicWriteU32(&pVCpu->idHostCpu, RTMpCpuId());
    975 
    976 # ifdef DEBUG_sandervl
    977             /* Make sure that log flushes can jump back to ring-3; annoying to get an incomplete log (this is risky though as the code doesn't take this into account). */
     967            /* Make sure that log flushes can jump back to ring-3; annoying to get an incomplete log (this is risky though as the code doesn't take this into account).
     968             * Also grab the fast mutex before disabling preemption.
     969             */
    978970            int rc = GMMR0CheckSharedModulesStart(pVM);
    979971            if (rc == VINF_SUCCESS)
    980972            {
     973# ifdef VBOX_WITH_VMMR0_DISABLE_PREEMPTION
     974                RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
     975                RTThreadPreemptDisable(&PreemptState);
     976# elif !defined(RT_OS_WINDOWS)
     977                RTCCUINTREG uFlags = ASMIntDisableFlags();
     978# endif
     979                /* Select a valid VCPU context. */
     980                ASMAtomicWriteU32(&pVCpu->idHostCpu, RTMpCpuId());
     981
    981982                rc = vmmR0CallRing3SetJmp(&pVCpu->vmm.s.CallRing3JmpBufR0, GMMR0CheckSharedModules, pVM, pVCpu); /* this may resume code. */
     983
     984                /* Clear the VCPU context. */
     985                ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
     986# ifdef VBOX_WITH_VMMR0_DISABLE_PREEMPTION
     987                RTThreadPreemptRestore(&PreemptState);
     988# elif !defined(RT_OS_WINDOWS)
     989                ASMSetFlags(uFlags);
     990# endif
     991
    982992                GMMR0CheckSharedModulesEnd(pVM);
    983993            }
    984 # else
    985             int rc = GMMR0CheckSharedModules(pVM, pVCpu);
    986 # endif
    987 
    988             /* Clear the VCPU context. */
    989             ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
    990 # ifdef VBOX_WITH_VMMR0_DISABLE_PREEMPTION
    991             RTThreadPreemptRestore(&PreemptState);
    992 # elif !defined(RT_OS_WINDOWS)
    993             ASMSetFlags(uFlags);
    994 # endif
    995994            return rc;
    996995        }
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