VirtualBox

Changeset 87822 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Feb 20, 2021 10:34:06 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
142883
Message:

VMM/TM: Let non-EMTs schedule timers too. Take care when translating idTimerCpu to a pVCpu. bugref:9943

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/TMAll.cpp

    r87814 r87822  
    342342DECLINLINE(void) tmScheduleNotify(PVMCC pVM)
    343343{
    344     PVMCPUCC pVCpuDst = VMCC_GET_CPU(pVM, pVM->tm.s.idTimerCpu);
     344    VMCPUID idCpu = pVM->tm.s.idTimerCpu;
     345    AssertReturnVoid(idCpu < pVM->cCpus);
     346    PVMCPUCC pVCpuDst = VMCC_GET_CPU(pVM, idCpu);
     347
    345348    if (!VMCPU_FF_IS_SET(pVCpuDst, VMCPU_FF_TIMER))
    346349    {
     
    360363DECLINLINE(void) tmSchedule(PVMCC pVM, PTMTIMERQUEUECC pQueueCC, PTMTIMERQUEUE pQueue, PTMTIMER pTimer)
    361364{
    362     if (VM_IS_EMT(pVM)) /** @todo drop EMT requirement here. */
    363     {
    364         int rc = PDMCritSectTryEnter(&pQueue->TimerLock);
    365         if (RT_SUCCESS_NP(rc))
    366         {
    367             STAM_PROFILE_START(&pVM->tm.s.CTX_SUFF_Z(StatScheduleOne), a);
    368             Log3(("tmSchedule: tmTimerQueueSchedule\n"));
    369             tmTimerQueueSchedule(pVM, pQueueCC, pQueue);
     365    int rc = PDMCritSectTryEnter(&pQueue->TimerLock);
     366    if (RT_SUCCESS_NP(rc))
     367    {
     368        STAM_PROFILE_START(&pVM->tm.s.CTX_SUFF_Z(StatScheduleOne), a);
     369        Log3(("tmSchedule: tmTimerQueueSchedule\n"));
     370        tmTimerQueueSchedule(pVM, pQueueCC, pQueue);
    370371#ifdef VBOX_STRICT
    371             tmTimerQueuesSanityChecks(pVM, "tmSchedule");
     372        tmTimerQueuesSanityChecks(pVM, "tmSchedule");
    372373#endif
    373             STAM_PROFILE_STOP(&pVM->tm.s.CTX_SUFF_Z(StatScheduleOne), a);
    374             PDMCritSectLeave(&pQueue->TimerLock);
    375             return;
    376         }
     374        STAM_PROFILE_STOP(&pVM->tm.s.CTX_SUFF_Z(StatScheduleOne), a);
     375        PDMCritSectLeave(&pQueue->TimerLock);
     376        return;
    377377    }
    378378
     
    864864}
    865865
     866
    866867/**
    867868 * Common worker for TMTimerPollGIP and TMTimerPoll.
     
    882883DECL_FORCE_INLINE(uint64_t) tmTimerPollInternal(PVMCC pVM, PVMCPUCC pVCpu, uint64_t *pu64Delta)
    883884{
    884     PVMCPU                  pVCpuDst      = VMCC_GET_CPU(pVM, pVM->tm.s.idTimerCpu);
    885     const uint64_t          u64Now        = TMVirtualGetNoCheck(pVM);
     885    VMCPUID idCpu = pVM->tm.s.idTimerCpu;
     886    AssertReturn(idCpu < pVM->cCpus, 0);
     887    PVMCPUCC pVCpuDst = VMCC_GET_CPU(pVM, idCpu);
     888
     889    const uint64_t u64Now = TMVirtualGetNoCheck(pVM);
    886890    STAM_COUNTER_INC(&pVM->tm.s.StatPoll);
    887891
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