Changeset 81333 in vbox for trunk/src/VBox/VMM/VMMR0
- Timestamp:
- Oct 17, 2019 11:49:39 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 134046
- Location:
- trunk/src/VBox/VMM/VMMR0
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/IOMR0IoPort.cpp
r81197 r81333 271 271 AssertReturn(pGVM->iom.s.cIoPortStatsAllocation == cOldEntries, VERR_IOM_IOPORT_IPE_1); 272 272 AssertReturn(pGVM->iom.s.cIoPortStats <= cOldEntries, VERR_IOM_IOPORT_IPE_2); 273 AssertReturn(!pGVM->iomr0.s.fIoPortStatsFrozen, VERR_WRONG_ORDER); 273 274 274 275 /* … … 329 330 } 330 331 332 /** 333 * Called after all devices has been instantiated to copy over the statistics 334 * indices to the ring-0 I/O port registration table. 335 * 336 * This simplifies keeping statistics for I/O port ranges that are ring-3 only. 337 * 338 * After this call, IOMR0IoPortGrowStatisticsTable() will stop working. 339 * 340 * @returns VBox status code. 341 * @param pGVM The global (ring-0) VM structure. 342 * @thread EMT(0) 343 * @note Only callable at VM creation time. 344 */ 345 VMMR0_INT_DECL(int) IOMR0IoPortSyncStatisticsIndices(PGVM pGVM) 346 { 347 VM_ASSERT_EMT0_RETURN(pGVM, VERR_VM_THREAD_NOT_EMT); 348 VM_ASSERT_STATE_RETURN(pGVM, VMSTATE_CREATING, VERR_VM_INVALID_VM_STATE); 349 350 #ifdef VBOX_WITH_STATISTICS 351 /* 352 * First, freeze the statistics array: 353 */ 354 pGVM->iomr0.s.fIoPortStatsFrozen = true; 355 356 /* 357 * Second, synchronize the indices: 358 */ 359 uint32_t const cRegs = RT_MIN(pGVM->iom.s.cIoPortRegs, pGVM->iomr0.s.cIoPortAlloc); 360 uint32_t const cStatsAlloc = pGVM->iomr0.s.cIoPortStatsAllocation; 361 PIOMIOPORTENTRYR0 paIoPortRegs = pGVM->iomr0.s.paIoPortRegs; 362 IOMIOPORTENTRYR3 const *paIoPortRegsR3 = pGVM->iomr0.s.paIoPortRing3Regs; 363 AssertReturn((paIoPortRegs && paIoPortRegsR3) || cRegs == 0, VERR_IOM_IOPORT_IPE_3); 364 365 for (uint32_t i = 0 ; i < cRegs; i++) 366 { 367 uint16_t idxStats = paIoPortRegsR3[i].idxStats; 368 paIoPortRegs[i].idxStats = idxStats < cStatsAlloc ? idxStats : UINT16_MAX; 369 } 370 371 #else 372 RT_NOREF(pGVM); 373 #endif 374 return VINF_SUCCESS; 375 } 376 -
trunk/src/VBox/VMM/VMMR0/IOMR0Mmio.cpp
r81197 r81333 268 268 AssertReturn(pGVM->iom.s.cMmioStatsAllocation == cOldEntries, VERR_IOM_MMIO_IPE_1); 269 269 AssertReturn(pGVM->iom.s.cMmioStats <= cOldEntries, VERR_IOM_MMIO_IPE_2); 270 AssertReturn(!pGVM->iomr0.s.fMmioStatsFrozen, VERR_WRONG_ORDER); 270 271 271 272 /* … … 326 327 } 327 328 329 330 /** 331 * Called after all devices has been instantiated to copy over the statistics 332 * indices to the ring-0 MMIO registration table. 333 * 334 * This simplifies keeping statistics for MMIO ranges that are ring-3 only. 335 * 336 * @returns VBox status code. 337 * @param pGVM The global (ring-0) VM structure. 338 * @thread EMT(0) 339 * @note Only callable at VM creation time. 340 */ 341 VMMR0_INT_DECL(int) IOMR0MmioSyncStatisticsIndices(PGVM pGVM) 342 { 343 VM_ASSERT_EMT0_RETURN(pGVM, VERR_VM_THREAD_NOT_EMT); 344 VM_ASSERT_STATE_RETURN(pGVM, VMSTATE_CREATING, VERR_VM_INVALID_VM_STATE); 345 346 #ifdef VBOX_WITH_STATISTICS 347 /* 348 * First, freeze the statistics array: 349 */ 350 pGVM->iomr0.s.fMmioStatsFrozen = true; 351 352 /* 353 * Second, synchronize the indices: 354 */ 355 uint32_t const cRegs = RT_MIN(pGVM->iom.s.cMmioRegs, pGVM->iomr0.s.cMmioAlloc); 356 uint32_t const cStatsAlloc = pGVM->iomr0.s.cMmioStatsAllocation; 357 PIOMMMIOENTRYR0 paMmioRegs = pGVM->iomr0.s.paMmioRegs; 358 IOMMMIOENTRYR3 const *paMmioRegsR3 = pGVM->iomr0.s.paMmioRing3Regs; 359 AssertReturn((paMmioRegs && paMmioRegsR3) || cRegs == 0, VERR_IOM_MMIO_IPE_3); 360 361 for (uint32_t i = 0 ; i < cRegs; i++) 362 { 363 uint16_t idxStats = paMmioRegsR3[i].idxStats; 364 paMmioRegs[i].idxStats = idxStats < cStatsAlloc ? idxStats : UINT16_MAX; 365 } 366 367 #else 368 RT_NOREF(pGVM); 369 #endif 370 return VINF_SUCCESS; 371 } 372 -
trunk/src/VBox/VMM/VMMR0/VMMR0.cpp
r81197 r81333 2217 2217 } 2218 2218 2219 case VMMR0_DO_IOM_SYNC_STATS_INDICES: 2220 { 2221 if (pReqHdr || idCpu != 0) 2222 return VERR_INVALID_PARAMETER; 2223 rc = IOMR0IoPortSyncStatisticsIndices(pGVM); 2224 if (RT_SUCCESS(rc)) 2225 rc = IOMR0MmioSyncStatisticsIndices(pGVM); 2226 VMM_CHECK_SMAP_CHECK2(pGVM, RT_NOTHING); 2227 break; 2228 } 2229 2219 2230 /* 2220 2231 * For profiling.
Note:
See TracChangeset
for help on using the changeset viewer.