Changeset 92720 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Dec 2, 2021 10:41:09 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/TM.cpp
r92712 r92720 192 192 static const char *tmR3GetTSCModeName(PVM pVM); 193 193 static const char *tmR3GetTSCModeNameEx(TMTSCMODE enmMode); 194 static int tmR3TimerQueueGrow(PVM pVM, PTMTIMERQUEUE pQueue, uint32_t cNewTimers); 194 195 195 196 … … 1072 1073 1073 1074 /* 1074 * Resolve symbols. 1075 */ 1076 rc = PDMR3LdrGetSymbolR0(pVM, NULL, "tmVirtualNanoTSBad", &pVM->tm.s.VirtualGetRawDataR0.pfnBad); 1077 AssertRCReturn(rc, rc); 1078 rc = PDMR3LdrGetSymbolR0(pVM, NULL, "tmVirtualNanoTSBadCpuIndex", &pVM->tm.s.VirtualGetRawDataR0.pfnBadCpuIndex); 1079 AssertRCReturn(rc, rc); 1080 rc = PDMR3LdrGetSymbolR0(pVM, NULL, "tmVirtualNanoTSRediscover", &pVM->tm.s.VirtualGetRawDataR0.pfnRediscover); 1081 AssertRCReturn(rc, rc); 1082 pVM->tm.s.pfnVirtualGetRawR0 = pVM->tm.s.VirtualGetRawDataR0.pfnRediscover; 1075 * Resolve symbols, unless we're in driverless mode. 1076 */ 1077 if (!SUPR3IsDriverless()) 1078 { 1079 rc = PDMR3LdrGetSymbolR0(pVM, NULL, "tmVirtualNanoTSBad", &pVM->tm.s.VirtualGetRawDataR0.pfnBad); 1080 AssertRCReturn(rc, rc); 1081 rc = PDMR3LdrGetSymbolR0(pVM, NULL, "tmVirtualNanoTSBadCpuIndex", &pVM->tm.s.VirtualGetRawDataR0.pfnBadCpuIndex); 1082 AssertRCReturn(rc, rc); 1083 rc = PDMR3LdrGetSymbolR0(pVM, NULL, "tmVirtualNanoTSRediscover", &pVM->tm.s.VirtualGetRawDataR0.pfnRediscover); 1084 AssertRCReturn(rc, rc); 1085 pVM->tm.s.pfnVirtualGetRawR0 = pVM->tm.s.VirtualGetRawDataR0.pfnRediscover; 1086 } 1083 1087 1084 1088 #ifndef VBOX_WITHOUT_NS_ACCOUNTING … … 1107 1111 { 1108 1112 PTMTIMERQUEUE pQueue = &pVM->tm.s.aTimerQueues[s_aExtra[i].idxQueue]; 1113 PDMCritSectRwEnterExcl(pVM, &pQueue->AllocLock, VERR_IGNORED); 1109 1114 if (s_aExtra[i].cExtra > pQueue->cTimersFree) 1110 1115 { 1111 PDMCritSectRwEnterExcl(pVM, &pQueue->AllocLock, VERR_IGNORED);1112 1116 uint32_t cTimersAlloc = pQueue->cTimersAlloc + s_aExtra[i].cExtra - pQueue->cTimersFree; 1113 rc = VMMR3CallR0Emt(pVM, VMMGetCpu(pVM), VMMR0_DO_TM_GROW_TIMER_QUEUE, 1114 RT_MAKE_U64(cTimersAlloc, s_aExtra[i].idxQueue), NULL); 1117 rc = tmR3TimerQueueGrow(pVM, pQueue, cTimersAlloc); 1115 1118 AssertLogRelMsgReturn(RT_SUCCESS(rc), ("rc=%Rrc cTimersAlloc=%u %s\n", rc, cTimersAlloc, pQueue->szName), rc); 1116 PDMCritSectRwLeaveExcl(pVM, &pQueue->AllocLock);1117 1119 } 1120 PDMCritSectRwLeaveExcl(pVM, &pQueue->AllocLock); 1118 1121 } 1119 1122 … … 1530 1533 * @param pVM The cross context VM structure. 1531 1534 * @param pQueue The timer queue to grow. 1535 * @param cNewTimers The minimum number of timers after growing. 1532 1536 * @note Caller owns the queue's allocation lock. 1533 1537 */ 1534 static int tmR3TimerQueueGrow(PVM pVM, PTMTIMERQUEUE pQueue )1538 static int tmR3TimerQueueGrow(PVM pVM, PTMTIMERQUEUE pQueue, uint32_t cNewTimers) 1535 1539 { 1536 1540 /* … … 1541 1545 AssertReturn(!pQueue->fCannotGrow, VERR_TM_TIMER_QUEUE_CANNOT_GROW); 1542 1546 1547 uint32_t const cOldEntries = pQueue->cTimersAlloc; 1548 AssertReturn(cNewTimers > cOldEntries, VERR_TM_IPE_1); 1549 AssertReturn(cNewTimers < _32K, VERR_TM_IPE_1); 1550 1543 1551 /* 1544 1552 * Do the growing. 1545 1553 */ 1546 1554 int rc; 1547 uint32_t const cOldEntries = pQueue->cTimersAlloc;1548 uint32_t cNewTimers = cOldEntries + 64;1549 Assert(cNewTimers < _32K);1550 1555 if (!SUPR3IsDriverless()) 1551 1556 { … … 1638 1643 if (!pQueue->cTimersFree) 1639 1644 { 1640 rc = tmR3TimerQueueGrow(pVM, pQueue );1645 rc = tmR3TimerQueueGrow(pVM, pQueue, pQueue->cTimersAlloc + 64); 1641 1646 AssertRCReturnStmt(rc, PDMCritSectRwLeaveExcl(pVM, &pQueue->AllocLock), rc); 1642 1647 } … … 3842 3847 PSUPGLOBALINFOPAGE pGip; 3843 3848 return tmR3HasFixedTSC(pVM) /* Host has fixed-rate TSC. */ 3844 && ( (pGip = g_pSUPGlobalInfoPage) != NULL /* Can be NULL in driverless mode. */3849 && ( (pGip = g_pSUPGlobalInfoPage) == NULL /* Can be NULL in driverless mode. */ 3845 3850 || (pGip->u32Mode != SUPGIPMODE_ASYNC_TSC)); /* GIP thinks it's monotonic. */ 3846 3851 }
Note:
See TracChangeset
for help on using the changeset viewer.