VirtualBox

Changeset 54395 in vbox for trunk/src/VBox/VMM/VMMR0


Ignore:
Timestamp:
Feb 23, 2015 5:34:01 PM (10 years ago)
Author:
vboxsync
Message:

IPRT, HostDriver, VMMR0: MP notifications fixes for TSC-delta measurements, scheduling of notification callback taken care by the API consumer instead of IPRT.

File:
1 edited

Legend:

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

    r54332 r54395  
    994994 *
    995995 * @returns VBox status code.
    996  * @param   idCpu       The identifier for the CPU the function is called on.
     996 * @param   idCpu       The identifier for the CPU this function is called on.
    997997 *
    998998 * @remarks Must be called with preemption disabled.
     
    10071007    Assert(idCpu < RT_ELEMENTS(g_HvmR0.aCpuInfo));
    10081008    Assert(!pCpu->fConfigured || pCpu->hMemObj != NIL_RTR0MEMOBJ);
     1009    AssertRelease(idCpu == RTMpCpuId());
    10091010
    10101011    if (pCpu->hMemObj == NIL_RTR0MEMOBJ)
     
    10121013
    10131014    int rc;
    1014     if (   pCpu->fConfigured
    1015         && idCpu == RTMpCpuId())    /* We may not be firing on the CPU being disabled/going offline. */
     1015    if (pCpu->fConfigured)
    10161016    {
    10171017        void    *pvCpuPage     = RTR0MemObjAddress(pCpu->hMemObj);
     
    10431043    AssertReturnVoid(g_HvmR0.fGlobalInit);
    10441044    hmR0FirstRcSetStatus(pFirstRc, hmR0DisableCpu(idCpu));
     1045}
     1046
     1047
     1048/**
     1049 * Worker function passed to RTMpOnSpecific() that is to be called on the target
     1050 * CPU.
     1051 *
     1052 * @param   idCpu       The identifier for the CPU the function is called on.
     1053 * @param   pvUser1     Null, not used.
     1054 * @param   pvUser2     Null, not used.
     1055 */
     1056static DECLCALLBACK(void) hmR0DisableCpuOnSpecificCallback(RTCPUID idCpu, void *pvUser1, void *pvUser2)
     1057{
     1058    NOREF(pvUser1);
     1059    NOREF(pvUser2);
     1060    hmR0DisableCpu(idCpu);
    10451061}
    10461062
     
    10611077     * CPU comes online, the initialization is done lazily in HMR0Enter().
    10621078     */
    1063     Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
    10641079    switch (enmEvent)
    10651080    {
    10661081        case RTMPEVENT_OFFLINE:
    10671082        {
    1068             int rc = hmR0DisableCpu(idCpu);
    1069             AssertRC(rc);
     1083            RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
     1084            RTThreadPreemptDisable(&PreemptState);
     1085            if (idCpu == RTMpCpuId())
     1086            {
     1087                int rc = hmR0DisableCpu(idCpu);
     1088                AssertRC(rc);
     1089                RTThreadPreemptRestore(&PreemptState);
     1090            }
     1091            else
     1092            {
     1093                RTThreadPreemptRestore(&PreemptState);
     1094                RTMpOnSpecific(idCpu, hmR0DisableCpuOnSpecificCallback, NULL /* pvUser1 */, NULL /* pvUser2 */);
     1095            }
    10701096            break;
    10711097        }
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